ScottfreeLLC / AlphaPy

Python AutoML for Trading Systems and Sports Betting
Apache License 2.0
1.1k stars 201 forks source link

Trading System phigh/plow etc #37

Open sykesdev opened 4 years ago

sykesdev commented 4 years ago

Hi,

Looking into the Trading System in a bit more detail, unless I'm missing something I don't think this can really work as it is at present.

Using the phigh/plow feature you run into the problem that predictions are loaded from the training run which are a consolidated list of predictions for the entire group. The system then tries to join these predictions with the price data for a single stock symbol which leads to a mismatch.

It seems that it would be better if the Trading System made its own predictions using a pre-trained model for each of the stock symbols that it iterates through. I can't see any obvious way to join the predictions back with the stock symbols, running a separate prediction would avoid this problem and mean that the Trading System could be run on new test data without running the whole training cycle.

I'm thinking of looking into this, but before I leap in, it would be good to know what the consensus is on this...?

ConsultingSecurty commented 4 years ago

is any update on this?

mrconway commented 3 years ago

Yes, you are correct that the model trains on a group of stocks, according to the list of stocks in your market.yml file. This trained model does not apply to just a single stock, but the entire group as well when making predictions. If you just need to train for a single instrument, then you would just have a single stock in the market configuration file. For example, I do this with cryptocurrency data where BTC is the only symbol, thus the probabilities apply only to BTC.

But I do see your point. Currently, if you have a group for training, then we do not train individually on each component and then apply each independent model for prediction. This is an extremely important point for aggregated models in general. For example, if I develop a neural network tuner for one car, can I apply that model to another car? Probably not. But then you have to consider that stock behavior changes over time and consequently you have two options. Is it better to retrain each single-component model on a periodic basis, or do you have a general-purpose model that holds up historically across instruments? I don't know if many people have the answers for this.

Thank you for your thoughts, and further discussion is welcome!