Skip to main content

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

  1. Introduction
  2. Network Setup
  3. Using the Testnet Faucet
  4. Account Details
  5. Getting Price Quotes
  6. Placing Orders
  7. Placing Native Orders
  8. Using WebSockets

Quick Start

  1. Set up your network connection (see Network Setup)
  2. If using testnet, obtain funds from the faucet (see Using the Testnet Faucet)
  3. Check your account details (see Account Details)
  4. Get current market prices (see Getting Price Quotes)
  5. Build and place your order (see Placing Orders or Placing Native Orders)
  6. 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 node
  • MutatingNodeClient - the extension on top of the query client, that support transation simulation and sending
  • NodeClient the 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ritbit_v4_client-0.0.6.tar.gz (146.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ritbit_v4_client-0.0.6-py3-none-any.whl (45.9 kB view details)

Uploaded Python 3

File details

Details for the file ritbit_v4_client-0.0.6.tar.gz.

File metadata

  • Download URL: ritbit_v4_client-0.0.6.tar.gz
  • Upload date:
  • Size: 146.6 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

Hashes for ritbit_v4_client-0.0.6.tar.gz
Algorithm Hash digest
SHA256 f4886b11f0565f922d1a5be91a4c6cb65092c088f31b5d080e73ff67d077b79d
MD5 4907c9fcd453036f7f7af07fe9149761
BLAKE2b-256 a5d56bf6c5a627b98a6890abd487bf60841d59f361511cb657b2dc959232bfe2

See more details on using hashes here.

File details

Details for the file ritbit_v4_client-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: ritbit_v4_client-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 45.9 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

Hashes for ritbit_v4_client-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2395c2c4c06b58d244a0b87cff6d52186638a3fab7a41f8a33ea53be2eeed197
MD5 ab4a2a8671ba6fe5f58c576cb62c14b6
BLAKE2b-256 5a508f15f9098dccab467f0e9201f0bb504c9abc1c275d2b5c27e86fa10088ca

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page