Skip to main content

Tribulnation SDK

PyPI Python versions License: MIT Check

One async, typed Python interface for trading and market data across crypto exchanges and chains.

Why use it

  • 🎯 One interface for 20 venues. Code written against Market, Earn, Wallet and Report runs on any venue that implements them. To switch venues, or run several accounts on one venue, you change the ID string.
  • 🛡️ Validated responses. Each venue adapter is built on a Typed client, so venue responses are checked before they reach your code.
  • 🔢 Decimal and datetime. Prices, sizes and fees are Decimal, and timestamps are timezone-aware datetime. No floats, no epoch integers.
  • 📈 Spot, margin and perpetual markets. The types tell them apart: perpetuals add funding and index price, margin markets add borrow interest.
  • 📊 Reports from exchanges and chains. Report reads balance and position history, Earn lists yield products, and Wallet covers deposits and withdrawals.

Install

pip install 'tribulnation-sdk[hyperliquid]'

Each extra installs one venue adapter, for example [hyperliquid,mexc,binance]. The support matrix shows what each venue implements.

Quickstart

Read Hyperliquid's BTC order book and next funding rate. Public data needs no API keys:

import asyncio
from tribulnation.sdk import MarketSDK, accounts

sdk = MarketSDK({'hl': accounts.Hyperliquid(public=True)})

async def main():
  book = await sdk.depth('hl::BTC')
  print('best bid:', book.best_bid)
  print('best ask:', book.best_ask)
  print(await sdk.next_funding('hl::BTC'))

asyncio.run(main())
best bid: [59976.0] 3.75746 ($225357.420960)
best ask: [59977.0] 2.10861 ($126468.101970)
NextFunding(rate=Decimal('0.0000059229'), time=datetime.datetime(2026, 11, 27, 17, 0, tzinfo=datetime.timezone(datetime.timedelta(0), 'UTC')), premium=None, interval=datetime.timedelta(seconds=3600))

'hl' is the account ID you chose, and 'hl::BTC' is a market ID of the form <account>:<exchange>:<market>. An empty exchange part means Hyperliquid's default perpetuals exchange. See Market IDs for the format on each venue.

Your own accounts

For trading and account data, list your accounts in a TOML file. $VAR values are read from the environment:

# sdk.toml
[accounts.hl]
venue = "hyperliquid"
public = true

[accounts.mexc_account1]
venue = "mexc"
api_key = "$MEXC_API_KEY"
api_secret = "$MEXC_API_SECRET"
from tribulnation.sdk import MarketSDK

sdk = MarketSDK.load('sdk.toml')

A missing variable fails when the file loads (ValueError: Environment variable MEXC_API_KEY is not set), before any request goes out. The MEXC account needs the mexc extra. From here, Your First Order walks through reading rules, sizing, placing and cancelling an order.

Documentation

  • Market: order books, rules, orders, positions, funding
  • Earn: yield products across venues
  • Wallet: deposit and withdrawal methods
  • Report: balance and position history
  • Reference: async usage, errors, logging and retries
  • Support matrix: what each venue implements

Status

Beta. The core package (tribulnation-sdk) and each venue adapter (tribulnation-<venue>) have their own version numbers and are released separately. Release notes are on the GitHub releases page. Questions and bug reports go to GitHub issues.

Contributing

See CONTRIBUTING.md for the repository layout, commands and release flow. Maintainer guides and architecture decisions are in the developer documentation.

License

MIT

Metadata

Release files for tribulnation-sdk 4.5.0

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

Source distribution (sdist)

Source distribution for tribulnation-sdk 4.5.0
File Size Uploaded Provenance Actions
tribulnation_sdk-4.5.0.tar.gz 108.1 kB With provenance Details for tribulnation_sdk-4.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tribulnation-sdk 4.5.0
File Interpreter ABI Platform Actions
tribulnation_sdk-4.5.0-py3-none-any.whl Python 3 none any Details for tribulnation_sdk-4.5.0-py3-none-any.whl

Total release size: 265.0 kB

Release files / tribulnation_sdk-4.5.0.tar.gz

Download URL tribulnation_sdk-4.5.0.tar.gz
Size 108.1 kB
Tags Source
SHA-256 checksum
How to use checksums
544cc6bd6cb4845de4d61907b1530544c6a067b0bc61edac803ce6b6cdb29c2b
BLAKE2b-256 checksum
How to use checksums
81b63904de1a8311230efb61f44e2e1c193ed7ae299ce2274d2ea436527a1148
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Release files / tribulnation_sdk-4.5.0-py3-none-any.whl

Download URL tribulnation_sdk-4.5.0-py3-none-any.whl
Size 156.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ac6249a07be67d0f9a4c69c41adcd457774dd2caec59aacc492eadc66557e8e
BLAKE2b-256 checksum
How to use checksums
d51555d1260db6ae1666f8ac519214681e302356648e9f87dddae62f906cc330
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

Security for tribulnation-sdk 4.5.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tribulnation_sdk-4.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

4.5.0 This release

2 release files Full provenance

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