jingedawang / StockPredictor

Predict the stock price with AI models.
http://stockprediction.org/
MIT License
20 stars 6 forks source link

How to change predict as 2days or only one day? #47

Open bell99431 opened 1 year ago

bell99431 commented 1 year ago

Thanks for share! How to config the predict as N days? And, What's the predict accurate data with backtest?

jingedawang commented 1 year ago

I'm using qlib library for model training. The data_handler.py extends the Alpha158 class and line14 set the predicting range to 9 days (10 - 1 = 9, although I was originally intended to set to 10 days).

If you want to predict N days, change 10 to N + 1 and re-train the model. If you want to predict one day, just use Alpha158 instead of Alpha158TwoWeeks. Predicting for any days could be supported later, either as a config or generally supported.

I haven't implemented the backtest part of this model. You could refer to the backtest of one-day-models in qlib: https://github.com/microsoft/qlib/tree/main/examples/benchmarks#alpha158-dataset We are using LightGBM model.

bell99431 commented 1 year ago

Thx, I'll try it.

jingedawang commented 1 year ago

Cool! If you have any suggestions or improving for the code, please let me know. Thank you!