forked from matinaghaei/Portfolio-Management-ActorCriticRL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
37 lines (27 loc) · 967 Bytes
/
main.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
import warnings
warnings.filterwarnings('ignore')
from algorithms.ddpg.ddpg import DDPG
from algorithms.a2c.a2c import A2C
from algorithms.ppo.ppo import PPO
import plot
import torch.multiprocessing as mp
import os
def main():
plot.initialize()
mp.set_start_method('spawn')
for i in range(50):
print(f"---------- round {i} ----------")
if not os.path.isfile(f'plots/ddpg/{i}2_testing.png'):
ddpg = DDPG(state_type='indicators', djia_year=2019, repeat=i)
ddpg.train()
ddpg.test()
if not os.path.isfile(f'plots/ppo/{i}2_testing.png'):
ppo = PPO(state_type='indicators', djia_year=2019, repeat=i)
ppo.train()
ppo.test()
if not os.path.isfile(f'plots/a2c/{i}2_testing.png'):
a2c = A2C(n_agents=8, state_type='indicators', djia_year=2019, repeat=i)
a2c.train()
a2c.test()
if __name__ == '__main__':
main()