Spaces:
Sleeping
Sleeping
modify refs for intra models
Browse files- model_1h.py +7 -0
- model_30m.py +7 -5
- model_90m.py +7 -0
- model_day.py +0 -4
model_1h.py
CHANGED
@@ -237,6 +237,13 @@ def get_data():
|
|
237 |
# Get incremental data
|
238 |
spx1 = yf.Ticker('^GSPC')
|
239 |
yfp = spx1.history(start=last_date, interval='30m')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
# Concat current and incremental
|
241 |
df_30m = pd.concat([fr, yfp])
|
242 |
# Get the first 30 minute bar
|
|
|
237 |
# Get incremental data
|
238 |
spx1 = yf.Ticker('^GSPC')
|
239 |
yfp = spx1.history(start=last_date, interval='30m')
|
240 |
+
|
241 |
+
if len(yfp) > 0:
|
242 |
+
# Concat current and incremental
|
243 |
+
df_30m = pd.concat([fr, yfp])
|
244 |
+
else:
|
245 |
+
df_30m = fr.copy()
|
246 |
+
|
247 |
# Concat current and incremental
|
248 |
df_30m = pd.concat([fr, yfp])
|
249 |
# Get the first 30 minute bar
|
model_30m.py
CHANGED
@@ -226,9 +226,6 @@ def get_data():
|
|
226 |
fr['High'] = pd.to_numeric(fr['High'])
|
227 |
fr['Low'] = pd.to_numeric(fr['Low'])
|
228 |
fr['Close'] = pd.to_numeric(fr['Close'])
|
229 |
-
|
230 |
-
# Set index for ready to concat
|
231 |
-
|
232 |
|
233 |
# Get incremental date
|
234 |
last_date = fr.index.date[-1]
|
@@ -236,8 +233,13 @@ def get_data():
|
|
236 |
# Get incremental data
|
237 |
spx1 = yf.Ticker('^GSPC')
|
238 |
yfp = spx1.history(start=last_date, interval='30m')
|
239 |
-
|
240 |
-
|
|
|
|
|
|
|
|
|
|
|
241 |
# Get the first 30 minute bar
|
242 |
df_30m = df_30m.reset_index()
|
243 |
df_30m['Datetime'] = df_30m['Datetime'].dt.date
|
|
|
226 |
fr['High'] = pd.to_numeric(fr['High'])
|
227 |
fr['Low'] = pd.to_numeric(fr['Low'])
|
228 |
fr['Close'] = pd.to_numeric(fr['Close'])
|
|
|
|
|
|
|
229 |
|
230 |
# Get incremental date
|
231 |
last_date = fr.index.date[-1]
|
|
|
233 |
# Get incremental data
|
234 |
spx1 = yf.Ticker('^GSPC')
|
235 |
yfp = spx1.history(start=last_date, interval='30m')
|
236 |
+
|
237 |
+
if len(yfp) > 0:
|
238 |
+
# Concat current and incremental
|
239 |
+
df_30m = pd.concat([fr, yfp])
|
240 |
+
else:
|
241 |
+
df_30m = fr.copy()
|
242 |
+
|
243 |
# Get the first 30 minute bar
|
244 |
df_30m = df_30m.reset_index()
|
245 |
df_30m['Datetime'] = df_30m['Datetime'].dt.date
|
model_90m.py
CHANGED
@@ -237,6 +237,13 @@ def get_data():
|
|
237 |
# Get incremental data
|
238 |
spx1 = yf.Ticker('^GSPC')
|
239 |
yfp = spx1.history(start=last_date, interval='30m')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
240 |
# Concat current and incremental
|
241 |
df_30m = pd.concat([fr, yfp])
|
242 |
# Get the first 30 minute bar
|
|
|
237 |
# Get incremental data
|
238 |
spx1 = yf.Ticker('^GSPC')
|
239 |
yfp = spx1.history(start=last_date, interval='30m')
|
240 |
+
|
241 |
+
if len(yfp) > 0:
|
242 |
+
# Concat current and incremental
|
243 |
+
df_30m = pd.concat([fr, yfp])
|
244 |
+
else:
|
245 |
+
df_30m = fr.copy()
|
246 |
+
|
247 |
# Concat current and incremental
|
248 |
df_30m = pd.concat([fr, yfp])
|
249 |
# Get the first 30 minute bar
|
model_day.py
CHANGED
@@ -15,10 +15,6 @@ import os
|
|
15 |
from sklearn.metrics import roc_auc_score, precision_score, recall_score
|
16 |
import datetime
|
17 |
from pandas.tseries.offsets import BDay
|
18 |
-
from datasets import load_dataset
|
19 |
-
|
20 |
-
# If the dataset is gated/private, make sure you have run huggingface-cli login
|
21 |
-
dataset = load_dataset("boomsss/spx_intra", split="train")
|
22 |
|
23 |
def walk_forward_validation(df, target_column, num_training_rows, num_periods):
|
24 |
|
|
|
15 |
from sklearn.metrics import roc_auc_score, precision_score, recall_score
|
16 |
import datetime
|
17 |
from pandas.tseries.offsets import BDay
|
|
|
|
|
|
|
|
|
18 |
|
19 |
def walk_forward_validation(df, target_column, num_training_rows, num_periods):
|
20 |
|