Submission for Optiver Challenge!

Inspiration

The inspiration for the trading strategy came from researching market neutral trading strategies online, as well as testing various approaches in Optibook.

What it does

The algorithm that works by looking at the order books of the basket stock and its corresponding stocks.

If the highest bid in the basket stock is higher than the sum of the lowest asks in the corresponding stock, the basket stock is overvalued. In this situation we sell as much of the basket stock as possible, and buy as much of the corresponding stocks as possible.

If the the sum of the highest bids in the corresponding stocks is higher than the lowest ask in the basket stock, the basket stock is undervalued. In this situation we sell as much of the corresponding stock as possible and buy as much of the basket stock as possible.

For clarity, "corresponding stock" refers to the 'GOOGLE' and 'AMAZON' instruments.

We switch which situation to check for first, based on the current position in the basket stock because this reaches the limit on positions fastest.

By only using Immediate or Cancel Orders, we do not need to worry about the outstanding order per instrument limit.

How I built it

The algorithm was built in Python using the optibook package, such that it could be employed in the optibook environment. However, the actual strategy can be easily be fitted to any exchange API.

Challenges I ran into

A large issue for the trading algorithm was that the positions in the basket stock would quickly reach the limit for the number of positions per instrument. This was solved by creating a 'position interval' variable that was used to check if the basket stock position was nearing the limit. If the position is nearing a limit, the strategy will switch the order for which it looks for opportunities. For example, if the basket position is -300, the strategy will look if the basket stock is undervalued first, so that it can increase its positions.

Accomplishments that I am proud of

  • This was my first ever trading algorithm, so I am really proud of being able to make it work.

  • I am proud of how I approached the algorithm design from a really modular approach. I think it makes the code look very clean, as well as making the trading strategy easy to understand.

  • I am proud of my documentation. Given the time limit of a hackathon, you are pressured to do things very rushed, however, I made sure to make it clear what each piece of code is doing.

What I learned

Algorithmic trading is really fun! I found the whole process very exciting and I want to learn more advanced market-making strategies.

What's next for Money Machine

I think that a more advanced approach could be implemented with more time. For example, I would be interested in looking how I can streamline the code to minimize time wasted on processing and maximising trading involved.

Built With

Share this project:

Updates