python-binance wraps Binance REST API v3, and endpoints do get deprecated
Binance Exchange API python implementation for automated trading
At a glance
- What is it?
- sammchardy/python-binance is an unofficial Python wrapper for the Binance exchange REST API v3, with asyncio, websockets, a symbol depth cache and testnet flags on the Client constructor. It is MIT licensed, v1.0.37 shipped on 2026-06-08, and the README asks you to update often because older endpoints disappear.
- Who is it for?
- python-binance suits a script that trades one exchange and can live with an unofficial wrapper: the depth cache, CRUD over websockets and margin, futures and vanilla options calls are all here, and testnet=True or demo=True keep you off real balances. It does not suit anyone who needs an SLA on endpoint shape, or a multi exchange abstraction.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 169 days ago.
- What is it written in?
- Mainly Python, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 24, 2026, and from our analysis. They are not legal advice.
Star history
- sammchardy/python-binance7,229 ★ · +15
| Repository | 2026-09-23 | 2026-11-24 |
|---|---|---|
| sammchardy/python-binance | 7.2k | 7.2k |
15 Stars in the last 62 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
Unofficial by its own opening line
The README opens by calling this an unofficial Python wrapper for the Binance exchange REST API v3, and that word carries weight. Nothing on the project side promises an endpoint keeps its shape, and the same opening lines point anyone hoping to buy cryptocurrency at the exchange site instead. The scope is one exchange and one API version, not a general abstraction across venues. Documentation sits at python-binance.readthedocs.io, the licence is MIT, and the default branch is master rather than main. The version banner reads Welcome to python-binance v1.0.37, and v1.0.37 is also the most recent release, dated 2026-06-08, the same day as the last push to the default branch. Older releases sit close behind it: v1.0.36 on 2026-03-24 and v1.0.35 on 2026-02-16.
tld, testnet and demo are constructor arguments
Region and environment are arguments to the client, not environment variables or a config file. Client(api_key, api_secret) is the entire required surface; everything else is a keyword. Accounts on an exchange domain other than the global one pass tld='us', which the README calls out for US, Japan and other TLDs, and the feature list widens that to other domains such as .us and .jp. Testnet is a flag too: testnet=True sends the client at the Spot, Vanilla Options or Futures testnet, depending on which client you built. Demo trading is a third switch, demo=True, and verbose=True exposes the requests for inspection.
Six runtime dependencies, and six listed in requirements.txt
setup.py declares install_requires as requests, six, dateparser, aiohttp, websockets and pycryptodome. The requirements.txt at the repository root lists aiohttp, dateparser, pycryptodome, requests and websockets, then adds websockets_proxy for python_version >= '3.8'. So six appears in one file and not the other, and requirements.txt adds websockets_proxy only for Python 3.8 and later. Install it from PyPI with the hyphenated name:
pip install python-binanceThe distribution name in setup.py is python_binance with an underscore, which trips people up when they pin by name. Classifiers claim Python 3.5 through 3.12 and Operating System :: OS Independent. The version is not hard coded in setup.py: it is read out of binance/__init__.py with a regex, and a miss raises RuntimeError("Unable to determine version.") at build time.
The v1.0.0 break moved wallet calls from wapi to sapi
Two breaking changes are named for anyone crossing the v1.0.0 line. Wallet endpoints migrated from the wapi prefix to sapi, which is the Binance Docs wallet endpoints group, so a withdrawal written against the old prefix needs its endpoint rewritten rather than tweaked. Websocket streams and the Depth Cache Manager were converted to Asynchronous Context Managers, so code that kept a connection alive by calling methods on it now has to enter a context and let it close. The README points at the websockets and depth cache documentation, and at the async examples, for the shape of the new call. The floor moved with them: v.1.0.20 or higher, because earlier versions are no longer recommended since some endpoints have been deprecated.
Timestamps, RecvWindow and typed exceptions live inside the client
A few chores are already handled, per the feature list. You do not generate timestamps yourself, and RecvWindow is sent by default. Authentication covers RSA and EDDSA keys. HTTP headers are customizable, proxy support covers both REST and websockets, and orjson support is listed for faster JSON parsing. Errors arrive as a typed exception rather than a bare HTTP failure, which the withdrawal example shows by importing BinanceAPIException from binance.exceptions and wrapping the call in a try block that prints the exception. That example also carries the instruction to check docs for assumptions around withdrawals, which is the one call in the quick start that moves value off the exchange.
The quick start is a catalogue, not a tutorial
Read the first code block as an index of the client rather than a lesson. It creates the client, reads depth, and fires a test order that never reaches the books:
from binance import Client, ThreadedWebsocketManager, ThreadedDepthCacheManager
client = Client(api_key, api_secret)
# get market depth
depth = client.get_order_book(symbol='BNBBTC')The comment next to the order is the part that matters for a first run: place a test market buy order, and to place an actual order use the create_order function. Historical candles take human dates as strings, so a range read looks like this:
klines = client.get_historical_klines("BNBBTC", Client.KLINE_INTERVAL_1MINUTE, "1 day ago UTC")
klines = client.get_historical_klines("ETHBTC", Client.KLINE_INTERVAL_30MINUTE, "1 Dec, 2017", "1 Jan, 2018")Conditional futures orders show a wart worth knowing about. The dedicated method and the general one both end up as an algo order, and the README mixes blocking and awaited calls on the same client object, which is either an editing slip or a deliberate hint that the futures client is async:
algo_order = client.futures_create_algo_order(symbol="LTCUSDT", side="BUY", type="STOP_MARKET", quantity=0.1, triggerPrice = 120)
order2 = await client.futures_create_order(symbol="LTCUSDT", side="BUY", type="STOP_MARKET", quantity=0.1, triggerPrice = 120)Cancelling takes the orderId back out of the response: client.futures_cancel_algo_order(orderId=order2["orderId"], symbol="LTCUSDT").
Websocket and depth cache work has its own example directory
The examples folder is where the interesting parts of this wrapper live: websocket.py, ws_create_order.py and ws_create_order_async.py for trading over a socket, depth_cache_example.py and depth_cache_threaded_example.py for the Symbol Depth Cache, create_oco_order.py, create_order.py and create_order_async.py, futures_algo_order_examples.py, verbose_example.py and save_historical_data.py. One filename is misspelled, binace_socket_manager.py. ThreadedWebsocketManager and ThreadedDepthCacheManager are exported from the binance package itself, matching the feature claims of reconnection with multiplexed connections and CRUD over websockets for minimum latency. Client-side latency is the stated reason those exist, which tells you what this library is optimising for.
Endpoints.md, a code generator and committed llms.txt
The repository root is more than a package. Endpoints.md sits beside code-generator.py, and generate_llms_txt.py produces llms.txt and llms-full.txt that are committed to the tree for machine readers. pyrightconfig.json and tox.ini cover static checking and environments, .pre-commit-config.yaml covers formatting, and .readthedocs.yaml plus .travis.yml handle docs and legacy CI. pyproject.toml switches ruff to preview mode and then ignores a long list of rule families, several annotated as things to fix gradually, including type annotation modernization and import sorting. It also sets pytest timeout = 90 with timeout_method = "thread", a detail worth remembering for anyone running that suite against a live endpoint.
Editorial conclusion
python-binance suits a script that trades one exchange and can live with an unofficial wrapper: the depth cache, CRUD over websockets and margin, futures and vanilla options calls are all here, and testnet=True or demo=True keep you off real balances. It does not suit anyone who needs an SLA on endpoint shape, or a multi exchange abstraction. Before you build on it, check that your planned endpoints are still in Endpoints.md rather than in the deprecation notices, that your Python version is covered by the 3.5 to 3.12 classifiers, and that the tld you need is reachable through the constructor. Licence is MIT, and the release line moved from v1.0.35 to v1.0.37 across 2026.
Frequently asked questions
What is python-binance?
It is an unofficial Python wrapper for the Binance exchange REST API v3, currently at v1.0.37, implementing the General, Market Data and Account endpoints plus margin, futures, portfolio margin and vanilla options. Documentation is hosted at python-binance.readthedocs.io and the licence is MIT.
How do I install python-binance?
Run pip install python-binance, then create a client with Client(api_key, api_secret). The declared runtime dependencies are requests, six, dateparser, aiohttp, websockets and pycryptodome, and the classifiers cover Python 3.5 through 3.12.
python-binance vs ccxt: what is the difference?
The README carries a line saying the project is powered by ccxt, so the two are related rather than a choice between unrelated libraries. What python-binance puts in front of you is Binance specific: a Symbol Depth Cache, CRUD over websockets for minimum latency, historical kline fetching, withdraw and deposit address calls, and the Gift Card API.
python-binance vs the official binance connector?
The README states plainly that this project is unofficial. Its own scope is an unofficial wrapper for the exchange REST API v3, released under MIT with the changelog hosted in the documentation.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/sammchardy-python-binance)Star history chart for your README
[](https://hysenlabs.com/projects/sammchardy-python-binance)Was this useful?