Overview for the Python-based trading bot that secured a second-place finish in the Jane Street FTTP Electronic Trading Challenge (ETC). The bot participated in the challenge and successfully executed the below mentioned trading strategies against other competitors' bots on the provided exchange platform.
The bot's implementation is provided in a Python script called bot.py
. Below are some key components and strategies employed by the bot:
Before running the bot, some initial configuration is required. The team name is set at the beginning of the script using the team_name
variable. Additionally, the script can be run with different parameters to connect to the production exchange or one of the test exchanges.
The main trading logic of the bot is executed within the main
function. Here are the main steps performed by the bot:
-
Initialisation: The bot establishes a connection to the exchange and receives an initial "hello" message containing information about its positions.
-
Trading Strategies: The bot employs various trading strategies for different symbols traded on the exchange. For example, it calculates fair values for symbols like "VALBZ" and "VALE" based on the top bid and ask prices and decides whether to buy or sell.
-
Order Management: The bot manages its orders, including placing new orders, canceling old orders, and tracking unacknowledged orders.
-
Market Orders: The bot implements market-making strategies by sending orders slightly more aggressive than the top order on the book.
-
Position Updates: The bot updates its positions when "fill" messages are received, reflecting completed trades.
-
End of Round: The bot continues trading until a "close" message is received, indicating the end of the round.
The ExchangeConnection
class handles the connection to the exchange, sending messages, and reading responses. It also manages order IDs and timestamps to ensure compliance with exchange rate limits.
To run the bot, follow these steps:
-
Configure the
team_name
variable with your team's name. -
Execute the script using the provided instructions in the comments. You may need to change permissions and run the bot in a loop.
chmod +x bot.py
while true; do ./bot.py --test prod-like; sleep 1; done