Use threading for python. and make singals from python

This commit is contained in:
derek holloway
2026-02-19 15:09:06 -08:00
parent 4f08732c78
commit 6172d1c373
3 changed files with 51 additions and 12 deletions
+13 -3
View File
@@ -8,18 +8,20 @@ import features
import matplotlib
matplotlib.use("Agg")
def Predict():
def Predict(Symbol):
# 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("NVDA", period="2mo", auto_adjust=True)
df = yf.download(Symbol, period="2mo", auto_adjust=True)
if not df.empty:
df = features.MakeFeatures(df, 1)
df = features.CleanDF(df)
print(Symbol)
# Drop our predictor
df.drop('Target_Close', axis=1, inplace=True)
@@ -50,7 +52,15 @@ def Predict():
print(f"Predicted Target_Close: {flat_predictions}")
return json.dumps(flat_predictions)
movement_indicator = 0
if (np.mean(flat_predictions) > 0.01):
movement_indicator = 1
elif (np.mean(flat_predictions) < -0.01):
movement_indicator = -1
else:
movement_indicator = 0
return movement_indicator
if __name__ == "__main__":
Predict()