EXIR Python Client - Examples
This repository contains a lightweight Python client in index.py and runnable examples under example/ for:
- Public: Fetching market data (e.g., ticker)
- Private: Authenticated calls (user, balance, place orders)
- WebSocket: Streaming market data (orderbook)
Requirements
- Python 3.8+
- Install dependencies:
python3 -m pip install -r requirements.txt
Project layout
index.py: EXIR client (public, private, and WebSocket helpers)utils.py: HTTP and auth utilitiesexample/public.py: Public ticker exampleexample/balance.py: Private user + balance exampleexample/order.py: Private create order exampleexample/websocket.py: WebSocket orderbook subscription example
Public usage
Fetch the ticker for btc-usdt:
python3 example/public.py
Example:
python3 example/public.py
Private usage (user, balance)
Set your api keys:
EXIR_API_KEY=<your-api-key> \
EXIR_API_SECRET=<your-api-secret> \
Notes:
- Ensure your key has the required permissions (e.g., trading, read balance).
- If IP whitelisting is enabled on the key, include your current IP.
- Your system clock must be accurate; auth uses expiring signatures.
Private usage (create order)
Places a limit BUY order for 0.001 BTC at 50,000 USDT on btc-usdt:
If you receive 401 Unauthorized when creating orders:
- Check key permissions and IP whitelist
- Ensure your system clock is in sync
WebSocket usage (orderbook)
Subscribes to orderbook:btc-usdt and logs messages for ~10 seconds:
Notes:
- Public WS channels (e.g.,
orderbook,trade) do not require credentials, but the script will include them if provided. - The client automatically reconnects by default.
Metadata
Release files for exir-py-lib 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| exir_py_lib-1.0.1.tar.gz | 4.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| exir_py_lib-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.1 kB
Release files / exir_py_lib-1.0.1.tar.gz
| Download URL | exir_py_lib-1.0.1.tar.gz |
|---|---|
| Size | 4.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e2968764c0cdbaec91e852ac4713215e7d9f83ff8c4cb936eba15fae2d2c8fe7
|
|
BLAKE2b-256 checksum How to use checksums |
afcc662d97e688b442c71212ed741b0145292342f052fa765d0ffe6778bb8656
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / exir_py_lib-1.0.1-py3-none-any.whl
| Download URL | exir_py_lib-1.0.1-py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c4e39ef1b58d0d529e8edffe874f78a8e4f4f69fe43a40f205519b00a2830160
|
|
BLAKE2b-256 checksum How to use checksums |
e7393a6fcfc9a7141c736095541dbdf69ca8ee1db0d6f29181ede2f4e31e3100
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|