Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cloud computing cw
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sivaramalingam, Janani (PG/T - Comp Sci & Elec Eng)
cloud computing cw
Commits
8d7d6da7
Commit
8d7d6da7
authored
1 year ago
by
Sivaramalingam, Janani (PG/T - Comp Sci & Elec Eng)
Browse files
Options
Downloads
Patches
Plain Diff
Update val_sim.py
parent
5fc3b1c7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
val_sim.py
+11
-15
11 additions, 15 deletions
val_sim.py
with
11 additions
and
15 deletions
val_sim.py
+
11
−
15
View file @
8d7d6da7
...
...
@@ -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
a
s
JSON
print
(
"
Content-Type: application/json
\n
"
)
print
(
json
.
dumps
(
response
))
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment