Skip to content

RayXu14/binance-stablecoin-arbitrage

Repository files navigation

Binance Stablecoin Arbitrage

A Python-based trading bot for stablecoin arbitrage on Binance.

Low profit but very low risk as long as stablecoins are stable.

Welcome to share your profit using this bot in discussions.

Q: Why not directly use Binance Spot Grid tool?

A:

  1. You may be reminded something like "Price difference is too small. Max number of grids to run this strategy is 0" when using Grid Strategy tool, while this trading bot does not have such limitation.
  2. This Trading bot supports compound interest.

Prerequisites

  • Python 3.12 or higher
  • Binance API Key and Secret with spot trading enabled
  • Stable network connection, otherwise you will be very very very painful

Memory Requirement

Take Ubuntu 24.04 AMD64 server for example:

Number of Instances Minimum Memory Required
1-7 500MB
8+ 1GB+

If the memory is not enough, you will get

binance.error.ClientError: (400, -1021, 'Timestamp for this request is outside of the recvWindow.'....

Installation

  1. Clone the repository:
git clone https://github.com/RayXu14/binance-stablecoin-arbitrage.git
cd binance-stablecoin-arbitrage
  1. Install dependencies:
pip install -r requirements.txt
  1. Create a binance_api_ks.py file with your API credentials:
key = "your_api_key"
secret = "your_api_secret"

Configuration

The bot can be configured using command-line arguments. See available options in config.py.

Example Usage

python main.py --base_asset USDC --initial_quote 1000 --buy_price 0.9999

After runing for a period of time, you already have some records, you can analyze the results by running:

python analyze_records.py

Logging

  • Program logs are automatically saved in the logs directory with timestamps for debugging.
  • Asset changing records are saved in records.csv.

Security Notes

  • Never commit your API credentials to version control
  • We assume the commission fee rate is 0.00%. This is TRUE for Binance spot trading pairs among USDT, USDC & FDUSD, but if not, you should be aware of it. You should be responsible for your own investment.
  • Generally, if you do not put much much money (orders will not be partially filled frequently) in one bot, it requests Binance API 1 times per second when not placing a new order and 2 times in a second when placing a new order, much less than the hard limit of Binance API (although there are also some other ambiguous limits like ML limits).

Disclaimer

This bot is for educational purposes only. Use at your own risk. The authors are not responsible for any financial losses incurred while using this software.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors