-
Notifications
You must be signed in to change notification settings - Fork 4
/
predict.py
41 lines (33 loc) · 992 Bytes
/
predict.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 sys
from datetime import datetime
from src.parameters import market, assets
from src.service.predictor import Predictor
from src.service.loader_ohlc import LoaderOHLC
# Variables
# ------------------------------------------------------------------------
interval = sys.argv[1] # 5m, 15m, 30m ...
model_path = sys.argv[2] # /Users/ivan/code/ta/model/gru-g-50-5000-223-5m-BTC.keras
end_at = datetime.utcnow()
width = 1000
# Data load
# ------------------------------------------------------------------------
loaderOHLC = LoaderOHLC()
loaderOHLC.flush()
loaderOHLC.load(
assets=assets,
market=market,
end_at=end_at,
interval=interval,
width=width
)
# Prediction
# ------------------------------------------------------------------------
predictor = Predictor(
assets=assets,
market=market,
interval=interval,
model_path=model_path,
width=100 # window width used in model training
)
predictor.load_model()
predictor.predict(tail_crop=1)