Plot of the historic evolution of the analysed stock markets (SP and ESX)
Time series analysis is one of the main research focus for market prediction.
"Es el mercado, amigo" -"It's the market, my friend"
We were inspired by the awesome stock market interactive simulation built by Optiverse, and especially motivated by the possibility to compete with other teams and prove the best in the art of trading.
What it does
We built a bot that monitors the short-term evolution of the market, and using simple rules, performs buy-sell operations seeking short-term profit, while accepting some risk:
Every 10s we look at the last 10s of data and decide to buy or to sell stock,
- We buy when the price is falling
- We sell when the price is rising
- We buy/sell a default amount of 150 shares
- If the price is rising we should wait to sell, we sell half of the shares on that turn and add the other half to the default amount of next turn
- If the price stabilizes we sell all the shares we have obtained
- We do the analog process when buying shares, saving a portion of shares for the next turn until the market stabilizes
How we built it
The bot is built in Python, with sockets and Pandas. Also, a visualization of the market evolution built with Dash for Python gives more know-how to the user about what is happening live.
Challenges we ran into
Trying to find trends with time series analysis was almost a head-ache, as we found that volatility was predominant and attempts to build predictive models failed one after the other. Also, learning how to code Dash, as it was a new language for all of the team members.
Accomplishments that we're proud of
We are proud of having defined some basic rules that prove useful when trading in the stock market and engaging in short-term operations. We are also very happy of having learnt how to use Dash to make fantastic new visualizations that we did not know how to make before.
What we learned
We have learned that predicting the movements of the stock exchange markets is an incredibly complex task.
Most of the time, there is nothing different between the stock market evolution and a random walk. Thus, time series prediction (using ARIMA, Holt-Winters exponential smoothing, Markov chains) is most of the time useless.
In general, we have discovered that it is best to work with basic rules for short-term buy-sell operations seeking immediate profit, bearing in mind the risk that this may have.
What's next for It's the market, my friend
We should probably refine and redefine buy-sell rules testing them against bigger market simulations datasets, or during longer real-time simulations. We think there is still a lot of margin for improvement by just adjusting these rules, although we are happy of what we have accomplished in 24h.