Onepagecode

Onepagecode

Algorithmic trading with Keras

We use a Long Short Time Memory recurrent neural network to develop a good trading strategy for the S&P 500 index.

Onepagecode's avatar
Onepagecode
May 01, 2023
∙ Paid

we want our model to tell us whether we should stay in the market for the current month or not.

The LSTM-trading-strategy is proven to be far superior to the buy-and-hold strategy (staying always in the market) and the moving average strategy (buying when the price is greater than or equal to the moving average of the last 12 months and selling otherwise) over a period of 4 years, which encompasses the 2008 crisis.

Considering the 2008 crisis, our model produced roughly a 10% net annual yield (since the Italian law taxes capital gains at 26% and charges the broker 0.10%).

Let’s start Coding!!!

User's avatar

Continue reading this post for free, courtesy of Onepagecode.

Or purchase a paid subscription.
© 2026 Onepagecode · Privacy ∙ Terms ∙ Collection notice
Start your SubstackGet the app
Substack is the home for great culture