Create a simulation to test 1 month of data in 30 mins

This commit is contained in:
2026-03-11 21:33:19 -07:00
parent 9b5ebb4140
commit d5df9d1014
6 changed files with 156 additions and 9 deletions
+18 -1
View File
@@ -1,3 +1,4 @@
from datetime import datetime, timedelta
import os
import sys
import joblib
@@ -13,13 +14,29 @@ def Predict():
# Get the Symbol from ARGV
Symbol = sys.argv[1]
# get the number of days ago to run the simulation for
DaysBack = int(sys.argv[2])
print(f"Days back: {DaysBack}")
# calculate the time offsets
end_date = datetime.now() - timedelta(days=DaysBack)
start_date = end_date - timedelta(days=70)
# convert to string formats
start_str = start_date.strftime('%Y-%m-%d')
end_str = end_date.strftime('%Y-%m-%d')
print(f"Start Date: {start_str}")
print(f"End Date: {end_str}")
# Define paths (consistent with your previous script)
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
DATA_DIR = os.path.join(SCRIPT_DIR, "data")
MODEL_PATH = os.path.join(DATA_DIR, "model.keras")
# Pull 1 month of current data to make prediction against | for volatility 20
df = yf.download(Symbol, period="2mo", auto_adjust=True)
df = yf.download(Symbol, start=start_str, end=end_str, auto_adjust=True, progress=False)
if not df.empty:
# Remove the horizontal ticker column
df.columns = df.columns.get_level_values(0)