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:
- 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.
- This Trading bot supports compound interest.
- 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
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.'....
- Clone the repository:
git clone https://github.com/RayXu14/binance-stablecoin-arbitrage.git
cd binance-stablecoin-arbitrage- Install dependencies:
pip install -r requirements.txt- Create a
binance_api_ks.pyfile with your API credentials:
key = "your_api_key"
secret = "your_api_secret"The bot can be configured using command-line arguments. See available options in config.py.
python main.py --base_asset USDC --initial_quote 1000 --buy_price 0.9999After runing for a period of time, you already have some records, you can analyze the results by running:
python analyze_records.py- Program logs are automatically saved in the
logsdirectory with timestamps for debugging. - Asset changing records are saved in
records.csv.
- 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).
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.