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.

Download files

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

Source Distribution

rivermarkets-0.9.0.tar.gz (57.5 kB view details)

Uploaded Source

Built Distribution

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

rivermarkets-0.9.0-py3-none-any.whl (108.4 kB view details)

Uploaded Python 3

File details

Details for the file rivermarkets-0.9.0.tar.gz.

File metadata

  • Download URL: rivermarkets-0.9.0.tar.gz
  • Upload date:
  • Size: 57.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for rivermarkets-0.9.0.tar.gz
Algorithm Hash digest
SHA256 e88bf664a68981cfb6a4abcb6c0873d5f04db2bae484b85eb77a10501277b39f
MD5 efdde7f5d48f6744f2863934e8eebf69
BLAKE2b-256 bd29a696938fd3651dd82d9626adb94b92de1b2a2c64a13d0cdc6f2b9b867a0d

See more details on using hashes here.

File details

Details for the file rivermarkets-0.9.0-py3-none-any.whl.

File metadata

  • Download URL: rivermarkets-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 108.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for rivermarkets-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f17aeb2b816191c35bb26096d3a56b987f28001cbff72fcf753b6726ab23470
MD5 86f5b71c37bb40a629ef1816f2c5011f
BLAKE2b-256 fd6d048ed774d982b7ddb6e7480a533486e1d5667f4674d0eb9347807aef496f

See more details on using hashes here.

Release history Release notifications | RSS feed

0.12.0

2 files

0.11.1

2 files

0.11.0

2 files

0.10.0

2 files

This release

0.9.0 This release

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

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