topbid
Helper library to fetch and store current orderbook top bid/ask price and volume from crypto exchanges APIs. Currently supports Binance, Bybit, Gateio, Kraken, Kucoin and OKX.
Requires Python 3.8+
Installation
pip install topbid
Usage
>>> from topbid.orderbook import OrderBook
# Instanciate OrderBook.
>>> orderbook = OrderBook()
# Add one or more market pairs to be fetched from an exchange REST API.
>>> orderbook.add("binance", "BTC/USDT")
>>> orderbook.add("kucoin", ["BTC/USDT", "ETH/USDT"])
# Start the background thread fetching prices and volume (here, every 2 seconds).
>>> orderbook.start(update_every=2)
# Retrieve the highest bid on the orderbook.
>>> orderbook.get_orderbook_top_bid("binance", "BTC/USDT")
(23130.41, 0.0584)
# Retrieve the lowest ask on the orderbook.
>>> orderbook.get_orderbook_top_ask("binance", "BTC/USDT")
(23130.43, 0.0214)
# Removes a pair from being fetched.
>>> orderbook.delete("binance", "BTC/USDT")
# Stop the background thread and removes all watched pairs.
# It must be called before exiting your own application.
>>> orderbook.stop()
Metadata
Release files for topbid 3.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| topbid-3.0.2.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| topbid-3.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.6 kB
Release files / topbid-3.0.2.tar.gz
| Download URL | topbid-3.0.2.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc1ef64313bac453313c7518ddd8781c9190c3303cd87f12e1dcaa654a444fda
|
|
BLAKE2b-256 checksum How to use checksums |
f6377767023ca6ae278b2cfcf65ced2b60772321ab950641febef771e955dc2a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.4
|
Release files / topbid-3.0.2-py3-none-any.whl
| Download URL | topbid-3.0.2-py3-none-any.whl |
|---|---|
| Size | 6.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9290838f2865c9d1f267952abf99a7918f70b3b9570671f53d6fa284bf79c77a
|
|
BLAKE2b-256 checksum How to use checksums |
ea061d60f2a0304e39f71bfa3d56faadefbc79bd420eeaa1d3d79d6c0565dd16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.4
|