forked from AI4Finance-Foundation/FinRL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
41 lines (33 loc) · 1.03 KB
/
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
38
39
40
41
import json
import logging
import os
import time
from argparse import ArgumentParser
import datetime
from finrl.apps import config
def build_parser():
parser = ArgumentParser()
parser.add_argument(
"--mode",
dest="mode",
help="start mode, train, download_data" " backtest",
metavar="MODE",
default="train",
)
return parser
def main():
parser = build_parser()
options = parser.parse_args()
if not os.path.exists("./" + config.DATA_SAVE_DIR):
os.makedirs("./" + config.DATA_SAVE_DIR)
if not os.path.exists("./" + config.TRAINED_MODEL_DIR):
os.makedirs("./" + config.TRAINED_MODEL_DIR)
if not os.path.exists("./" + config.TENSORBOARD_LOG_DIR):
os.makedirs("./" + config.TENSORBOARD_LOG_DIR)
if not os.path.exists("./" + config.RESULTS_DIR):
os.makedirs("./" + config.RESULTS_DIR)
if options.mode == "train":
import finrl.train
finrl.train.train_stock_trading()
if __name__ == "__main__":
main()