This project involves the development of a high-frequency trading bot capable of processing thousands of orders per second, aimed at revolutionizing the trade markets. The bot will use advanced algorithms to adapt to market changes dynamically, minimize overfitting, and maximize profits. This project also serves as a practical introduction to algorithmic trading concepts and techniques.
- Create a trading bot that operates in a simulated trading environment.
- Develop algorithms to optimize trading performance and profitability.
- Justify the bot’s performance with thorough analysis and insights.
- Compete against other bots using datasets provided during evaluation.
- Dynamic Market Adaptation:
- Real-time response to market changes.
- Avoids overfitting to training datasets.
- Strict Decision Grammar:
- Implements a defined order syntax for trades.
- Ensures all orders are valid and executable.
- Training and Evaluation:
- Utilizes training datasets and a generator for simulation.
- Competes with other bots in a fair evaluation environment.
- Performance Metrics:
- Tracks profitability and consistency.
- Adjusts strategies based on evaluation feedback.
The trading bot employs multiple technical indicators to generate buy and sell signals. The strategy is designed to leverage short-term market trends for profitability.
- EMA50: 50-period Exponential Moving Average to identify momentum.
- Price Predictions: Predictive modeling of future prices based on historical data.
- Directional Indicators (DI+ and DI-): Measures the strength and direction of the market trend.
- Bollinger Bands: Calculates upper and lower price bands to determine volatility.
- Price is above the lower Bollinger Band.
- DI+ is greater than DI- (indicating an upward trend).
- Predicted price is higher than the current price.
- EMAs indicate upward momentum.
- OR: When the sell stack is zero (forced buy condition).
- Price is below the upper Bollinger Band.
- Predicted price is lower than the current price.
- DI+ is less than DI- (indicating a downward trend).
- EMAs indicate downward momentum.
- Programming language of your choice (ensure compatibility with provided client-server interface).
- Access to training datasets and the generator provided.
- A reverse-engineering setup for analyzing server logs.
Let’s play around with a trading environment.
You are to craft a simple client bot, that:
- parse given information,
- make a simple forecast
- issue a sell/buy order accordingly.
The program ai-bot-workspace is the tool used for testing and evaluating this project. Here’s a short guide to get you started.
Download it from the Github source OR along with this subject.
- If you’re on Linux, you should use ai-bot-workspace-2.4.3-x86_64.AppImage
- If you’re on Windows, you sould use ai-bot-workspace-setup-2.4.3.exe
The executables launch ai-bot-workspace’s portal. There, you must select Crypto Trader
Before the first launch, you have to configure some settings:
- the command to run your executable (interpreter + path)
- the path to a .csv file with candlestick chart data
- the amount of time in seconds between each candle Below are 2 screenshots showing how it should be configured once you’re done here:
Warning
You are encouraged to play with all the values to test the adaptability of your bot. The default dataset within the ai-bot-workspace contain 30-minutes candles for multiple pairs.
Note
All provided datasets, as the ones used for evaluation, only contain 60-minutes candles for USDT_BTC trading pair. The 3 last settings will be kept as default (1000 USDT, ~337 given candles before start, 0.2% transaction fee)
Now, your bot should be able to hold firm and never crash.. . but may lose a bunch of money overall
The first thing you want to check is probably your final result on the top right corner of the chart. ot 1 stderr window will warn you in case something is going wrong. You should use this specific output to debug your bot or check what it’s doing.
The other windows, Engine stdout and Bot 1 log, will roughly provide you the same details.
Congratulations! Your environment is now fully set up.
- Clone the repository:
git clone <repository_url> cd trade-bot
- Setup the client-server interface:
- Download the client-server bootstrap files.
- Configure the location of your bot and command-line instructions.
- Start the client-server interface.
- Point the server to your bot’s executable.
- Observe and analyze performance metrics generated by the interface.
- Data Input:
- The server provides general game settings and initial training data.
- Live updates include market rates and account balances.
- Decision Logic:
- The bot processes input data and makes trade decisions within seconds.
- Implements the grammar:
pass
orbuy/sell <currency_pair> <amount>
.
- Order Execution:
- Validates trades to ensure they adhere to rules and account constraints.
- Balancing trade speed with decision accuracy.
- Preventing overfitting to training datasets.
- Adapting to unseen evaluation datasets.
- While scientific libraries (e.g., TensorFlow, SciPy, Pandas, Numpy) are not available, custom tools can be built.
- Recommended: Python for algorithm implementation and analysis.
Transaction fee
- by default, the bot pays a 0.2% transaction fee for each order it places Timebank :
- allow some additional thinking time when needed
- start the game with 10 secs
- each time an action is requested, the timebank is increased (100-500ms)
- the time needed by the bot to request is deducted from the timebank
- if the bot is too slow, the timebank will be exhausted
no_moves OR pass
- you bot don’t take any position buy CurrencyPaidWith_CurrencyReceived amount
- amount is an integer which specifies how much to buy of the CurrencyReceived (2nd symbol)
- buy USDT_BTC 1 means the bot wants to buy 1 BTC in USDT
- the cost of the operation would be 1 * [current USDT_BTC closing price]
- when buying 1 BTC, the bot will actually receive 0.998 BTC sell CurrencyReceived_CurrencySold amount
- amount is an integer which specifies how much to sell of the CurrencySold (2nd symbol)
- sell USDT_BTC 1 means the bot wants to sell 1 BTC in USDT
- the bot will received 1 * [current USDT_BTC closing price] - [fee]
- when selling some currency for 1 USDT, the bot will actually receive 0.998 USD
- Settings:
settings <variable> <value>
- Market Rates:
update game next_candles <rate>;<rate>;<rate>
- Account Balances:
update game stacks <currency>:<amount>,<currency>:<amount>
- Pass Command:
pass
- Trade Command:
buy <currency_pair> <amount> sell <currency_pair> <amount>
- Profitability: Total net gains across trading sessions.
- Adaptability: Performance on evaluation datasets.
- Overfitting deterministic algorithms.
- Invalid trades leading to program collapse.