Create a simulation to test 1 month of data in 30 mins
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user