Tribulnation SDK implementation for margin.trade spot and perpetual markets.
Spot and USDC-margined perpetual Market support, and Report snapshots and history, for
margin.trade, built on typed-margin-trade. Install with
pip install tribulnation-margin-trade.
from tribulnation.margin_trade import MarginTradeMarket
async with MarginTradeMarket.new() as venue:
market = await venue.perp.market('BTC')
book = await market.depth(levels=5)
Accounts are Solana Ed25519 keys; the account is the master key's base58 address. Trading
needs the master's key or an approved agent's (API wallet). Entering a signed venue asks
the venue for the key's master account: address, when set, must be it (else
AuthError), and when omitted the master is used. Account reads are by address and need
no key:
venue = MarginTradeMarket.new(address='6dm8…', private_key='<agent key>', mainnet=False)
reads = MarginTradeMarket.new(address='6dm8…')
- Exchanges are
perp(coin names such asBTC,XAU,NVDA) andspot(pair names such asPEARL/USDC). Asset ids are token symbols (USDC,PEARL); perpetual fees are charged inUSD. - Public data: discovery, tickers (24h volumes, plus last and best bid/ask where the
venue's CoinGecko feed lists the market), rules with each market's own fee rates,
REST depth and shared
l2Bookdepth streams, candles in the six SDK intervals, perpetual index (oracle price), next funding (hourly) andperp_stats. No funding-rate history: the venue serves placeholder data. - Account and trading: order queries, open orders, trade history (per market or
exchange-wide) and per-coin fill streams, positions, cross collateral, leverage,
available notional, perpetual funding payments, and
MARKET(anIoclimit),LIMIT(Gtc, orsettings={'margin-trade': {'limit_tif': 'Ioc'}}) andPOST_ONLY(Alo) orders with every cancellation method. Order placement is verified on testnet only.feesis unsupported: the venue's account rate is not what fills are charged. - Report: a
perpsubaccount (USDC without unrealized PnL, positions) and aspotsubaccount (token totals); history of fills, funding and transfers (on-chain deposits and withdrawals onsolanaorpearl, perp/spot transfers). - Streams need
typed-margin-trade0.1.1 or later, which pings every 10 s: the venue drops a connection about 30 s after the client's last ping.
Metadata
Release files for tribulnation-margin-trade 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tribulnation_margin_trade-0.4.1.tar.gz | 21.4 kB | With provenance | Details for tribulnation_margin_trade-0.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tribulnation_margin_trade-0.4.1-py3-none-any.whl | Python 3 | none | any | Details for tribulnation_margin_trade-0.4.1-py3-none-any.whl |
Total release size: 45.5 kB
Release files / tribulnation_margin_trade-0.4.1.tar.gz
| Download URL | tribulnation_margin_trade-0.4.1.tar.gz |
|---|---|
| Size | 21.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d37c0a547873cfddffe4a86ba1839abd16004b66606ca42a8fdea4a1715cc730
|
|
BLAKE2b-256 checksum How to use checksums |
db169c9b0d63a479098bcdf05d1e001b9c315a2aa347524b6a8e38794f61ff4d
|
| 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 19, 2026.
Transparency logRelease files / tribulnation_margin_trade-0.4.1-py3-none-any.whl
| Download URL | tribulnation_margin_trade-0.4.1-py3-none-any.whl |
|---|---|
| Size | 24.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9c6b078910249914194a08079cf87effbfc2686273e6dea284a756e3689bd5fb
|
|
BLAKE2b-256 checksum How to use checksums |
add86c4a937b56da8af5da908cf9f65b7eee294b9886d8715844af4e0d721f49
|
| 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 19, 2026.
Transparency logSecurity for tribulnation-margin-trade 0.4.1
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.
Attestation for tribulnation_margin_trade-0.4.1.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 19, 2026.
Transparency logA 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.