返回排行榜

yasinkuyu/binance-trader

Python

💰 Cryptocurrency Trading Bot for Binance (Experimental)

bitcoinbinancecryptocurrencytradebtcarbitrage
Star 增长趋势
Star
2.7k
Forks
829
周增长
Issues
0
1k2k
2017年10月2020年9月2023年8月2026年7月
制品库PyPIpip install binance-trader
README

Binance Trader (v1.1.0)

This is an experimental bot for auto trading the binance.com exchange. @yasinkuyu

Screenshot

Changelog

v1.1.0 (2026-01-01)

  • 🐛 Fixed: Bot not selling after buy order filled (#66, #134, #166)
  • 🐛 Fixed: KeyError when API returns error (#139, #154)
  • 🐛 Fixed: LOT_SIZE filter precision issues (#159)
  • 🐛 Fixed: Partially filled orders now correctly calculate sell quantity (#133, #178, #200)
  • 🐛 Fixed: NameError for undefined sell_price variable (#172)
  • 🔒 Improved: Thread safety with proper locking mechanism
  • ⚡ Improved: Better exception handling throughout the codebase

Configuration

  1. Signup for Binance

  2. Enable Two-factor Authentication

  3. Go API Center, Create New Api Key

     [✓] Read Info [✓] Enable Trading [X] Enable Withdrawals
    
  4. Rename config.sample.py to config.py / orders.sample.db to orders.db

  5. Get an API and Secret Key, insert into config.py

     API key for account access
     api_key = ''
     Secret key for account access
     api_secret = ''
    
     [API Docs](https://www.binance.com/restapipub.html)
    
  6. Optional: Modify recv_window value (not recommended)

  7. Optional: run as an excutable application in Docker containers

Support

https://www.binance.com/?ref=10701111

Requirements

sudo pip install requests

Python 3
    import os
    import sys
    import time
    import config
    import argparse
    import threading
    import sqlite3

Usage (trading module)

python trader.py --symbol XVGBTC

Example parameters

# Profit mode (default)
python trader.py --symbol XVGBTC --quantity 300 --profit 1.3
or by amount
python trader.py --symbol XVGBTC --amount 0.0022 --profit 3

# Range mode
python trader.py --symbol XVGBTC --mode range --quantity 300 --buyprice 0.00000780 --sellprice 0.00000790
or by amount
python trader.py --symbol XVGBTC --mode range --amount 0.0022 --buyprice 0.00000780 --sellprice 0.00000790

--quantity     Buy/Sell Quantity (default 0) (If zero, auto calc)
--amount       Buy/Sell BTC Amount (default 0)
--symbol       Market Symbol (default XVGBTC or XVGETH)
--profit       Target Profit Percentage (default 1.3)
--stop_loss    Decrease sell price at loss Percentage (default 0)
--orderid      Target Order Id (default 0)
--wait_time    Wait Time (seconds) (default 0.7)
--increasing   Buy Price Increasing  +(default 0.00000001)
--decreasing   Sell Price Decreasing -(default 0.00000001)
--prints       Scanning Profit Screen Print (default True)
--loop         Loop (default 0 unlimited)

--mode         Working modes profit or range (default profit)
               profit: Profit Hunter. Find defined profit, buy and sell. (Ex: 1.3% profit)
               range: Between target two price, buy and sell. (Ex: <= 0.00000780 buy - >= 0.00000790 sell )

--buyprice     Buy price (Ex: 0.00000780)
--sellprice    Buy price (Ex: 0.00000790)

Symbol structure;
    XXXBTC  (Bitcoin)
    XXXETH  (Ethereum)
    XXXBNB  (Binance Coin)
    XXXUSDT (Tether)

All binance symbols are supported.

Every coin can be different in --profit and --quantity.
If quantity is empty --quantity is automatically calculated to the minimum qty.

Variations;
    trader.py --symbol TBNBTC --quantity 50 --profit 3
    trader.py --symbol NEOBTC --amount 0.1 --profit 1.1
    trader.py --symbol ETHUSDT --quantity 0.3 --profit 1.5
    ...

Usage (balances module)

python balance.py

Run in a Docker container

docker build -t trader .

docker run trader

DISCLAIMER

I am not responsible for anything done with this bot.
You use it at your own risk.
There are no warranties or guarantees expressed or implied.
You assume all responsibility and liability.

Contributing

Fork this Repo
Commit your changes (git commit -m 'Add some feature')
Push to the changes (git push)
Create a new Pull Request

Thanks all for your contributions...

Contributors
    @WeSpeakCrypto
    @afoke
    @omerfarukz
    @plgonzalezrx8

Troubleshooting

Filter failure: MIN_NOTIONAL
https://support.binance.com/hc/en-us/articles/115000594711-Trading-Rule

Filter failure: PRICE_FILTER
https://github.com/binance-exchange/binance-official-api-docs/blob/master/rest-api.md

Timestamp for this request was 1000ms ahead of the server's time.
https://github.com/yasinkuyu/binance-trader/issues/63#issuecomment-355857901

Roadmap

- MACD indicator (buy/sell)
- Stop-Loss implementation
- Working modes
  - profit: Find defined profit, buy and sell. (Ex: 1.3% profit)
  - range:  Between target two price, buy and sell. (Ex: <= 0.00100 buy - >= 0.00150 sell )
- Binance/Bittrex/HitBTC Arbitrage  

...

- October 7, 2017 Beta
- January 6, 2018 RC
- January 15, 2018 RC 1
- January 20, 2018 RC 2

License

Code released under the MIT License.


相关仓库
bitcoin/bitcoin

Bitcoin Core integration/staging tree

C++MIT Licensebitcoinc-plus-plus
bitcoincore.org/en/download
89.7k39.1k
freqtrade/freqtrade

Free, open source crypto trading bot

PythonPyPIGNU General Public License v3.0pythoncryptocurrencies
freqtrade.io
52.5k10.9k
ccxt/ccxt

A unified trading API with more than 100 crypto exchanges and prediction markets in JavaScript / TypeScript / Python / C# / PHP / Go / Java

PythonPyPIMIT Licensealtcoinapi
docs.ccxt.com
43.4k8.7k
bitcoinbook/bitcoinbook

Mastering Bitcoin 3rd Edition - Programming the Open Blockchain

HTMLOtherbitcoinbitcoin-api
aantonop.com/books
25.3k6.2k
hummingbot/hummingbot

Open source software that helps you create and deploy high-frequency crypto trading bots

PythonPyPIApache License 2.0cryptocurrencyarbitrage
hummingbot.org
19.2k4.8k
HelloZeroNet/ZeroNet

ZeroNet - Decentralized websites using Bitcoin crypto and BitTorrent network

JavaScriptnpmOtherbittorrentp2p
zeronet.io
18.8k2.3k
UFund-Me/Qbot

[🔥updating ...] AI 自动量化交易机器人(完全本地部署) AI-powered Quantitative Investment Research Platform. 📃 online docs: https://ufund-me.github.io/Qbot ✨ :news: qbot-mini: https://github.com/Charmve/iQuant

Jupyter NotebookMIT Licensefundsmachine-learning
github.com/Charmve
18.1k2.6k
bbfamily/abu

阿布量化交易系统(股票,期权,期货,比特币,机器学习) 基于python的开源量化交易,量化投资架构

PythonPyPIGNU General Public License v3.0quanttrade
abuquant.com
17.9k4.6k
solana-labs/solana

Web-Scale Blockchain for fast, secure, scalable, decentralized apps and marketplaces.

Rustcrates.ioApache License 2.0ledgerblockchain
solanalabs.com
14.9k5.8k
NoFxAiOS/nofx

Your AI trading terminal assistant for US stocks, commodities, forex, and crypto.

GoGo ModulesGNU Affero General Public License v3.0ai-tradingagentictrading
vergex.trade
12.6k3k
getumbrel/umbrel

An elegant home server OS. Run OpenClaw, store your files and photos, run a Bitcoin node, and do more with over 300 apps in the Umbrel App Store.

TypeScriptnpmOtherbitcoinlightning
umbrel.com
11.6k773
askmike/gekko

A bitcoin trading bot written in node - https://gekko.wizb.it/

JavaScriptnpmMIT Licensegekkotrading-bot
10.2k3.8k