-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.py
More file actions
79 lines (67 loc) · 1.88 KB
/
main.py
File metadata and controls
79 lines (67 loc) · 1.88 KB
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
69
70
71
72
73
74
75
76
77
78
79
__version__ = "1.0.2"
from src.utils import clear_console
from src.ingestion import load_data
from src.features import prepare_features, normalize
from src.model.functions import prepare_tensors, prepare_model_params, train_model, evaluate_model
from src.strategy import simulate_strategy
instrument = 'EURUSD'
interval = '1d'
target_column ='close'
strategy = 1
indicators = {
'sma': list(range(10, 41, 1))}
max_ind_period = max(max(periods) for periods in indicators.values())
samples_limit = 4000 + max_ind_period
train_ratio = 0.875
seed = 42
epochs = 1000
model_num = 1
clear_console()
print(f"ETAP 1/8: Ładowanie danych...")
if(df := load_data(instrument, interval, target_column, samples_limit)) is None:
print("Przerwano")
exit()
print("OK")
print()
print(f"ETAP 2/8: Preprocessing...")
if(df_dict := prepare_features(df, indicators, train_ratio)) is None:
print("Przerwano")
exit()
print("OK")
print()
print(f"ETAP 3/8: Normalizacja danych...")
if (df_dict := normalize(df_dict)) is None:
print("Przerwano")
exit()
print("OK")
print()
print(f"ETAP 4/8: Przygotowanie tensorów...")
if (ten_dict := prepare_tensors(df_dict)) is None:
print("Przerwano")
exit()
print("OK")
print()
print(f"ETAP 5/8: Konfiguracja modelu...")
if (mod_dict := prepare_model_params(ten_dict, seed, model_num)) is None:
print("Przerwano")
exit()
print("OK")
print()
print(f"ETAP 6/8: Trening modelu...")
if (mod_dict := train_model(ten_dict, mod_dict, epochs)) is None:
print("Przerwano")
exit()
print("OK")
print()
print(f"ETAP 7/8: Ewaluacja modelu...")
if (result := evaluate_model(mod_dict, df_dict, ten_dict)) is None:
print("Przerwano")
exit()
df_dict, ten_dict, mod_dict = result
print("OK")
print()
print(f"ETAP 8/8: Symulacja strategii...")
if (strategy_results := simulate_strategy(df_dict, strategy)) is None:
print("Przerwano")
exit()
print("OK")