Skip to content
Snippets Groups Projects

Update val_sim.py

parent 5fc3b1c7
No related branches found
No related tags found
No related merge requests found
......@@ -5,26 +5,22 @@ import random
from statistics import mean, stdev
import json
import sys
import cgitb
cgitb.enable()
# Read input from stdin
input_data = sys.stdin.read()
# Parse the input data as JSON
event_dict = json.loads(input_data)
event = json.loads(input_data)
# Extract the values from the event dictionary
dt = json.loads(event_dict['key1']) # List of dates
close = json.loads(event_dict['key2']) # List of close prices
buy = json.loads(event_dict['key3']) # List of buy signals
sell = json.loads(event_dict['key4']) # List of sell signals
h = int(event_dict['key5']) # History length
d = int(event_dict['key6']) # Number of shots
t = event_dict['key7'] # Trade type ('buy' or 'sell')
dt = eval(event['key1'])
close = eval(event['key2'])
buy = eval(event['key3'])
sell = eval(event['key4'])
h = int(event['key5'])
d = int(event['key6'])
t = event['key7']
minhistory = int(h)
shots = int(d)
minhistory = h
shots = d
var95_list = []
var99_list = []
......@@ -65,6 +61,6 @@ response = {
"var99_list": var99_list
}
# Print the output as a JSON string, which is how CGI scripts return data
# Output result as JSON
print("Content-Type: application/json\n")
print(json.dumps(response))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment