-
-
Notifications
You must be signed in to change notification settings - Fork 593
/
main.py
57 lines (48 loc) · 1.62 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import os
from argparse import ArgumentParser
from typing import List
from meta.config import ALPACA_API_BASE_URL
from meta.config import ALPACA_API_KEY
from meta.config import ALPACA_API_SECRET
from meta.config import DATA_SAVE_DIR
from meta.config import ERL_PARAMS
from meta.config import INDICATORS
from meta.config import RESULTS_DIR
from meta.config import RLlib_PARAMS
from meta.config import SAC_PARAMS
from meta.config import TENSORBOARD_LOG_DIR
from meta.config import TEST_END_DATE
from meta.config import TEST_START_DATE
from meta.config import TRADE_END_DATE
from meta.config import TRADE_START_DATE
from meta.config import TRAIN_END_DATE
from meta.config import TRAIN_START_DATE
from meta.config import TRAINED_MODEL_DIR
from meta.config_tickers import DOW_30_TICKER
def build_parser():
parser = ArgumentParser()
parser.add_argument(
"--mode",
dest="mode",
help="start mode, train, download_data" " backtest",
metavar="MODE",
default="train",
)
return parser
# "./" will be added in front of each directory
def check_and_make_directories(directories: List[str]):
for directory in directories:
if not os.path.exists("./" + directory):
os.makedirs("./" + directory)
def main():
parser = build_parser()
options = parser.parse_args()
check_and_make_directories(
[DATA_SAVE_DIR, TRAINED_MODEL_DIR, TENSORBOARD_LOG_DIR, RESULTS_DIR]
)
## Users can input the following command in terminal for different mode
# python main.py --mode=train
# python main.py --mode=test
# python main.py --mode=trade
if __name__ == "__main__":
main()