No project description provided
Project description
Python Client (async) for Ritbit (v4 API)
Quick links
Install
Using uv (recommended)
uv init my-trading-bot
cd my-trading-bot
uv add ritbit-v4-client
Using pip
pip install ritbit-v4-client
Install from GitHub
uv add git+https://github.com/ritbit/v4-clients#subdirectory=v4-client-py-v2
or with pip:
pip install "ritbit-v4-client @ git+https://github.com/ritbit/v4-clients#subdirectory=v4-client-py-v2"
Common Installation Issue on Ubuntu
If you encounter the following error:
Failed building wheel for ed25519-blake2b
Install the required build tools and Rust toolchain:
sudo apt-get update
sudo apt-get install build-essential python3-dev libssl-dev
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
Then retry the installation.
Getting Started Guide
Ritbit Python SDK Trading Documentation: go-to resource for starting trades on Ritbit using the Python SDK. Follow this guide to learn the basics and begin trading.
Table of Contents
- Introduction
- Network Setup
- Using the Testnet Faucet
- Account Details
- Getting Price Quotes
- Placing Orders
- Placing Native Orders
- Using WebSockets
Quick Start
- Set up your network connection (see Network Setup)
- If using testnet, obtain funds from the faucet (see Using the Testnet Faucet)
- Check your account details (see Account Details)
- Get current market prices (see Getting Price Quotes)
- Build and place your order (see Placing Orders or Placing Native Orders)
- Optionally, set up WebSocket connections for real-time updates (see Using WebSockets)
For more detailed examples, see the examples directory. Note that some examples may require installation of additional packages to work.
Changes
Migration
If you are transitioning from a previous version of the Python client, please note the following differences:
NodeClient
ValidatorClient is renamed to NodeClient.
All provided methods are asynchronous.
Methods are available directly, no methods get or post needed, since the client uses inheritance, and consists of three layers:
QueryNodeClient, the basic layer that send queries to a nodeMutatingNodeClient- the extension on top of the query client, that support transation simulation and sendingNodeClientthe toppest layer that provides methods to control orders
For parameters raw types used.
For construcint order the Market builder is provided, that helps to calculate quantums and subticks values.
IndexerClient
The IndexerClient has the similar structure, but provides
asynchronous methods as well.
IndexerSocket
The SocketClient is replaced with the IndexerSocket that provides separate channels concept and allow to add per-channel processing.
Key Improvements
The latest version of the Python async client for Ritbit offers notable enhancements over previous iterations. These improvements make it a more efficient tool for trading and integration.
Asynchronous Execution
The methods leverage Python's async features, allowing you to fully harness concurrency benefits. This approach optimizes resource usage, minimizes unnecessary threads, and reduces latency.
Enhanced Type Hints
Expanded type hint coverage enhances code readability and provides better tooling support. Additionally, it helps detect errors early during development.
API Reflection
The client closely mirrors the Ritbit API, enabling seamless access to the exchange's features and parameters. This makes integrating the client with your applications intuitive and straightforward.
Lightweight Implementation
The client is built using pure Python libraries and maintains a thin, transparent layer that follows the Principle of Least Astonishment (POLA). This ensures explicit behavior and gives you greater control.
MIT License
Licensed under the permissive MIT license, the client can be easily integrated into your software projects without restrictive legal hurdles.
Development
The project is divided into three main parts:
- node - contains the
NodeClient, transaction builder and other utilities - indexer - contains rest api indexer client and websocket indexer client
- faucet - contains faucet client
Installing from source
The project uses uv. To install dependencies, run:
uv sync
To include dev and example dependencies:
uv sync --group dev --group examples
Preparing development environment
Install git hooks:
uv run pre-commit install
Testing
To run tests use:
uv run pytest
Linting
uv run black --check ./ritbit_v4_client ./tests ./examples
For more details about the grant see link.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ritbit_v4_client-0.0.3.tar.gz.
File metadata
- Download URL: ritbit_v4_client-0.0.3.tar.gz
- Upload date:
- Size: 143.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1dccbeb7e140f498c90bdc1045807be77f73a408b2de8d487e169fb21d6506e
|
|
| MD5 |
fe35eaf897bb61d6a9ee7c1c38f4f666
|
|
| BLAKE2b-256 |
ed1562d34f29bf9dcca92b71464e8edebe7b0cbe4eae9a8043f2c86dd731fe4a
|
File details
Details for the file ritbit_v4_client-0.0.3-py3-none-any.whl.
File metadata
- Download URL: ritbit_v4_client-0.0.3-py3-none-any.whl
- Upload date:
- Size: 41.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.2 {"installer":{"name":"uv","version":"0.11.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aaff91a587ceb47468c054f24a70e1ab16d4896c60fe1a365a80d9d5530fcf99
|
|
| MD5 |
f3cbc449949893baedaed7d4135bf548
|
|
| BLAKE2b-256 |
0d1ceee14490fc57743c1b50a344bcecf18cc5de8b1803306a444902eb536c91
|