Skip to content

Panda404NotFound/binance_arbitrage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

BINANCE MULTI-CURRENCY ARBITRAGE BOT

[ SYSTEM OVERVIEW ]

πŸ”₯ PROJECT DESCRIPTION

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.

⚑ OPERATIONAL PRINCIPLES

  • 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

πŸ”₯ TECHNICAL ARCHITECTURE

  • 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

πŸ”₯ DEPLOYMENT INSTRUCTIONS

⚑ PREREQUISITES

  • Linux distribution
  • Docker
  • Git

⚑ INSTALLATION STEPS

  1. Create .env file in the project directory. Add necessary configurations from the .env_example.txt file.

  2. Clone the repository:

git clone [repository-url]
  1. Configure permissions and execute script:
cd binance_cex && chmod +x key.sh && ./key.sh
  1. Build and launch Docker container:
sudo docker build -t binance . && sudo docker run -it -d --name binance_cont --restart unless-stopped binance

πŸ”₯ CONTAINER MANAGEMENT

⚑ ACCESS CONTAINER SHELL:

sudo docker exec -it binance_cont sh

Available commands inside container:

ps aux  # View running processes
tail -f /var/log/app.log  # View application logs
df -h  # Check available disk space

⚑ VIEW CONTAINER LOGS:

sudo docker logs binance_cont

For real-time log monitoring:

sudo docker logs -f binance_cont

⚑ ATTACH TO CONTAINER:

sudo docker attach binance_cont

Exit container without stopping using: Ctrl+P, Ctrl+Q

πŸ”₯ TESTING PROCEDURES

Follow these steps to conduct testing:

⚑ INSTALL CARGO

Install the Cargo package manager with:

curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Note: Cargo installs from the official Rust website. Follow terminal instructions.

⚑ NAVIGATE TO PROJECT DIRECTORY

Move to the project's root directory.

⚑ EXECUTE TEST RUN

Run with debug output enabled:

RUST_LOG=debug cargo run --release

πŸ”₯ SYSTEM REQUIREMENTS

  • CPU: 4+ cores
  • RAM: 8+ GB
  • SSD: 150 GB
  • OS: Linux

πŸ”₯ PERFORMANCE METRICS

  • 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)

πŸ”₯ BOT CAPABILITIES

⚑ MONITORING & ALERTS

  • 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

⚑ FAULT TOLERANCE

  • Automatic restart on internet connection issues
  • Critical halts on anomalous errors
  • Multi-component chain accounting logic
  • Profitability recalculation at each step

⚑ TRADE OPTIMIZATION

  • 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

⚑ RISK MANAGEMENT

  • Market slippage accounting
  • Analysis of "false" market maker volumes

πŸ”₯ RECOMMENDATIONS

  • 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

πŸ”₯ DISABLING TELEGRAM NOTIFICATIONS

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;
});

πŸ”₯ CONTACT

GitHub Telegram Email

About

Multi-currency arbitrage bot on BINANCE cryptocurrency exchange

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages