# python-binance **Repository Path**: xiaoxinwt/python-binance ## Basic Information - **Project Name**: python-binance - **Description**: Binance API python implementation - **Primary Language**: Python - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2020-04-08 - **Last Updated**: 2022-06-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ================================ Welcome to python-binance v0.5.6 ================================ .. image:: https://img.shields.io/pypi/v/python-binance.svg :target: https://pypi.python.org/pypi/python-binance .. image:: https://img.shields.io/pypi/l/python-binance.svg :target: https://pypi.python.org/pypi/python-binance .. image:: https://img.shields.io/travis/sammchardy/python-binance.svg :target: https://travis-ci.org/sammchardy/python-binance .. image:: https://img.shields.io/coveralls/sammchardy/python-binance.svg :target: https://coveralls.io/github/sammchardy/python-binance .. image:: https://img.shields.io/pypi/wheel/python-binance.svg :target: https://pypi.python.org/pypi/python-binance .. image:: https://img.shields.io/pypi/pyversions/python-binance.svg :target: https://pypi.python.org/pypi/python-binance This is an unofficial Python wrapper for the `Binance exchange REST API v1/3 `_. I am in no way affiliated with Binance, use at your own risk. If you came here looking for the `Binance exchange `_ to purchase cryptocurrencies, then `go here `_. If you want to automate interactions with Binance stick around. Source code https://github.com/sammchardy/python-binance Documentation https://python-binance.readthedocs.io/en/latest/ Binance API Telegram https://t.me/binance_api_english Features -------- - Implementation of General, Market Data and Account endpoints. - Simple handling of authentication - No need to generate timestamps yourself, the wrapper does it for you - Response exception handling - Websocket handling with reconnection and multiplexed connections - Symbol Depth Cache - Withdraw functionality - Deposit addresses Quick Start ----------- `Register an account with Binance `_. `Generate an API Key `_ and assign relevant permissions. .. code:: bash pip install python-binance .. code:: python from binance.client import Client client = Client(api_key, api_secret) # get market depth depth = client.get_order_book(symbol='BNBBTC') # place market buy order order = client.create_order( symbol='BNBBTC', side=Client.SIDE_BUY, type=Client.ORDER_TYPE_MARKET, quantity=100) # get all symbol prices prices = client.get_all_tickers() # withdraw 100 ETH # check docs for assumptions around withdrawals from binance.exceptions import BinanceApiException, BinanceWithdrawException try: result = client.withdraw( asset='ETH', address='', amount=100) except BinanceApiException as e: print(e) except BinanceWithdrawException as e: print(e) else: print("Success") # fetch list of withdrawals withdraws = client.get_withdraw_history() # fetch list of ETH withdrawals eth_withdraws = client.get_withdraw_history('ETH) # get a deposit address address = client.get_deposit_address('BTC) # start trade websocket def process_message(msg): print("message type: {}".format(msg['e'])) print(msg) # do something from binance.websockets import BinanceSocketManager bm = BinanceSocketManager(client) bm.start_aggtrade_socket(symbol='BNBBTC') bm.start() For more `check out the documentation `_. Donate ------ If this library helped you out feel free to donate. - ETH: 0x79c9A113d63B6AC024c1AAae6f6419721C3611A3 - NEO: AVJB4ZgN7VgSUtArCt94y7ZYT6d5NDfpBo - BTC: 1Dknp6L6oRZrHDECRedihPzx2sSfmvEBys Other Exchanges --------------- If you use `Quoinex `_ or `Qryptos `_ check out my `python-quoine `_ library. If you use `Kucoin `_ check out my `python-kucoin `_ library. If you use `IDEX `_ check out my `python-idex `_ library. .. image:: https://analytics-pixel.appspot.com/UA-111417213-1/github/python-binance?pixel&useReferer