facebook / facebook/prophet

Strange issue: FBProphet giving random results on live stream data (while 85% on back testing)

Open
#2,488 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
20.4k
Forks
4.6k
Avg merge
19h 52m
Merged PRs (30d)
1

Description

Hi,

I have trained FBprophet model on crypto data, on backtesting it gives me more than 85% results, but when I try to connect it with live Binance API then it gives random results (50-50%), the model is trained on hourly time frame, so during live the code waits for 1 hours to complete then it does the prediction. I have tried many things even NEWTON, but it didn't work. Following is the code snippet.

```
********************Training CODE*******
recent_result["ds"] = recent_result["open_time"]
recent_result["y"] = recent_result["open"]

logging.info(f"Model Retrained Begin")

model_60_mins = Prophet(
daily_seasonality=True

)

model_60_mins.add_regressor("high")
model_60_mins.add_regressor("low")
model_60_mins.add_regressor("close")
model_60_mins.add_regressor("volume")
model_60_mins.add_regressor("Returns")
model_60_mins.add_regressor("Log Returns")
model_60_mins.add_regressor("BBANDS")
model_60_mins.add_regressor("RSI")
model_60_mins.add_regressor("MACD")
model_60_mins.add_regressor("SMA")
model_60_mins.add_regressor("EMA")

random.seed(1234)
model_60_mins.fit(recent_result)

************
******************Live code ****
recent_result = get_last_hour_tiker(spot_client) ### get last hour ticker value

# getting predicted value
predicted_time = recent_result.iloc[-1]["open_time"] + timedelta(minutes=60)

future = pd.DataFrame()
future["ds"] = [predicted_time]
future["y"] = [recent_result.iloc[-1]["open"]]

future["high"] = [recent_result.iloc[-1]["high"]]
future["low"] = [recent_result.iloc[-1]["low"]]
future["close"] = [recent_result.iloc[-1]["close"]]
future["volume"] = [recent_result.iloc[-1]["volume"]]
future["Returns"] = [recent_result.iloc[-1]["Returns"]]
future["Log Returns"] = [recent_result.iloc[-1]["Log Returns"]]
future["BBANDS"] = [recent_result.iloc[-1]["BBANDS"]]
future["RSI"] = [recent_result.iloc[-1]["RSI"]]
future["MACD"] = [recent_result.iloc[-1]["MACD"]]
future["SMA"] = [recent_result.iloc[-1]["SMA"]]
future["EMA"] = [recent_result.iloc[-1]["EMA"]]

# forecasting the predicted value
random.seed(1234)
forecast = model_60_mins.predict(future)

```

I tried seed value, even newton but none worked. No matter what I do backtesting results are good but when live are about 50-50.
Can someone help me out on what exactly is happening here or what I am doing wrong?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.