Arbitrage (not considering our own positions):
A and B are the individual stocks, C is the basket.
if (Ask A + Ask B < Bid 2C) , then we Buy A; Buy B; and Sell 2C. if (Bid A + Bid B > Ask 2C), we Sell A; Sell B; and Buy 2C. All orders for the arbitrage case are IOCs.
This in some cases leads to unwanted positions where others execute trades before us and we could not fill part of our positions. As our position is unbalanced in these cases, we must ensure that the position becomes risk-neutral: Optimize: A + B = - 2C.
In case our position is unbalanced by being too long on A, we have two options: a) Sell A b) Buy B; Sell 2C
We check the cost of executing both options and find a hedge with value >= 0.
We also have a forced hedge to prevent rebalance in case we break the 50 Limit nearing 3 seconds. For this forced hedge we exit the positions even when it brings negative value.
Also, there are restrictions in place to prevent our position from breaching the 500 limit as well as our trading from breaching the 25 updates / second limit.
Log in or sign up for Devpost to join the conversation.