notadamking / RLTrader

A cryptocurrency trading environment using deep reinforcement learning and OpenAI's gym
https://discord.gg/ZZ7BGWh
GNU General Public License v3.0
1.71k stars 537 forks source link

Allow user-defined prediction models to replace SARIMAX with LSTM, FB Prophet, etc. #15

Open NervousEnergy1979 opened 5 years ago

NervousEnergy1979 commented 5 years ago

Instead of using the SARIMAX model's predictions to be fed as a feature / observation into the agent at every time step, maybe using the predictions of a separately trained LSTM may perform better. I've found that LSTM's trained on stationary time series usually perform ok, in that their prediction "direction" (up or down) is generally correct. Also, the slope (change in log returns with respect to time) of the LSTM prediction can be used as an additional input feature as an indicator for the severity of the predicted change (will the price jump up or down suddenly?).

notadamking commented 5 years ago

Hi @ktattan, great suggestion. Perhaps the library should allow a prediction model to be passed in, so the user can decide at runtime whether they'd like to use SARIMAX, LSTM, or some other prediction model (i.e. FB Prophet).

As for whether or not an LSTM will out-perform our SARIMAX predictions, I am unsure. I've recently read an article showing that SARIMA-based predictions out-perform LSTMs on shorter time-frame predictions, though this may be circumstantial.

https://towardsdatascience.com/arima-sarima-vs-lstm-with-ensemble-learning-insights-for-time-series-data-509a5d87f20a

Edit: As a side note, I originally used FB Prophet as the prediction engine for this library, rather than SARIMAX, though Prophet took much too long to train, so I eventually switched over. That being said, the Prophet library was more accurate at predicting future confidence intervals than SARIMAX, and provides more features to learn from. So given enough time, it might be better off to train a model using FB Prophet rather than at LSTM or SARIMAX, as we are currently using.

Rish001 commented 3 years ago

Hey! Can I work on this?