Crypto Futures-Spot Arbitrage Trading Bot
Capitalizing on large disparities in futures and spot prices of crypto tokens trading on ByBit
Problem Statement
It is reasonable to expect that large disparities in perpetual futures price and spot price are unsustainable. Oftentimes, these disparities arise in illiquid crypto markets and thus presents an opportunity for market makers and arbitragers. A proprietary trader based on Hong Kong wanted to build a trading bot that would track hundreds of tokens trading on ByBit and capture such opportunities as soon as they arise.
Challenges
- Since speed of execution is of utmost importance in arbitrage strategies, the latency of the trading system had to be as low as possible
- Managing the price data of hundreds of tokens and their perp futures and tracking of high frequency orders in real-time
Solution
Summary
I developed python modules to execute the strategy. The modules used websockets to retrieve price and orders data, stored the data in cache, and used an event driven approach to execute the strategy. The deliverable included a desktop application built using tkinter to manage strategy parameters and track the operations of the bot.
Key Features
- Desktop application designed to run on a double-click
- GUI for adding, update, delete, activate and deactivate trading routes
- Extensive backend configuration to update tradable token list, exchange fees and strategy parameters
- Modular code designed to be repurposed for other strategies
- Easy tracking of bot operations through console logs
- Fail-safes and error management built into the code to ensure uninterrupted operations

Desktop Interface to Control Bot Operations

Modular Code Design
Results & Impact
Latency in Order Placement
Have a similar challenge?
Let's discuss how we can develop solutions for your specific use case.