This entry is for the Optiver challenge. The code is available not on GitHub but on Cloud9.
Inspiration
Everyone in our team were extremely inexperienced with finance, stocks, and trading algorithms. However, out of interest we tried attending the Optiver Workshop and it turned out to be extremely intriguing! Our entry is based on the knowledge of finance that we have gained from Optiver employees during the Hackathon.
What it does
Our algorithm attempts to generate profit based on the two stocks GOOGLE and AMAZON and from the fund basket TECH_BASKET, based on their varying liquidities. We buy cheap and sell high, sometimes incurring purposeful losses to reduce risk.
How we built it & Challenges we found
We understood the main way to gain profits in this challenge was to hedge for a positive profit. Upon starting, we had two ideas we wanted to test out and compare. Our goal was to find which one generates the most reliable profit, and to use that in the final 4 hours of the challenge.
The two algorithms are:
Position-prioritiser (hedge-unhedge -- pos_prioritiser_main.py & pos_prioritiser_utilities.py)
- Make a certain amount of hedge profits, incurring some position changes
- Gradually revert the position back to 0 by incurring losses within 20% of the profits made
Profit-prioritiser (hedge-always -- main_beautified.py & utilities_beautified.py)
- Always keep looking for hedge profits, disallowing trading in certain directions when a cap is reached
We found that the position-prioritiser is very good at keeping its position in the market at 0 - this means it is not vulnerable to any market fluctuations. We were also able to generate some minimal but consistent profit from it as well, especially thanks to our algorithm only executing the deal if the expected profit is positive. However, we found that we sometimes the order book changed mid-computation, resulting in us executing unfavourable deals -- sometimes incurring losses up to 2,000. This was unfeasible.
Profit-prioritiser is a drastically different approach that takes no risks in terms of losses (since it always looks only for profits with no compromises). While this sounds like it would incur more profits than position-prioritiser, it usually takes quite a while to find a profit in the opposite direction after reaching a cap. Therefore, we were regularly stuck at a 500 or -500 position, making us highly vulnerable to market fluctuations.
Both algorithms are not perfect, and during the limited amount of time we had, we were not able to closely examine which one performed better in the long-term. However, they both perform well enough to generate stable profit when the market is in a favourable position. We have included both algorithms in the Cloud9 environment to showcase our efforts.
Accomplishments that we're proud of
This being the first time any of our teammates touched financial algorithms, we are proud to have come up and implemented two distinct methods to gain profits, each with their advantages and disadvantages. Although it wasn't able to gain the maximum profits during the 4 hours on Sunday, we're extremely happy with our algorithms, and our proud to present it as our entry.
What we learned
Financial algorithms are difficult to make -- it relies heavily on market expectations, and volatility always hits hard. There are many checks that need to be taken in place to prevent bad orders (such as ordering thousands of buys at high prices), and implementing each one takes high attention to detail and logical thinking. We also learnt that careful planning and time management can be of great value, since we ran out of time to properly test both our algorithms and choose one to use as a final entry.
Video coming soon.
Built With
- cloud9
- optibook
- optiver
- python
Log in or sign up for Devpost to join the conversation.