Introducing a sophisticated multi-currency arbitrage bot engineered for executing complex arbitrage operations across multiple currency pairs. The system implements trading chains consisting of 4-5 pairs, following the pattern: USDT β BTC β SOL β (XPR optional) β USDT, where both the initial and final token remain USDT to safeguard portfolio stability during operation.
I'm sharing this project because its profitability fell short of expectations during release testing. The bot is designed to maximize profit while minimizing risks, targeting a profit threshold of 2.5% per arbitrage opportunity.
I'm now pivoting to develop a more advanced project focused on automated trading in spot and futures markets using machine learning and neural networks.
- Processes trading chains of 4-5 pairs
- Core workflow: USDT β BTC β SOL β (XPR) β USDT*
- *XPR inclusion optional for 5-link chains
- USDT anchors both ends of each chain for portfolio protection
- Core logic housed in
brain_bot.rs - Foundational configurations in
config.rs - Chain construction via recursive DFS algorithm
- Asynchronous parallel processing of all chains
- Non-blocking data access implementation
- Stack overflow protection mechanisms
- Linux distribution
- Docker
- Git
-
Create
.envfile in the project directory. Add necessary configurations from the.env_example.txtfile. -
Clone the repository:
git clone [repository-url]- Configure permissions and execute script:
cd binance_cex && chmod +x key.sh && ./key.sh- Build and launch Docker container:
sudo docker build -t binance . && sudo docker run -it -d --name binance_cont --restart unless-stopped binancesudo docker exec -it binance_cont shAvailable commands inside container:
ps aux # View running processes
tail -f /var/log/app.log # View application logs
df -h # Check available disk spacesudo docker logs binance_contFor real-time log monitoring:
sudo docker logs -f binance_contsudo docker attach binance_contExit container without stopping using: Ctrl+P, Ctrl+Q
Follow these steps to conduct testing:
Install the Cargo package manager with:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shNote: Cargo installs from the official Rust website. Follow terminal instructions.
Move to the project's root directory.
Run with debug output enabled:
RUST_LOG=debug cargo run --release- CPU: 4+ cores
- RAM: 8+ GB
- SSD: 150 GB
- OS: Linux
- Processing capacity: ~30,000 chains in 250 ms
- WebSocket message handling: 2-8 Β΅s (average 4-5 Β΅s)
- Orderbook processing: 317 ns - 10.914 Β΅s (average 1 Β΅s)
- WebSocket response time: up to 300 ms (as low as 5 ms in Japan region)
- Hourly operational status via Telegram (disabled in
math_graph.rs, available in logs) - Critical notifications through Telegram
- Transaction logging, profitable chain tracking, and "lifetime" recording to debug files
- Chain selection and transaction result notifications via Telegram
- Automatic restart on internet connection issues
- Critical halts on anomalous errors
- Multi-component chain accounting logic
- Profitability recalculation at each step
- Nanosecond-level orderbook data acquisition without delays
- Dual-layer chain validation
- Alternative chain selection for:
- Profit maximization
- Loss minimization
- Comprehensive tracking of all profitable chains with optimal selection
- Market slippage accounting
- Analysis of "false" market maker volumes
- Prefer Japan region (Azure Cloud) for optimal performance
- Conduct thorough testing before release deployment
- Use VPN for connection issue mitigation
- Supported regions: Asia, Europe, America
To disable Telegram signal functionality, comment out these lines in main.rs:
mod telegram;
use crate::telegram::TelegramBot;
// TelegramBot initialization
let telegram_bot = Arc::new(TelegramBot::new(
&std::env::var("TELEGRAM_TOKEN").expect("TELEGRAM_TOKEN missing"),
std::env::var("CHAT_ID").expect("CHAT_ID missing").parse::<i64>().expect("Invalid CHAT_ID format"),
Arc::clone(&error_status),
bot_action_sender.clone(),
));
// TelegramBot execution
let telegram_bot_clone = Arc::clone(&telegram_bot);
tokio::spawn(async move {
telegram_bot_clone.run().await;
});