Inspiration

We entered the Optiver market making challenge because it presents an interesting optimization problem and the direct competition with all other participants based on objective scores motivated us to try our best. ... and the prices of course! :)

What it does

We created a bot that puts in hedged orders to remove arbitrage from the market and balances out prices between ETFs and component stocks. This way spreads are reduced and the market liquidity improves.

Our market making algorithm uses two strategies: The first strategy is that we look at etf prices and the prices of the two component stocks and tries to find instant arbitrage, that occurs when: 2 * etf_ask < company1_bid + company2_bid In that case we can immediately buy 2 times the etf and sell 1 of each components. This also works in reverse of course. We even trade asks/bids which aren't currently offered at the best price as long as they are still profitable.

The second strategy we employ is quoting when there are no offers on the market for one stock. In that case we use pricing information from the corresponding etf and the other component stock to calculate at which price point we would make 0 profit from the first strategy and add some small profit margin to counter the risk exposure we take. We also execute the trade like in strategy 1.

One important consideration is that even if all orders we set are hedged, some may not get executed, so we may have unhedged positions temporarily. To alleviate that, we adjust all orders we take so that we bid or ask a bit more or less whenever we do a trade, so that our unhedged positions get rebalanced.

How we built it

We sat together and discussed what market makers are supposed to do and relevant finance concepts. We first created a barebones market making algorithm and then added more complexity over time, while looking at performance.

Our first approach looked like this: Step 1: Built trading algo in 10 lines of code, Step 2: ?, Step 3: Loss

Turns out by taking a more systematic approach one can actually turn a profit.

Challenges we ran into

There were a lot of confusions with looking for asks, setting bid orders and keeping the signs in mind and corresponding bugs, which were hard to find. It was sometimes hard to compare different approaches as other teams entered and left the ongoing competition, making the metrics rather volatile.

Accomplishments that we're proud of

Right now perseverance and finishing, in a few hours hopefully winning.

What we learned

Various market making strategies and a deeper understanding of finance in general.

What's next

One way to improve upon our approach would be to also quote to reduce spread when there are bids/asks listed and there is no immediate profit. That would effectively combine both strategies we employ right now.

Built With

Share this project:

Updates