It’s great to be coding again. I really enjoy it. Not so much the typing as the problem solving. Using the code from DeepLizard as a base I’m now writing scripts to achieve broader aims, and that requires a significant amount of coding on my part. The DeepLizard code was created to solve the CartPole game from OpenAI Gym, and getting it to work with a fairly different environment took a bit of work. A significant difference is that in Cartpole the action of the agent affects the state of the environment (move cart left or right) but in the trading situation it doesn’t, there is an historic succession of prices which is completely determined (by history). However the actions do affect the reward, which is the most important part. Buy, Hold, and Sell are what trading is all about. Perhaps if you’re a whale your trades would affect the prices, but not for me. I think I qualify as a shrimp in the BTC ecosystem.
What I’m trying to do is pretty basic, but until I’ve actually done it successfully it’s not so basic for me. I have the main application to train a DDQN on my ADA price data. Now I need to validate that the model is good, and optimize it as far as possible, and then to use it in backtesting a trading strategy. This requires saving the trained model from the training script, and loading it into the validation script and ensuring that it works with the correct data (train and test sets) and checks for overfitting. This is achieved by making predictions on the training set, and also on the test set, and ensuring that the success rate is not very different. If the training set significantly outperforms the test set then the model is too customised for specific details of the training set and does not generalize to other data well enough. A big problem with machine learning models.
In the training I had to run through the training data several times because there just wasn’t enough data to get converging results. No wonder the Quantra people were using 5 minute data for the SPY! How many 5 minute periods are there in 10 years of data? My 7 years of daily data for ADA/USD is proving problematic. I’m thinking of going to 6 hourly data, which will give me 4 times as much. I’m not thinking of trading bots here, and if I was to actually trade manually using this model for signals then checking prices a few times a day is actually realistic, but not every 5 minutes. Anyway, back to work!