-
Notifications
You must be signed in to change notification settings - Fork 0
/
simulate_dlpopt_agent.py
68 lines (61 loc) · 1.79 KB
/
simulate_dlpopt_agent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from datetime import datetime
import pickle
from simulate_agent import simulate_agent
if __name__ == "__main__":
from trading_gym.agents.dlpopt import DeepLPortfolioAgent
from trading_gym.utils.screener import Screener
assets_data = pickle.load(open("./assets_data_testing.pickle", "rb"))
# windows = [180, 60, 30, 15]
# epochs = 200
# screeners = [
# Screener("mix", 10, 15),
# Screener("mix", 5, 15),
# Screener("mix", 10, 5),
# Screener("mix", 5, 5),
# ]
# params_grid = []
# for w in windows:
# for screener in screeners:
# params_grid.append(
# {
# "window": w,
# "hidden_units": 50,
# "epochs": epochs,
# "screener": screener,
# "rebalance_each_n_obs": 7,
# }
# )
# start = datetime(2019, 5, 1)
# end = datetime(2021, 9, 30)
# start_eval_date = datetime(2020, 1, 1)
# TESTING
params_grid = [
{
"window": 180,
"screener": Screener("returns", 10, 15),
"hidden_units": 50,
"epochs": 200,
}
]
start = datetime(2020, 5, 1)
end = datetime(2022, 1, 12)
# TESTING WEEKLY REB
# params_grid = [
# {
# "window": 15,
# "screener": Screener("mix", 5, 5),
# "hidden_units": 50,
# "epochs": 200,
# "rebalance_each_n_obs": 7,
# }
# ]
# start = datetime(2020, 5, 1)
# end = datetime(2022, 1, 12)
simulate_agent(
assets_data=assets_data,
start=start,
end=end,
agent_class=DeepLPortfolioAgent,
agent_params_grid=params_grid,
file_suffix="testing_oot",
)