Crypto.com websocket api client
This is a low level api client, it just connects the exchange api with your python code in the most simple way. Over
this library, you can build your awesome applications or high level api.
For more information, check the library documentation, the official documentation and the examples directory.
Features
This library is optimized to be small, fast and secure.
- Fully tested: 100% code coverage
- Simple: It just does one thing, but it does it right
- Fast: Relies on asyncio so latency and memory usage is near zero (much better than threading or multiprocessing)
- No forced dependencies: Just
websocketsandorjson. No super modern cool features that you probably don't want
Getting started
There are two kinds of apis, the user and market.
The user type requires providing api credentials (access and secret key)
Before using the library, you have to install it:
pip install crypto_com_client
The most simple example, subscribing to an orderbook:
from crypto_com.crypto_com import MarketClient
import asyncio
import logging
logging.basicConfig(level=logging.INFO)
async def run():
async with MarketClient() as client:
await client.subscribe(["book.CRO_USDC.10"])
while True:
event = await client.next_event()
print(event)
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
If you want to use the user api first get you api key and secret.
from crypto_com import UserClient
import asyncio
import os
import logging
logging.basicConfig(level=logging.INFO)
async def run():
async with UserClient(
api_key=os.environ["API_KEY"],
api_secret=os.environ["API_SECRET"]
) as client:
await client.send(
client.build_message(
method="private/get-open-orders",
params={
"instrument_name": "CRO_USDC",
"page_size": 10,
"page": 0
}
)
)
event = await client.next_event()
print(event)
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(run())
With these two examples you can use the whole api. Just check the API documentation to know the different methods and parameters.
Contributing
If you have any suggestion, detect any bug or want any feature, please open an issue so we can discuss it.
Tests
To run the tests just run tox
It will run in first instance flake8, then pylint and finally pytest with code coverage check.
The only rule ignored is max-line-length=120 basically because nowadays monitors are big enough for this.
Websockets import has E0611 disabled because pylint does not process __all__ correctly
Metadata
Release files for crypto-com-client 1.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 | Provenance | Actions |
|---|---|---|---|---|
| crypto-com-client-1.2.tar.gz | 8.4 kB | Without provenance | Details for crypto-com-client-1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| crypto_com_client-1.2-py3-none-any.whl | Python 3 | none | any | Details for crypto_com_client-1.2-py3-none-any.whl |
Total release size: 16.9 kB
Release files / crypto-com-client-1.2.tar.gz
| Download URL | crypto-com-client-1.2.tar.gz |
|---|---|
| Size | 8.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0a9a7744612ec1612fdb0c6d0cb3e7bd2256c07b40f0e33f41f6357877af2fb6
|
|
BLAKE2b-256 checksum How to use checksums |
2a421279c9bf1f20cb9af94919d8dd5c286cb634390a5b241e4092ccc227a1b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.5 CPython/3.6.12 Linux/6.2.0-39-generic
|
Release files / crypto_com_client-1.2-py3-none-any.whl
| Download URL | crypto_com_client-1.2-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
427d032c07a3863c2790753f8270c3032a212bc6ddcf00d726eec0555caf6aae
|
|
BLAKE2b-256 checksum How to use checksums |
b22c5cde147655ca32581c5e4ba5c14ca3fc52ac8afbfa7feb96a1d038f58ccf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.5 CPython/3.6.12 Linux/6.2.0-39-generic
|
Security for crypto-com-client 1.2
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.