crypto-msg-parser
Python bindings for the crypto-msg-parser library.
Install
pip3 install crypto-msg-parser
Quickstart
from crypto_msg_parser import MarketType, parse_trade
json_arr = parse_trade("binance", MarketType['inverse_swap'], '{"stream":"btcusd_perp@aggTrade","data":{"e":"aggTrade","E":1616201883458,"a":41045788,"s":"BTCUSD_PERP","p":"58570.1","q":"58","f":91864326,"l":91864327,"T":1616201883304,"m":true}}')
assert len(json_arr) == 1
trade = json_arr[0]
assert trade['exchange'] == 'binance'
assert trade['market_type'] == 'inverse_swap'
assert trade['msg_type'] == 'trade'
assert trade['price'] == 58570.1
assert trade['quantity_base'] == 5800.0 / 58570.1
assert trade['quantity_quote'] == 5800.0
assert trade['quantity_contract'] == 58.0
assert trade['side'] == 'sell'
Another example, parsing the output of crypto-crawler:
from crypto_crawler import MarketType, crawl_trade
from crypto_msg_parser import MarketType, parse_trade
crawl_trade(
"binance",
MarketType.Spot,
["BTCUSDT", "ETHUSDT"],
lambda msg: print(parse_trade(msg.exchange, msg.market_type, msg.json))
)
Metadata
Release files for crypto-msg-parser 2.8.16
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| crypto_msg_parser-2.8.16-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | Python 3 | none | Linux glibc 2.17+ x86-64 | Details for crypto_msg_parser-2.8.16-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
Release files / crypto_msg_parser-2.8.16-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | crypto_msg_parser-2.8.16-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 5.1 MB |
| Tags | Linux glibc 2.17+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
73ca2f9fe4efe2c13b8aa5b59ed49668cfb99cee5f55f38c95920cec8a32fe0e
|
|
BLAKE2b-256 checksum How to use checksums |
4ac3238663420b8e1a39e3d7b3cb4e8d73e1ba6f92d6031cc1fb727419058f1f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.2 CPython/3.8.11
|
Security for crypto-msg-parser 2.8.16
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.