Skip to main content

River Markets Python SDK

Python SDK for the River Markets API.

Installation

pip install rivermarkets

Authentication

The SDK authenticates with Ed25519 request signing. Create an API key in Settings → API Keys; you'll get a Key ID (UUID) and a base64-encoded private key (shown once at creation). Pass both to the client — every request is signed transparently via X-River-Key-Id, X-River-Timestamp, and X-River-Signature headers.

Usage

from rivermarkets import RiverMarkets

client = RiverMarkets(
    key_id="YOUR_KEY_ID",
    private_key="YOUR_BASE64_PRIVATE_KEY",
)

# Search markets
results = client.markets.search_markets(q="bitcoin")

# Place an order
order = client.orders.create_order(
    subaccount_id="...",
    river_id=4552150,
    order_type="LIMIT",
    time_in_force="GTC",
    buy_flag=True,
    price=0.50,
    qty=10,
)

# Cancel an order
client.orders.cancel_order(order_id="...")

Async

from rivermarkets import AsyncRiverMarkets

client = AsyncRiverMarkets(
    key_id="YOUR_KEY_ID",
    private_key="YOUR_BASE64_PRIVATE_KEY",
)
results = await client.markets.search_markets(q="bitcoin")

Local fee calculations

The client fetches each market's live fee schedule once and caches it for the lifetime of that client. You can also warm several schedules with one request:

from rivermarkets import RiverMarkets

client = RiverMarkets(
    key_id="YOUR_KEY_ID",
    private_key="YOUR_BASE64_PRIVATE_KEY",
)

river_id = 4552150
qty = 10
price = 0.50

client.prefetch_fee_schedules([river_id])

taker_fee = client.compute_fee(
    river_id=river_id,
    qty=qty,
    price=price,
    is_maker=False,
)
maker_fee = client.compute_fee(
    river_id=river_id,
    qty=qty,
    price=price,
    is_maker=True,
)

# Normalize quoted prices to include the per-contract taker fee.
buy_all_in = price + taker_fee / qty
sell_net = price - taker_fee / qty

compute_fee makes no network request after the River ID is cached. Call clear_fee_schedule_cache(river_id) to force the next calculation to reload that schedule.

Metadata

Release files for rivermarkets 0.14.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rivermarkets 0.14.2
File Size Uploaded Provenance
rivermarkets-0.14.2.tar.gz 64.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for rivermarkets 0.14.2
File Interpreter ABI Platform
rivermarkets-0.14.2-py3-none-any.whl Python 3 none any Details

Total release size: 187.5 kB

Release files / rivermarkets-0.14.2.tar.gz

Download URL rivermarkets-0.14.2.tar.gz
Size 64.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2d7c13e561f170cd4559268c6121ef0642388fc873a8f65dfda1055ebf80fbdb
BLAKE2b-256 checksum
How to use checksums
e33cb6cbf6afc0e22a4c23e05fce15f5181eeb1c3efb43299bfa24f69c2e7a7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / rivermarkets-0.14.2-py3-none-any.whl

Download URL rivermarkets-0.14.2-py3-none-any.whl
Size 122.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a341d350b8ddf2e6797c0ac63e79310f5efe5757c82cf8b66ace8a17c1f7cd75
BLAKE2b-256 checksum
How to use checksums
24aa32a1c3d03d438e1f733fa494d8ddb7bc23f712f62d25d71fffe7a3750ffc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Security for rivermarkets 0.14.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page