Tribulnation Terminal API
Your Terminal portfolio and, on the Ultra plan, live and historical crypto market data across CEX and DEX venues: for scripts, agents and AI assistants. Read-only, always. No key can place an order, move funds, change a setting or see an exchange key.
- Base URL
https://api.tribulnation.com- Auth
Authorization: Bearer tn_key_…- Format
JSON · GET · UTC
Get started#
Hand it to your agent#
Everything an AI agent needs to use this API. Copy one line.
Use the Tribulnation Terminal API at https://api.tribulnation.com. Read https://api.tribulnation.com/llms.txt first. My API key is in the TN_API_KEY environment variable: send it only as `Authorization: Bearer $TN_API_KEY` to https://api.tribulnation.com and never print, log or commit it. The API is read-only.
claude plugin marketplace add https://api.tribulnation.com/skills/marketplace.json
claude plugin install terminal@tribulnationhttps://api.tribulnation.com/mcpclaude mcp add --transport http tribulnation-terminal https://api.tribulnation.com/mcpClaude and ChatGPT connectors
pip install tribulnation-terminalnpm i @tribulnation/terminalQuick start#
- Make a key on https://app.tribulnation.com/integrations:
me:readfor your own data (every plan),market:readfor market data (Ultra). The secret is shown once. - Keep it in the environment, never in code or a URL:
read -rs TN_API_KEY && export TN_API_KEY # paste it: not echoed, not in your history- Call the API with the key in the
Authorizationheader:
curl -sH "Authorization: Bearer $TN_API_KEY" https://api.tribulnation.com/me
curl -sH "Authorization: Bearer $TN_API_KEY" "https://api.tribulnation.com/me/portfolio?hours=168"
curl -sH "Authorization: Bearer $TN_API_KEY" "https://api.tribulnation.com/v1/prices/latest?assets=bitcoin,ethereum"
curl -sH "Authorization: Bearer $TN_API_KEY" "https://api.tribulnation.com/live/book/bitcoin?depth=10"GET /me answers what the key is: its scopes, expiry and the owner's plan. Start there
when something is refused. From your own code, send a User-Agent naming your program:
Python urllib's default is refused with a plain-text 403 (see Errors).
Conventions#
One contract on every surface (/v1, /v2, /me, /live):
| Answers | { "data", "meta" }. meta.as_of is when the data is current as of (an instant); meta.currency is the currency of every money figure, on routes that carry money. Errors are always { "error": { "code", "message", "param"?, "details"? } }. |
| Paging | A paged route answers meta.page: limit, has_more, next_cursor (pass it back as cursor; null at the end), and on ranked lists number and total (which also take page). |
| Times | Every instant is an ISO-8601 UTC string with milliseconds (2026-11-17T19:40:28.036Z); no epoch numbers (the one exception: a live socket frame's ts_ms, below; the OAuth endpoints answer client_id_issued_at in epoch seconds and expires_in in seconds, as RFC 7591 and RFC 6749 require). from/to take a date (2026-11-17, its 00:00 UTC) or an instant with a zone; windows are half-open, [from, to), to defaults to now and meta.range echoes the window. A series bucket is labelled by its start, and is in a window when its start is. |
| Parameters | Every route refuses a parameter it does not take, one given twice, or an empty one, with 400 and error.param naming it. Lists are plural and comma-separated (assets=bitcoin,ethereum); an id the catalogue does not have is a 400 with details.unknown. |
| Ids | A field holding an id ends in _id: asset_id, venue_id, quote_asset_id. Assets are catalogue ids (bitcoin; /v1/search?search=btc finds them), venues lower case (binance). A venue's product family is its segment (spot, usdm, perp); <venue>:<segment> (binance:usdm) is a segment_id. A market's kind is spot or perp. A field holding a display symbol, not an id, ends in _symbol (/me's market legs: quote_symbol "USDT"). |
| Names | name is a thing's own name (venue_name names the venue of a row); icon_url is an absolute URL. |
| Numbers | By meaning, never by how a value is stored. Amounts are decimal strings: every price, quantity, size, notional, balance, volume, open interest, market cap and P&L, in a currency or an asset ("64250.5"), whether it was stored exact or a venue published it as a float. One written form: plain notation, never an exponent ("0.0000001", not 1e-7), no leading zeros, no trailing zeros after the point ("5094111182848", not "5094111182848.00"), "0" never "-0"; a venue float is written as the shortest decimal that reads back as the same float, never rounded. Everything else is a JSON number: rates are fractions (0.05 is 5 %, apr is a year's), never percent; a figure in basis points ends in _bps, a duration in seconds in _s; ratios, counts, multipliers and leverage are numbers too. |
| Currency | US dollars unless ?currency=eur asks for euros (meta.currency says which). A venue price is in its market's quote asset. |
| Methods | Every route is GET (or HEAD) except the OAuth endpoints. Redirects are never needed: never follow one with your key. |
| Live sockets | A WebSocket frame names, types and times every field as the HTTP answers do (/live/asset/{asset} answers the same view), with one exception: the frame's build time is ts_ms, epoch milliseconds, for programs that compare it with their own clock. It is the only epoch number on the API; every other instant in a frame is ISO. The frame type is type (view or control); v is the view format's version, the same on a frame and on `GET /live/book |
/v2 |
The one exception to the names above: the publication records keep their own field names (market.ticker's bid_size, ask_size, volume_24h; venue.earn's min_amount, max_amount, lock_seconds; interval_s; ids as asset, venue, exchange), as each record's schema lists them. Their numbers follow the rule above. |
Auth & keys#
On this page
API keys and scopes#
Every request carries one API key in the Authorization header. A key is tn_key_ and
43 characters. Never put it in a URL.
Authorization: Bearer tn_key_…| Scope | Allows | Plan |
|---|---|---|
me:read |
Your own data: accounts, portfolio, positions, fills, funding, saved charts (/me) |
Every plan |
me:profiles |
Create and change your portfolio profiles (POST /me/profiles, PATCH /me/profiles/{id}); off unless you tick it |
Every plan |
market:read |
Market data: /v1, /v2 and /live |
Ultra (fair use, included) |
A key used off Ultra for market data, or without the scope a route needs, gets 403
with the reason. Every key is listed on https://app.tribulnation.com/integrations and
revocable there, however it was made.
Device login (CLI)#
tn terminal auth login asks for a code, prints it with a link, and waits while you
approve it in the browser; the key it receives is saved for the CLI and the Python
client. Add --scopes me:read,market:read on Ultra.
Keys read only, with one exception: me:profiles lets a key create and change
portfolio profiles. Tick it when you create the key; a key without it gets 403 on
those writes. Listing profiles needs me:read.
uv tool install 'tribulnation-terminal[cli]'
tn terminal auth loginMCP and OAuth sign-in#
An MCP client (Claude, ChatGPT, Claude Code) connects to https://api.tribulnation.com/mcp, signs you in on
https://app.tribulnation.com with OAuth 2.1 and receives its own key. See MCP server.
OAuth endpoints#
For client authors: the device login (RFC 8628) and the MCP clients' authorization code
grant (OAuth 2.1, RFC 7591 registration). They take no key, answer in OAuth's own error
format ({error, error_description}), and are never cached.
POST/oauth/device/code
#curl -s -X POST https://api.tribulnation.com/oauth/device/code \
-d client_id=tn-cli -d 'scope=me:read market:read'No recorded answer: none recorded yet.
Response 200DeviceCodeAnswer
device_codestringSecret the client polls/oauth/tokenwith.user_codestringShort code the person confirms in the browser.verification_uristringWhere the person approves the code.verification_uri_completestringThe same page with the code filled in.expires_innumberSeconds until the code expires.intervalnumberSeconds to wait between polls.scopestringThe scopes asked for, space-separated.
POST/oauth/token
#curl -s -X POST https://api.tribulnation.com/oauth/token \
-d grant_type=urn:ietf:params:oauth:grant-type:device_code \
-d client_id=tn-cli -d "device_code=$DEVICE_CODE"No recorded answer: none recorded yet.
Response 200CodeTokenAnswer | DeviceTokenAnswer
POST/oauth/register
#curl -s -X POST https://api.tribulnation.com/oauth/register \
-H 'Content-Type: application/json' \
-d '{"client_name": "My agent", "redirect_uris": ["http://127.0.0.1:8976/callback"]}'No recorded answer: none recorded yet.
Response 201RegistrationAnswer
client_idstringThe id the client signs in with.client_id_issued_atnumberWhen it was issued, epoch seconds.client_namestringThe name it registered.redirect_urisstring[]Where sign-in may return.grant_types['authorization_code']Grants it may use (authorization_code).response_types['code']Response types (code).token_endpoint_auth_method'none'Alwaysnone: a public client.client_urioptionalstringIts homepage, or absent.
POST/oauth/revoke
#curl -s -X POST https://api.tribulnation.com/oauth/revoke \
-d client_id=tn-cli -d "token=$TN_API_KEY"No recorded answer: none recorded yet.
Response 200{ [key: string]: never }
Types 4
DeviceCodeAnswer7 fields
/** What the code request answers (RFC 8628 §3.2). */
export interface DeviceCodeAnswer {
/** Secret the client polls `/oauth/token` with. */
device_code: string
/** Short code the person confirms in the browser. */
user_code: string
/** Where the person approves the code. */
verification_uri: string
/** The same page with the code filled in. */
verification_uri_complete: string
/** Seconds until the code expires. */
expires_in: number
/** Seconds to wait between polls. */
interval: number
/** The scopes asked for, space-separated. */
scope: string
}CodeTokenAnswer4 fields
/** The token answer (RFC 6749 §5.1): the API key itself. */
export interface CodeTokenAnswer {
/** The new API key (`tn_key_…`): store it as a secret. */
access_token: string
/** Always `Bearer`. */
token_type: 'Bearer'
/** The scopes granted, space-separated. */
scope: string
/** Seconds until the key expires; absent for a key that never does. */
expires_in?: number
}DeviceTokenAnswer6 fields
/** The token answer (RFC 6749 §5.1): the API key itself. */
export interface DeviceTokenAnswer {
/** The new API key (`tn_key_…`): store it as a secret. */
access_token: string
/** Always `Bearer`. */
token_type: 'Bearer'
/** The scopes granted, space-separated. */
scope: string
/** Seconds until the key expires; absent for a key that never does. */
expires_in?: number
/** The key's id and name, as `/integrations` lists it. */
key_id: string
/** The key's name on `/integrations`. */
label: string
}RegistrationAnswer8 fields
/** RFC 7591 §3.2.1: what a registration answers. */
export interface RegistrationAnswer {
/** The id the client signs in with. */
client_id: string
/** When it was issued, epoch seconds. */
client_id_issued_at: number
/** The name it registered. */
client_name: string
/** Where sign-in may return. */
redirect_uris: string[]
/** Grants it may use (`authorization_code`). */
grant_types: ['authorization_code']
/** Response types (`code`). */
response_types: ['code']
/** Always `none`: a public client. */
token_endpoint_auth_method: 'none'
/** Its homepage, or absent. */
client_uri?: string
}Plans & quotas#
Plans and scopes#
| Plan | me:read (your data) |
market:read (/v1, /v2, /live) |
|---|---|---|
| Free | Yes | No |
| Pro | Yes | No |
| Ultra | Yes | Yes, fair use, included |
Fair use and 429#
Market data is fair use per account; the API answers 429 with code rate_limited
before anything breaks. 429 and 503 carry Retry-After (seconds): wait that long,
then retry. Nothing else is worth retrying: 400, 401, 403 and 404 will not
change.
Live freshness#
Live data is never stale: nothing older than 30 s is handed out as
current. A read of an asset nobody is watching starts its build and waits for full books,
up to 3.5 s; if none is ready it answers 503 with code warming and
Retry-After: 2. Each read keeps the asset warm for
30 s, so repeated reads answer at once. One account keeps at most
16 assets warm at a time (one more is 429).
Socket limits#
| Limit | Value |
|---|---|
| Sockets per key | 32 |
| Distinct topics per key | 16 |
| Sockets per account, across its keys | 32 |
| Book depth | 1 to 50 levels a side |
| Grant | 60 s, then close 4001: reconnect at once |
Over a limit, the socket is refused with 429 and Retry-After: 10.
Your data (/me)#
On this page
Your own portfolio, read with me:read on every plan; profiles can also be created
and changed with me:profiles. Each route answers what the app
shows you, for the key's owner only, and is never cached.
The portfolio routes take from and to (a date or an instant with a zone; default:
the last 24 hours) and profile (default: your default profile). Fills, funding and
transfers come a page at a time: pass meta.page.next_cursor back as cursor. When the
portfolio tracker is slow you get its last answer, flagged by the header
X-Portfolio-Last-Answer (synced_at=<instant>;stored_at=<instant>).
Create and change profiles#
With a key that has me:profiles (tick Create and edit profiles when you create
it), POST /me/profiles creates a profile and PATCH /me/profiles/{id} changes the
fields you send and keeps the rest. A rule list you send replaces that list. Profiles
are checked the same way as on the Portfolio page: an empty name, an unknown rule or
currency, or an unknown field is 400 with the reason. Keys without the scope get 403.
curl -X POST https://api.tribulnation.com/me/profiles \
-H "Authorization: Bearer $TN_KEY" -H 'Content-Type: application/json' \
-d '{"name": "Bot 1", "include": ["<account id>:*"]}'{
"data": {
"id": "bot-1",
"name": "Bot 1",
"description": "",
"include": ["<account id>:*"],
"exclude": [],
"builtin": false,
"default": false,
"created_at": "2026-11-29T10:00:00.000Z",
"updated_at": "2026-11-29T10:00:00.000Z",
"base_currency": null,
"value_collateral": false
},
"meta": { "as_of": "2026-11-29T10:00:00.000Z" }
}curl -X PATCH https://api.tribulnation.com/me/profiles/bot-1 \
-H "Authorization: Bearer $TN_KEY" -H 'Content-Type: application/json' \
-d '{"description": "VM 1"}'Rules are the Portfolio page's: <account>:* (every market of an account),
<account>:<exchange>[:<market>], asset:<id>, kind:perp or kind:spot; account ids
come from GET /me/accounts. A profile cannot be deleted, or made your
default, with a key: do that in the app.
GET/me
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/me"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
key = await t.me.get()// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const key = await t.me.get()Response 200recorded 2026-11-17
{
"data": {
"key": {
"id": "438b13ce-e623-444a-8063-2690230e726f",
"prefix": "pnY7XvN2",
"label": "docs recorder…",
"scopes": [
"me:read",
"market:read"
],
"source": "manual",
"created_at": "2026-11-17T16:45:21.092Z",
"expires_at": "2026-12-17T16:45:21.092Z"
},
"plan": "ultra",
"owner": "<scrubbed>",
"internal": false
},
"meta": {
"as_of": "2026-11-17T21:29:53.160Z"
}
}Response 200{ data: KeyIntrospection; meta: { as_of: string | null } }
dataKeyIntrospectionkey{ id: string; prefix: string; label: string; scopes: ('me:read' | 'me:profiles' | 'market:read')[]; source: 'manual' | 'device' | 'mcp'; created_at: string | null; expires_at: string | null }The key that made the request.plan'free' | 'pro' | 'ultra'The owner's plan: market data (market:read) needsultra.ownerstringThe owner's pseudonymous id.internalbooleanWhether the owner is staff (reads at Ultra).
meta{ as_of: string | null }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.
GET/me/accounts
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/me/accounts"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
accounts = await t.me.accounts()// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const accounts = await t.me.accounts()Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": {
"accounts": [],
"venues": [
{
"id": "dydx",
"name": "dYdX",
"icon_url": "https://catalogue.tribulnation.com/icons/asset/dydx.svg",
"stage": "stable",
"venue_type": "dex",
"kinds": [
"perp"
],
"capabilities": [
"candles",
"candles_mid",
"depth",
"equity_history",
"funding_rates",
"stream",
"trades"
],
"docs": [
"https://docs.dydx.xyz/indexer-client/http"
],
"credentials": {
"fields": [
{
"key": "address",
"label": "dYdX address",
"secret": false,
"required": true,
"help": "Your dYdX Chain address (dydx1...), shown in the dYdX app's account menu. Not the Ethereum address you connected with.",
"address": true,
"multiline": false
}
],
"not_collected": [
"mnemonic",
"private_key (signs trades)",
… 188 more lines: the whole answer is this operation’s example in /openapi.jsonResponse 200{ data: { accounts: AccountInfo[]; venues: VenueEntry[]; warnings: KeyWarning[]; default_profile: string }; meta: { as_of: string | null } }
data{ accounts: AccountInfo[]; venues: VenueEntry[]; warnings: KeyWarning[]; default_profile: string }accountsAccountInfo[]The user's accounts the collector has adopted, in configured order.venuesVenueEntry[]Every enabled venue, in configured order, with or without accounts.warningsKeyWarning[]The user's connections that need attention (expiring keys first).default_profilestringThe id of the profile the user opens by default.
meta{ as_of: string | null }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.
GET/me/profiles
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/me/profiles"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
profiles = await t.me.profiles()// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const profiles = await t.me.profiles()Response 200recorded 2026-11-17
{
"data": [
{
"id": "all",
"name": "All accounts",
"description": "Every account with credentials",
"include": [],
"exclude": [],
"builtin": true,
"default": true,
"created_at": null,
"updated_at": null,
"base_currency": null,
"value_collateral": false
},
{
"id": "evm",
"name": "EVM wallet",
"description": "Every EVM wallet exchange",
"include": [
"evm-9b1c90f93a:*"
],
"exclude": [],
"builtin": false,
"default": false,
"created_at": null,
"updated_at": null,
"base_currency": null,
"value_collateral": false
},
{
"id": "perps",
"name": "Perpetuals",
"description": "Perpetual exchanges only (no spot holdings)",
"include": [
"kind:perp"
],
"exclude": [],
"builtin": false,
"default": false,
… 10 more lines: the whole answer is this operation’s example in /openapi.jsonResponse 200{ data: ProfileInfo[]; meta: { as_of: string | null } }
dataProfileInfo[]idstringnamestringdescriptionstringincludestring[]excludestring[]builtinbooleanThe built-inallprofile (read-only).defaultbooleanThe profile the user opens by default (the Portfolio page without a profile in its link, and the portfolio summaries elsewhere in the Terminal).created_atstring | nullupdated_atstring | nullbase_currencystring | nullThe currency the profile's figures are shown in (lower-case code,eur); null: the reader's own (the app's Settings currency).value_collateralbooleanWhether the perp accounts' collateral coins are valued as their rates move (a stablecoin is never exactly 1), that drift counted in the P&L; false (the default): collateral counts at its value of each read.
meta{ as_of: string | null }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.
POST/me/profiles
#me:profiles).name (required), description, include and exclude (rules, as on the Portfolio page), base_currency (a three-letter code, or null for your Settings currency), value_collateral. Its id is made from the name. Answers 201 with the profile.curl -s -X POST https://api.tribulnation.com/me/profiles \
-H "Authorization: Bearer $TN_API_KEY" -H 'Content-Type: application/json' \
-d '{"name": "Bot 1", "include": ["kind:perp"]}'No recorded answer: none recorded yet.
Response 201{ data: ProfileInfo; meta: { as_of: string | null } }
dataProfileInfoidstringnamestringdescriptionstringincludestring[]excludestring[]builtinbooleanThe built-inallprofile (read-only).defaultbooleanThe profile the user opens by default (the Portfolio page without a profile in its link, and the portfolio summaries elsewhere in the Terminal).created_atstring | nullupdated_atstring | nullbase_currencystring | nullThe currency the profile's figures are shown in (lower-case code,eur); null: the reader's own (the app's Settings currency).value_collateralbooleanWhether the perp accounts' collateral coins are valued as their rates move (a stablecoin is never exactly 1), that drift counted in the P&L; false (the default): collateral counts at its value of each read.
meta{ as_of: string | null }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.
GET/me/portfolio
#profile is given).X-Portfolio-Last-Answer.curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/me/portfolio?from=2026-11-16"from datetime import date
from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
portfolio = await t.me.portfolio.get(start=date(2026, 11, 16))// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const portfolio = await t.me.portfolio.get({ start: '2026-11-16' })Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": {
"interval": "15m",
"positions_at": null,
"selection": {
"profile": "all",
"name": "All accounts",
"include": [],
"exclude": [],
"edited": false,
"exchanges": [],
"partial": [],
"excluded_markets": [],
"account_wide": []
},
"exchanges": [],
"accounts": [],
"account_equity": [],
"excluded_accounts": [],
"equity_history": {},
"summary": {
"pnl": "0",
"trading": "0",
"funding": "0",
"fees": "0",
"volume": "0",
"fills": 0,
"maker_share": 0,
"pnl_bps": 0,
"net_delta": "0",
"gross_notional": "0",
"perp_notional": "0",
"carry_hourly": "0",
"equity": "0",
"collateral": "0"
},
"by_exchange": [],
"series": {
"time": [
"2026-11-16T00:00:00.000Z",
… 73 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
from2026-11-10, its 00:00 UTC) or an instant with a zone (default: 24 hours before to).toprofile/me/profiles (default: your default profile).includeexcludeResponse 200{ data: { interval: '1m' | '5m' | '15m' | '1h' | '4h' | '1d'; positions_at: string | null; selection: Selection; exchanges: ExchangeMeta[]; accounts: AccountEquity[]; account_equity: AccountEquity[]; excluded_accounts: string[]; equity_history: { [key: string]: { time: string;
data{ interval: '1m' | '5m' | '15m' | '1h' | '4h' | '1d'; positions_at: string | null; selection: Selection; exchanges: ExchangeMeta[]; accounts: AccountEquity[]; account_equity: AccountEquity[]; excluded_accounts: string[]; equity_history: { [key: string]: { time: string; value: Decimal }[] }; summary: PortfolioSummary; by_exchange: ExchangeSummary[]; series: PortfolioSeries; delta_by_asset: DeltaSeries[]; assets: AssetRow[]; asset_options: AssetOption[]; fills: FillRow[]; transfers: TransferRow[]; asset_info: { [key: string]: AssetInfo }; prices_at: string | null; reference_prices: { [key: string]: string }; venue_prices: { [key: string]: VenuePrice }; no_price: NoPrice; collateral: { asset_id: string; symbol: string; qty: Decimal; price: Decimal; usd: Decimal; pnl: Decimal; exchanges: { [key: string]: Decimal } }[]; conns: { [key: string]: Conn }; next_sync_at: string | null }interval'1m' | '5m' | '15m' | '1h' | '4h' | '1d'Spacing of theseriesgrid, picked from the window's length.positions_atstring | nullOldest position snapshot of the selected exchanges (collector lag).selectionSelectionThe profile and the rules this answer covers.exchangesExchangeMeta[]Exchanges with data in the selection, in configured order.accountsAccountEquity[]Equity of the accounts with a selected bucket, over those buckets (the totals).account_equityAccountEquity[]Current equity of every account in the portfolio over all its buckets, whatever the profile (the Accounts tab).excluded_accountsstring[]Enabled accounts without credentials (not in the portfolio).equity_history{ [key: string]: { time: string; value: Decimal }[] }Exchange (bucket) -> equity points(t, equity)as the grid sees them: the bucket's first point in the window and its last at or before each grid point.summaryPortfolioSummaryWindow totals over the selection: P&L and its parts, volume, exposure, carry, equity.by_exchangeExchangeSummary[]The same totals per exchange, with its current exposure.seriesPortfolioSeriesP&L, equity and exposure over the window, one point perinterval.delta_by_assetDeltaSeries[]Net delta of the largest assets over the window, the rest as "Other".assetsAssetRow[]One row per asset held or traded: position per exchange, P&L parts, funding, volume and the legs behind it.asset_optionsAssetOption[]Assets with activity in the window on any exchange (what include and exclude rules can name).fillsFillRow[]The window's most recent fills, newest first (/me/portfolio/fillspages all of them).transfersTransferRow[]On-chain balance changes that are not trades (EVM wallets), newest first.asset_info{ [key: string]: AssetInfo }Display data (name, icon) of every asset in this response.prices_atstring | nullObservation time of the USD rates used (LiveHubrates); null: none read.reference_prices{ [key: string]: string }Assets of this answer valued now at their reference price (qualityaggregator) instead of a market rate, with when that price was observed: the views say "reference price, as of HH:MM".venue_prices{ [key: string]: VenuePrice }Assets of this answer valued now at their reference price (qualityaggregator) instead of a market rate, with when that price was observed (epoch ms): the views say "reference price, as of HH:MM".no_priceNoPriceWhat the totals leave out for lack of a USD rate.collateral{ asset_id: string; symbol: string; qty: Decimal; price: Decimal; usd: Decimal; pnl: Decimal; exchanges: { [key: string]: Decimal } }[]The coins the selected perp buckets hold as collateral now.conns{ [key: string]: Conn }Every connection of the user, by connection id.next_sync_atstring | nullWhen the running or nextaccountspass over the user's syncing connections ends; null: none syncs (none, or all read-only).
meta{ as_of: string | null; range?: { from: string; to: string } }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.rangeoptional{ from: string; to: string }The half-open window the answer covers.
GET/me/portfolio/summary
#/me/portfolio without assets, fills, series or transfers, cheap to poll.curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/me/portfolio/summary?profile=dydx"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
summary = await t.get('/me/portfolio/summary', profile='dydx')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const summary = await t.me.portfolio.summary({ profile: 'dydx' })Response 200recorded 2026-11-29
{
"data": {
"positions_at": "2026-11-29T21:06:06.774Z",
"selection": {
"profile": "dydx",
"name": "dYdX",
"include": [
"dydx-75eabf8a06:*"
],
"exclude": [],
"edited": false,
"exchanges": [
"dydx-75eabf8a06:perp"
],
"partial": [],
"excluded_markets": [],
"account_wide": []
},
"summary": {
"pnl": "270.41311342884705",
"trading": "273.16790349999724",
"funding": "-2.5208305969945908",
"fees": "0.23395947415560914",
"volume": "623.9266",
"fills": 33,
"maker_share": 0,
"pnl_bps": 4334.05329134624,
"net_delta": "29839.22045",
"gross_notional": "29839.22045",
"perp_notional": "29839.22045",
"carry_hourly": "-0.07341818169045444",
"equity": "5695.095702263747",
"collateral": "0",
"leverage": 5.23945900296973,
"min_liq_distance": null,
"free_collateral": "3609.2961367985054",
"maintenance_margin": "1076.0228439285215",
"carry_daily_usd": "-1.7620363605709066"
},
"accounts": [
… 53 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
from2026-11-10, its 00:00 UTC) or an instant with a zone (default: 24 hours before to).toprofile/me/profiles (default: your default profile).Response 200{ data: { positions_at: string | null; selection: Selection; summary: SelectionSummary; accounts: AccountEquity[]; conns: { [key: string]: Conn }; next_sync_at: string | null; oldest_synced_at: string | null; warnings: KeyWarning[] }; meta: { as_of: str
data{ positions_at: string | null; selection: Selection; summary: SelectionSummary; accounts: AccountEquity[]; conns: { [key: string]: Conn }; next_sync_at: string | null; oldest_synced_at: string | null; warnings: KeyWarning[] }positions_atstring | nullOldest position snapshot of the selected exchanges (collector lag).selectionSelectionThe profile and the rules this answer covers.summarySelectionSummaryaccountsAccountEquity[]The accounts with a selected bucket: equity over those buckets, andexposureover the selection's markets.conns{ [key: string]: Conn }The selection's connections, by id: last sync, status, read-only.next_sync_atstring | nullWhen the running or next pass over the user's syncing connections ends.oldest_synced_atstring | nullThe oldest last sync of the selection's connections;None: one of them never synced, or none is selected.warningsKeyWarning[]The selection's connections that need attention.
meta{ as_of: string | null; range?: { from: string; to: string } }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.rangeoptional{ from: string; to: string }The half-open window the answer covers.
GET/me/portfolio/pnl-days
#days days (default 30).Retry-After: ask again then.curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/me/portfolio/pnl-days?days=3&profile=dydx"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
pnl_days = await t.get('/me/portfolio/pnl-days', days=3, profile='dydx')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const pnlDays = await t.me.portfolio.pnlDays({ days: 3, profile: 'dydx' })Response 200recorded 2026-11-29
{
"data": {
"stale": false,
"days": [
{
"date": "2026-11-26",
"pnl": "67.22934453361957",
"trading": "77.46017599999323",
"funding": "-10.001502499548764",
"fees_paid": "0.22932896682489812",
"equity_close": "5613.598864278257",
"partial": false
},
{
"date": "2026-11-27",
"pnl": "130.84194648835506",
"trading": "139.68719324999984",
"funding": "-7.2176806847946295",
"fees_paid": "1.6275660768501474",
"equity_close": "5810.41113102682",
"partial": false
},
{
"date": "2026-11-28",
"pnl": "-321.147288210026",
"trading": "-319.37959425000736",
"funding": "-1.4786948948679708",
"fees_paid": "0.2889990651506764",
"equity_close": "5483.9993086411505",
"partial": false
},
{
"date": "2026-11-29",
"pnl": "200.0555436226107",
"trading": "202.71738350000192",
"funding": "-2.427880403235605",
"fees_paid": "0.23395947415560903",
"equity_close": "5682.622634653857",
"partial": true
}
… 10 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
daysprofile/me/profiles (default: your default profile).Response 200{ data: { stale: boolean; days: PnlDay[] }; meta: { as_of: string | null; range?: { from: string; to: string } } }
meta{ as_of: string | null; range?: { from: string; to: string } }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.rangeoptional{ from: string; to: string }The half-open window the answer covers.
GET/me/portfolio/asset
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/me/portfolio/asset?asset=bitcoin&from=2026-11-16"from datetime import date
from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
asset = await t.me.portfolio.asset('bitcoin', start=date(2026, 11, 16))// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const asset = await t.me.portfolio.asset('bitcoin', { start: '2026-11-16' })Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": {
"asset_id": "bitcoin",
"symbol": "BTC",
"info": {
"id": "bitcoin",
"symbol": "BTC",
"name": "Bitcoin",
"icon_url": "https://catalogue.tribulnation.com/icons/asset/bitcoin.svg",
"category": "crypto",
"provisional": false
},
"markets": {
"dydx:perp": "BTC-USD"
},
"reference": "dydx:perp",
"time": [
"2026-11-16T00:00:00.000Z",
"2026-11-16T00:15:00.000Z",
"2026-11-16T00:30:00.000Z"
],
"price": {
"dydx:perp": [
"65338",
"65080.5",
"64980"
]
},
"basis_bps": {},
"pos": {},
"net": [
"0",
"0",
"0"
],
"pnl": [
"0",
"0",
"0"
],
… 51 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
assetrequiredbitcoin) or symbol.from2026-11-10, its 00:00 UTC) or an instant with a zone (default: 24 hours before to).toprofile/me/profiles (default: your default profile).includeexcludeResponse 200{ data: AssetDetail; meta: { as_of: string | null } }
dataAssetDetailasset_idstringsymbolstringinfoAssetInfomarkets{ [key: string]: string }Exchange -> market, for the exchanges charted.referencestring | nullExchange whose price marks the asset (P&L).timestring[]price{ [key: string]: (Decimal | null)[] }USD price per grid point on each exchange (per base unit): stored quote mids, candles where the collector has none (PortfolioReader.prices), at the quote's rate then;Nonewhere either is missing.basis_bps{ [key: string]: (number | null)[] }Each other exchange's price over the reference's, minus one, in bps.pos{ [key: string]: Decimal[] }netDecimal[]pnlDecimal[]tradingDecimal[]fundingDecimal[]feesDecimal[]fills{ [key: string]: FillPoint[] }funding_rates{ [key: string]: { time: string; value: number }[] }Annualized funding rate history(t, rate)per perp exchange (its asset market there;market_lineshas every market of an exchange with several).market_linesMarketLine[]Every market holding or trading the asset (the By market table's rows), in exchange order: an exchange'sposis the sum of its lines'.price_onlystring[]Exchanges ofpriceno market line repeats (the reference, an active venue where nothing is held): drawn for their price beside the market lines.prices_atstring | nullObservation time of the unified rates used;None: none read.reference_prices{ [key: string]: string }Assets of this answer valued now at their reference price (qualityaggregator) instead of a market rate, with when that price was observed: the views say "reference price, as of HH:MM".venue_prices{ [key: string]: VenuePrice }The asset, when valued now at a venue price, with that market.no_priceNoPricepriced_from_atoptionalstring | nullWhen the asset is valued from, when after the window start; its money series are 0 before.None: from the start (or not valued).conns{ [key: string]: Conn }next_sync_atstring | null
meta{ as_of: string | null }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.
GET/me/portfolio/fills
#next is the following page’s cursor, which keeps the first page’s window; format=csv answers all of them.curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/me/portfolio/fills?from=2026-11-10"from datetime import date
from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
fills = await t.get('/me/portfolio/fills', **{'from': date(2026, 11, 10)})// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const fills = await t.me.portfolio.fills({ start: '2026-11-10' })Response 200recorded 2026-11-17
{
"data": [],
"meta": {
"as_of": "2026-11-17T21:29:53.944Z",
"range": {
"from": "2026-11-10T00:00:00.000Z",
"to": "2026-11-17T21:29:53.873Z"
},
"page": {
"limit": 200,
"has_more": false,
"next_cursor": null,
"total": 0
},
"assets": {}
}
}Parameters
from2026-11-10, its 00:00 UTC) or an instant with a zone (default: 24 hours before to).toprofile/me/profiles (default: your default profile).includeexcludeassetsaccountsmarketssegmentsbinance:usdm), comma-separated.sidebuy (received, in) or sell (paid, out).searchcursormeta.page.next_cursor; it keeps the first page's window.limitformatcsv: every matching row of the window, no paging.Response 200{ data: FillRow[]; meta: { as_of: string | null; range?: { from: string; to: string }; page?: { limit: number; has_more: boolean; next_cursor: string | null; total?: number }; assets?: Record<string, unknown> } }
dataFillRow[]timestring | nullsegment_idstringasset_idstringsymbolstringmarketstringmarket_symbolstringVenue display symbol of the market (BTCfor Lighter market1).qtyDecimalpriceDecimalUSD per base unit at the rate of the fill time of the asset its notional is in: its quote, a quanto perpetual's settlement (qty x priceis the notional).notionalDecimalfeeDecimalUSD paid (negative for rebates) at the rate of the fill time; 0 whenfee_in_assetholds it.makerbooleansubaccountstring | nullThe venue subaccount of the fill (dYdX: its number), elseNone.trade_idstring | nullThe venue's own id of the fill (trade, execution or match id), as it reports it; null: the venue reports none, or the fill was stored before these ids were kept.order_idstring | nullThe venue's id of the order the fill executed; null as fortrade_id.client_order_idstring | nullThe client order id the order was placed with, where the venue reports one; null otherwise.fee_in_assetFeeInAsset | nullThe fee in its own asset when it had no USD rate at fill time; null:feeis USD.price_in_assetstring | nullThe assetpriceandnotionalare in, as quoted, when that quote had no USD rate at fill time (the fill's asset is then counted inno_price.assets); null: they are USD at the quote's rate of the fill time.routeRouteInfo | nullWhere an on-chain swap happened (EVM wallets); null: a venue fill.liquidationoptionalbooleanForced by the venue at liquidation: a position closed by its liquidation engine, or collateral sold and a borrowed coin bought back to repay a margin debt; absent: not.quantoQuantoQuote | nullA quanto perpetual's fill as the venue reports it (pricein its quote, the notional in its settlement); null: not a quanto perpetual.
meta{ as_of: string | null; range?: { from: string; to: string }; page?: { limit: number; has_more: boolean; next_cursor: string | null; total?: number }; assets?: Record<string, unknown> }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.rangeoptional{ from: string; to: string }The half-open window the answer covers.pageoptional{ limit: number; has_more: boolean; next_cursor: string | null; total?: number }Where this page is: passnext_cursorback ascursor(null: the last page).assetsoptionalRecord<string, unknown>The assets the answer names, by id.
GET/me/portfolio/funding
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/me/portfolio/funding?from=2026-11-10"from datetime import date
from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
funding = await t.get('/me/portfolio/funding', **{'from': date(2026, 11, 10)})// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const funding = await t.me.portfolio.funding({ start: '2026-11-10' })Response 200recorded 2026-11-17
{
"data": [],
"meta": {
"as_of": "2026-11-17T21:29:54.024Z",
"range": {
"from": "2026-11-10T00:00:00.000Z",
"to": "2026-11-17T21:29:53.956Z"
},
"page": {
"limit": 200,
"has_more": false,
"next_cursor": null,
"total": 0
},
"assets": {}
}
}Parameters
from2026-11-10, its 00:00 UTC) or an instant with a zone (default: 24 hours before to).toprofile/me/profiles (default: your default profile).includeexcludeassetsaccountsmarketssegmentsbinance:usdm), comma-separated.sidebuy (received, in) or sell (paid, out).searchcursormeta.page.next_cursor; it keeps the first page's window.limitformatcsv: every matching row of the window, no paging.Response 200{ data: FundingPayment[]; meta: { as_of: string | null; range?: { from: string; to: string }; page?: { limit: number; has_more: boolean; next_cursor: string | null; total?: number }; assets?: Record<string, unknown> } }
dataFundingPayment[]timestring | nullsegment_idstringasset_idstringsymbolstringmarketstringmarket_symbolstringamountDecimalUSD received (+) or paid (-) at its settlement asset's rate then; as paid whenamount_in_assetis set.amount_in_assetstring | nullSymbol of the assetamountis in when it had no USD rate then;None: USD.settlement_symbolstring | nullSymbol of the asset the payment was settled in (USDCfor HyperliquidBTC): the market's settlement asset;None: not known.borrowoptionalDecimalOfamount, the venue's borrowing fee, valued alike; absent where the venue splits none out.dividendoptionalnumberOfamount, an equity perpetual's dividend adjustment, valued alike; absent where the payment is regular funding.bonusoptionalnumberOfamount, a loss-refund bonus the venue credited, valued alike; absent where the payment is regular funding.
meta{ as_of: string | null; range?: { from: string; to: string }; page?: { limit: number; has_more: boolean; next_cursor: string | null; total?: number }; assets?: Record<string, unknown> }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.rangeoptional{ from: string; to: string }The half-open window the answer covers.pageoptional{ limit: number; has_more: boolean; next_cursor: string | null; total?: number }Where this page is: passnext_cursorback ascursor(null: the last page).assetsoptionalRecord<string, unknown>The assets the answer names, by id.
GET/me/portfolio/transfers
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/me/portfolio/transfers?from=2026-11-10"from datetime import date
from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
transfers = await t.get('/me/portfolio/transfers', **{'from': date(2026, 11, 10)})// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const transfers = await t.me.portfolio.transfers({ start: '2026-11-10' })Response 200recorded 2026-11-17
{
"data": [],
"meta": {
"as_of": "2026-11-17T21:29:54.131Z",
"range": {
"from": "2026-11-10T00:00:00.000Z",
"to": "2026-11-17T21:29:54.036Z"
},
"page": {
"limit": 200,
"has_more": false,
"next_cursor": null,
"total": 0
},
"assets": {}
}
}Parameters
from2026-11-10, its 00:00 UTC) or an instant with a zone (default: 24 hours before to).toprofile/me/profiles (default: your default profile).includeexcludeassetsaccountsmarketssegmentsbinance:usdm), comma-separated.sidebuy (received, in) or sell (paid, out).searchcursormeta.page.next_cursor; it keeps the first page's window.limitformatcsv: every matching row of the window, no paging.Response 200{ data: TransferRow[]; meta: { as_of: string | null; range?: { from: string; to: string }; page?: { limit: number; has_more: boolean; next_cursor: string | null; total?: number }; assets?: Record<string, unknown> } }
dataTransferRow[]timestring | nullsegment_idstringasset_idstringsymbolstringtoken_symbolstringThe token's own symbol (WPRLfor Pearl).qtyDecimalSigned base units: + in, - out.usdDecimal | nullAt the asset's rate then; null: no rate.routeRouteInfo
meta{ as_of: string | null; range?: { from: string; to: string }; page?: { limit: number; has_more: boolean; next_cursor: string | null; total?: number }; assets?: Record<string, unknown> }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.rangeoptional{ from: string; to: string }The half-open window the answer covers.pageoptional{ limit: number; has_more: boolean; next_cursor: string | null; total?: number }Where this page is: passnext_cursorback ascursor(null: the last page).assetsoptionalRecord<string, unknown>The assets the answer names, by id.
GET/me/position
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/me/position?asset=bitcoin"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
position = await t.me.position('bitcoin')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const position = await t.me.position('bitcoin')Response 200recorded 2026-11-17
{
"data": {
"position": null,
"labels": {},
"profile": {
"id": "all",
"name": "All accounts"
},
"currency": "usd",
"note": null
},
"meta": {
"as_of": "2026-11-17T21:29:54.270Z"
}
}Parameters
assetrequiredbitcoin) or symbol.Response 200{ data: PositionAnswer; meta: { as_of: string | null } }
dataPositionAnswerposition{ symbol: string; asset_id: string; funding: Decimal; price: Decimal | null; fees: Decimal; net: Decimal | null; net_usd: Decimal; pos: { [key: string]: Decimal }; pnl: Decimal; trading: Decimal } | nullThe asset's net position, P&L, funding and fees (null: you hold none).labels{ [key: string]: string }Exchange id to its display name, for the exchanges the position names.profile{ id: string; name: string } | nullThe profile the figures cover (the reader's default).currency'usd' | 'eur' | 'gbp' | 'jpy' | 'chf' | 'cad' | 'aud' | 'nzd' | 'cny' | 'hkd' | 'sgd' | 'krw' | 'inr' | 'idr' | 'myr' | 'php' | 'thb' | 'sek' | 'nok' | 'dkk' | 'isk' | 'pln' | 'czk' | 'huf' | 'ron' | 'try' | 'ils' | 'aed' | 'zar' | 'brl' | 'mxn' | 'ars'The currency the figures are in: the reader's, or USD without a rate.notestring | nullSaid under the figures, or null.
meta{ as_of: string | null }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.
GET/me/charts
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/me/charts"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
charts = await t.me.charts.list()// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const charts = await t.me.charts.list()Response 200recorded 2026-11-17
{
"data": [],
"meta": {
"as_of": "2026-11-17T21:29:54.352Z"
}
}Response 200{ data: SavedPlot[]; meta: { as_of: string | null } }
dataSavedPlot[]idstringThe chart's id (16 letters and digits).namestringIts name.kind'history' | 'earn' | 'depth' | 'index'What it plots.configHistoryConfig | DepthConfig | IndexConfig | EarnConfig | nullIts settings, ornullfor the kind's defaults.created_atstring | nullWhen it was saved.updated_atstring | nullWhen it last changed.ownerbooleanWhether the key's owner made it (else it was shared).
meta{ as_of: string | null }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.
GET/me/charts/{id}
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/me/charts/AbCdEfGh12345678"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
chart = await t.me.charts.get('AbCdEfGh12345678')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const chart = await t.me.charts.get('AbCdEfGh12345678')No recorded answer: none recorded yet.
Parameters
idrequiredpathResponse 200{ data: { plot: SavedPlot }; meta: { as_of: string | null } }
meta{ as_of: string | null }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.
PATCH/me/profiles/{id}
#me:profiles).me:profiles): only the fields given (those of creating one), the rest kept. Its id stays; the built-in all cannot be changed. Answers the profile.curl -s -X PATCH https://api.tribulnation.com/me/profiles/bot-1 \
-H "Authorization: Bearer $TN_API_KEY" -H 'Content-Type: application/json' \
-d '{"description": "VM 1"}'No recorded answer: none recorded yet.
Parameters
idrequiredpathGET /me/profiles.Response 200{ data: ProfileInfo; meta: { as_of: string | null } }
dataProfileInfoidstringnamestringdescriptionstringincludestring[]excludestring[]builtinbooleanThe built-inallprofile (read-only).defaultbooleanThe profile the user opens by default (the Portfolio page without a profile in its link, and the portfolio summaries elsewhere in the Terminal).created_atstring | nullupdated_atstring | nullbase_currencystring | nullThe currency the profile's figures are shown in (lower-case code,eur); null: the reader's own (the app's Settings currency).value_collateralbooleanWhether the perp accounts' collateral coins are valued as their rates move (a stablecoin is never exactly 1), that drift counted in the P&L; false (the default): collateral counts at its value of each read.
meta{ as_of: string | null }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.
Types 44
KeyIntrospection4 fields
/** What a key is: its scopes, expiry and the owner's plan. */
export interface KeyIntrospection {
/** The key that made the request. */
key: {
id: string
prefix: string
label: string
scopes: ('me:read' | 'me:profiles' | 'market:read')[]
source: 'manual' | 'device' | 'mcp'
created_at: string | null
expires_at: string | null
}
/** The owner's plan: market data (`market:read`) needs `ultra`. */
plan: 'free' | 'pro' | 'ultra'
/** The owner's pseudonymous id. */
owner: string
/** Whether the owner is staff (reads at Ultra). */
internal: boolean
}AccountInfo9 fields
/** An enabled account. */
export interface AccountInfo {
account: string
venue_id: string
/** The venue's title, plus the account's label, or its id where the user has other accounts on the venue (`Config.account_title`. … */
name: string
icon_url: string | null
/** In the portfolio (its credentials resolve an identity). */
included: boolean
/** The name its owner gave the connection; `None`: none. */
label: string | null
/** The account the connection reads, as the venue names it. … */
identity: string | null
/** `address` (a wallet address) or `account_id` (an index, uid or number). */
identity_kind: 'address' | 'account_id' | null
/** The sub-account's name where the connection is one its parent's discovery found (a Hyperliquid sub-account). … */
subaccount: string | null
}VenueEntry15 fields
/** An enabled venue: its module's stage, capabilities and credentials entry, and whether an account is connected. */
export interface VenueEntry {
id: string
name: string
icon_url: string | null
stage: 'beta' | 'stable'
/** `cex` or `dex` (`VenueInfo.venue_type`). */
venue_type: 'cex' | 'dex' | null
kinds: string[]
/** Optional parts the module implements (`stream`, `funding_rates`, `candles`, `equity_history`,...). … */
capabilities: string[]
docs: string[]
credentials: CredentialsInfo
/** Sub-account discovery (`VenueInfo.subaccounts`). … */
subaccounts: 'separate' | 'included' | null
/** Connections need a paid plan (`VenueInfo.paid`: EVM wallets). */
paid: boolean
/** A wallet read by address across chains (`VenueInfo.wallet`): listed apart from the trading venues. */
wallet: boolean
/** The user's connections on the venue (their ids). */
accounts: string[]
status: 'connected' | 'needs_key' | 'public_only'
/** The beta review of the module: its latest daily report. */
review: ReviewInfo
}CredentialsInfo9 fields
/** A venue's credentials catalogue entry (`CredentialSpec`): what the connect flow asks for and tells the user. */
export interface CredentialsInfo {
/** Empty: the venue reads no accounts yet (public data only). */
fields: CredentialFieldInfo[]
/** Credentials never asked for (signing keys). */
not_collected: string[]
/** How to create a read-only key. */
steps: string[]
/** What makes a key unacceptable (it can trade or withdraw). */
permissions_to_reject: string[]
expiry: string | null
docs: string[]
/** Whether the venue lets Terminal verify a key's permissions. … */
permissions_verifiable: boolean
/** What to tell the user about keys Terminal cannot verify. … */
permissions_warning: string | null
/** Why every key of the venue is refused, for a reason other than unverifiable permissions. … */
refused: string | null
}CredentialFieldInfo7 fields
/** One field a connection collects (named as the SDK account field). */
export interface CredentialFieldInfo {
key: string
label: string
secret: boolean
required: boolean
help: string
/** A public address (shown in full once stored). */
address: boolean
/** A value with line breaks (a PEM key): a text area, line breaks kept. */
multiline: boolean
}ReviewInfo4 fields
export interface ReviewInfo {
/** Day of its latest daily report. */
last_report: string | null
/** That report's status. */
status: 'pass' | 'fail' | 'warn' | 'skip' | null
/** Open findings: failing and warning findings of the latest report. */
findings: number
/** Reports with a failing invariant among the last seven finished days. */
failures_7d: number
}KeyWarning7 fields
/** A connection that needs attention. … */
export interface KeyWarning {
connection: string
venue_id: string
/** The connection's name (`display_name`). */
name: string
kind: 'suspended' | 'expired' | 'expiring' | 'error'
/** For a suspended key: `permissions` (it can do more than read) or `invalid` (the venue rejects it: replace it). */
cause: 'permissions' | 'invalid' | null
expires_at: string | null
message: string
}ProfileInfo11 fields
/** A profile on the wire. */
export interface ProfileInfo {
id: string
name: string
description: string
include: string[]
exclude: string[]
/** The built-in `all` profile (read-only). */
builtin: boolean
/** The profile the user opens by default (the Portfolio page without a profile in its link, and the portfolio summaries elsewhere in the Terminal). */
default: boolean
created_at: string | null
updated_at: string | null
/** The currency the profile's figures are shown in (lower-case code, `eur`). … */
base_currency: string | null
/** Whether the perp accounts' collateral coins are valued as their rates move (a stablecoin is never exactly 1), that drift counted in the P&L. … */
value_collateral: boolean
}Selection9 fields
/** What a response covers: a profile's rules, maybe edited. */
export interface Selection {
/** Profile id (`all` is built in). */
profile: string
/** The profile's display name. */
name: string
/** Include rules in effect (empty: every market). */
include: string[]
/** Exclude rules in effect. */
exclude: string[]
/** Whether the rules in effect differ from the stored profile's (unsaved edits). */
edited: boolean
/** P&L exchanges with any selected market, in configured order. */
exchanges: string[]
/** Of `exchanges`, those where the rules leave out markets with account data. */
partial: string[]
/** Full market ids with account data (positions, fills, funding) that an exclude rule removes. */
excluded_markets: string[]
/** Accounts whose equity and margin are shown although the rules leave some of their markets out. … */
account_wide: string[]
}ExchangeMeta8 fields
/** A P&L exchange. */
export interface ExchangeMeta {
id: string
label: string
account: string
venue_id: string
kind: 'perp' | 'spot'
/** Venue icon URL (catalogue CDN). */
icon_url: string | null
/** Chart color slot (`--s<slot>`; `None`: the shared other color). */
slot: number | null
/** Name shown on the venue icon (a HIP-3 dex, `spot`), if any. */
badge: string | null
}AccountEquity4 fields
/** Equity of one account over its selected buckets. */
export interface AccountEquity {
account: string
equity: Decimal
buckets: BucketState[]
/** Open notional and leverage. */
exposure?: AccountExposure
}BucketState7 fields
/** Margin state of one account bucket (an exchange of an account). */
export interface BucketState {
segment_id: string
equity: Decimal
free_collateral: Decimal
initial_margin: Decimal
maintenance_margin: Decimal
maintenance_ratio: number
leverage: number
}AccountExposure14 fields
/** An account's open notional and leverage now. */
export interface AccountExposure {
/** Gross USD notional: open perpetual legs, each at its own quote's rate, plus margin borrows. */
notional: Decimal
/** USD notional of the long perpetual legs. */
long: Decimal
/** USD notional of the short perpetual legs (positive). */
short: Decimal
/** USD value of spot balances below zero (margin borrows). */
borrowed: Decimal
/** Open perpetual legs (one per market) counted in `notional`. */
positions: number
/** Legs of `positions` the venue reports as cross-margined. … */
cross: number
/** Equity of every bucket in USD (collateral incl. unrealized P&L, spot holdings); `None`: no collateral read. */
equity: Decimal | null
/** Equity of its perpetual buckets alone (what margins the perps); `None`: none. */
margin_equity: Decimal | null
/** `notional / equity`; `None` with `missing` saying why. */
leverage: number | null
/** Perpetual notional over the perpetual buckets' equity, where the account holds spot beside them. */
margin_leverage: number | null
missing: 'flat' | 'no_collateral' | 'no_equity' | 'unpriced' | null
/** `exchange|market` of legs valued at their asset's rate (no mark or quote rate). */
estimated: string[]
/** `exchange|market` of legs left out: no rate of any kind. */
unpriced: string[]
isolated: IsolatedLeg[]
}IsolatedLeg5 fields
/** An isolated-margin position: its own notional over its own margin. */
export interface IsolatedLeg {
segment_id: string
market: string
/** Gross USD notional of the position. */
notional: Decimal
/** Its margin in USD; `None`: not reported. */
margin: Decimal | null
/** `notional / margin`, else as the venue states it; `None`: neither. */
leverage: number | null
}PortfolioSummary17 fields
/** Window totals over the selection. */
export interface PortfolioSummary {
/** P&L over the window in USD, every part together: trading, funding, fees and (where valued) collateral. */
pnl: Decimal
/** P&L from price moves on the positions held and traded. */
trading: Decimal
/** Funding received (+) or paid (−) on perp positions. */
funding: Decimal
/** Of `funding`, the borrowing fees. */
borrow?: Decimal
/** Of `funding`, the equity-perp dividend adjustments. */
dividend?: number
/** Of `funding`, the loss-refund bonuses. */
bonus?: number
/** Trading fees paid in the window, positive when paid (a maker rebate counts negative). … */
fees: Decimal
/** USD volume traded in the window. */
volume: Decimal
/** Fills in the window. */
fills: number
/** Fraction of the volume filled as maker. */
maker_share: number
/** Total P&L over total volume, in basis points. */
pnl_bps: number
/** Current net exposure in quote units. */
net_delta: Decimal
/** Current gross position value: every leg's notional, long and short. */
gross_notional: Decimal
/** Gross notional of the legs that pay or earn funding (spot legs aside). … */
perp_notional: Decimal
/** Expected funding income per hour at current rates and positions. */
carry_hourly: Decimal
/** Equity of the selected buckets. */
equity: Decimal
/** What the perp buckets' collateral coins made as their USD rates moved. */
collateral: Decimal
}ExchangeSummary13 fields
/** Window totals and current exposure of one exchange. */
export interface ExchangeSummary {
segment_id: string
volume: Decimal
maker_volume: Decimal
/** Fraction of the volume filled as maker. */
maker_share: number
/** Trading fees paid in the window, positive when paid (`Summary.fees`). */
fees: Decimal
funding: Decimal
/** Of `funding`, the borrowing fees the venue splits out. */
borrow?: Decimal
/** Of `funding`, the equity-perp dividend adjustments the venue books apart. */
dividend?: number
/** Of `funding`, the venue's loss-refund bonuses. */
bonus?: number
/** Fills in the window, valued or not (a count needs no rate. … */
fills: number
/** Signed position value now. */
net_usd: Decimal
gross: Decimal
carry_hourly: Decimal
}PortfolioSeries16 fields
/** Aligned time series over the window grid. */
export interface PortfolioSeries {
time: string[]
pnl: Decimal[]
trading: Decimal[]
funding: Decimal[]
/** Cumulative fees as a P&L contribution (negative when paying). */
fees: Decimal[]
/** Cumulative revaluation of the collateral coins (`Summary.collateral`. … */
collateral: Decimal[]
/** USD held by the selected buckets at each grid point (their equity). … */
equity: Decimal[]
net_delta: Decimal[]
gross_notional: Decimal[]
/** Exchange -> cumulative funding. */
funding_by: { [key: string]: Decimal[] }
/** Exchange -> cumulative borrowing fees, part of `funding_by`. … */
borrow_by?: { [key: string]: Decimal[] }
/** Exchange -> cumulative equity-perp dividend adjustments, part of `funding_by`. … */
dividend_by?: { [key: string]: number[] }
/** Exchange -> cumulative loss-refund bonuses, part of `funding_by`. … */
bonus_by?: { [key: string]: number[] }
/** Exchange -> signed position value. */
notional_by: { [key: string]: Decimal[] }
/** Exchange -> what its positions are worth, each asset's as a magnitude and none under `HELD_DUST` (`daily.held_value` on this grid). … */
held_by?: { [key: string]: number[] }
/** Exchange -> volume traded in the bucket ending at `t`. */
volume_by: { [key: string]: Decimal[] }
}DeltaSeries3 fields
/** Net delta of one asset (or "Other") over the window. */
export interface DeltaSeries {
asset_id: string
symbol: string
values: Decimal[]
}AssetRow27 fields
/** Per-asset breakdown. */
export interface AssetRow {
asset_id: string
symbol: string
/** Exchange -> market of the asset there (where listed or traded). */
markets: { [key: string]: string }
/** Exchange -> markets with a position now or fills in the window. */
held: { [key: string]: string[] }
/** Current USD price; `None`: none (an unpriced asset, or one without a current rate. … */
price: Decimal | null
/** Exchange -> current position, base units (exchanges with activity only). */
pos: { [key: string]: Decimal }
/** Net delta, base units, summed over every market; `None`: one leg's is not known. */
net: Decimal | null
net_usd: Decimal
/** Gross notional across exchanges. */
notional: Decimal
trading: Decimal
funding: Decimal
funding_by: { [key: string]: Decimal }
/** Of `funding`, the equity-perp dividend adjustments. */
dividend?: number
/** Of `funding`, the loss-refund bonuses. */
bonus?: number
fees: Decimal
pnl: Decimal
volume: Decimal
volume_by: { [key: string]: Decimal }
fills: number
/** Total P&L over volume, in basis points. */
edge_bps: number
/** Exchange -> current funding, annualized (perps listing the asset). */
rates: { [key: string]: number }
carry_hourly: Decimal
/** Why the row reads differently (`NO_PRICE`), if it does. */
note: string | null
/** When the asset is valued from, when after the window start. … */
priced_from_at?: string | null
/** Exchange -> subaccount -> current position, base units, where the venue reports the position per subaccount (dYdX). … */
subaccounts: { [key: string]: { [key: string]: Decimal } }
/** Perp exchanges whose share of `net_usd` and `notional` is size x the asset's rate, for lack of a mark or of its quote's rate. … */
exposure_at_asset_rate: string[]
/** Every market of the asset with a position now or activity in the window: the row's figures are their sums. */
legs: MarketLeg[]
}MarketLeg24 fields
/** One market an asset is held or traded on. … */
export interface MarketLeg {
segment_id: string
/** Native market id. */
market: string
/** Venue display symbol. */
symbol: string
/** What its prices are quoted in (`USDC`, `USDT`, `USD`), as the pricer labels it. … */
quote_symbol: string | null
/** A perpetual's settlement (margin) currency (`USDC` for dYdX `BTC-USD`); null: spot, or unknown. */
settlement_symbol: string | null
/** Current position, base units. */
pos: Decimal
/** Net delta, base units: `pos`, a quanto perpetual's in units of its price; `None`: not known. */
delta: Decimal | null
net_usd: Decimal
notional: Decimal
/** Funding received on this market in the window. */
funding: Decimal
fees: Decimal
volume: Decimal
fills: number
/** The funding rate the venue publishes for its next settlement (at `next_funding_at`). … */
rate: number | null
carry_hourly: Decimal
/** The interval between its settlements, what `rate` and `settled_rate` are annualized from. … */
funding_interval_s?: number | null
/** When the settlement `rate` predicts falls (`/me`: ISO); `None`: spot, or the live feed does not say. */
next_funding_at?: string | null
/** The rate of its last settlement, annualized at `funding_hours`, a fraction. … */
settled_rate?: number | null
/** When that settlement was (`/me`: ISO); `None` or absent: none found. */
settled_at?: string | null
/** Its price now, in `quote_symbol` (a perp's mark, else index or mid, as recorded with the position). … */
mark?: Decimal | null
/** USD per unit of what `value_quote` is in (the quote. … */
quote_usd?: Decimal | null
/** `pos` x `mark`, in `quote_symbol` (a quanto's in its settlement asset). */
value_quote?: Decimal | null
/** A perpetual whose `net_usd` is size x the asset's USD price, for lack of a mark or a quote rate. … */
valued_at_asset_rate?: boolean
/** Margin and liquidation where the venue reports them; `None` elsewhere. */
risk?: LegRisk | null
}LegRisk8 fields
/** A leg's margin and liquidation where its venue reports them. */
export interface LegRisk {
/** Average entry price, in the leg's `quote_symbol`. */
entry: Decimal | null
/** Estimated liquidation price, in the leg's `quote_symbol`; `None`: none reported. */
liq_px: Decimal | null
/** `(liq_px - mark) / mark`, a fraction (negative for a long, positive for a short). */
liq_distance: number | null
/** `cross` or `isolated`. */
margin_mode: string | null
/** Margin of this position, in the leg's `settlement_symbol` asset. */
margin: Decimal | null
/** `margin` in USD at the settlement asset's current rate. */
margin_usd: Decimal | null
leverage: number | null
/** `venue`: as the venue states it; `computed`: from its margin rules. */
source: string
}AssetOption2 fields
/** An asset with activity in the window, over every exchange (rule picker). */
export interface AssetOption {
asset_id: string
symbol: string
}FillRow20 fields
/** A fill as shown in the recent-fills table. */
export interface FillRow {
time: string | null
segment_id: string
asset_id: string
symbol: string
market: string
/** Venue display symbol of the market (`BTC` for Lighter market `1`). */
market_symbol: string
qty: Decimal
/** USD per base unit at the rate of the fill time of the asset its notional is in. … */
price: Decimal
notional: Decimal
/** USD paid (negative for rebates) at the rate of the fill time; 0 when `fee_in_asset` holds it. */
fee: Decimal
maker: boolean
/** The venue subaccount of the fill (dYdX: its number), else `None`. */
subaccount: string | null
/** The venue's own id of the fill (trade, execution or match id), as it reports it. … */
trade_id: string | null
/** The venue's id of the order the fill executed; null as for `trade_id`. */
order_id: string | null
/** The client order id the order was placed with, where the venue reports one; null otherwise. */
client_order_id: string | null
/** The fee in its own asset when it had no USD rate at fill time; null: `fee` is USD. */
fee_in_asset: FeeInAsset | null
/** The asset `price` and `notional` are in, as quoted, when that quote had no USD rate at fill time (the fill's asset is then counted in `no_price.assets`). … */
price_in_asset: string | null
/** Where an on-chain swap happened (EVM wallets); null: a venue fill. */
route: RouteInfo | null
/** Forced by the venue at liquidation. … */
liquidation?: boolean
/** A quanto perpetual's fill as the venue reports it (`price` in its quote, the notional in its settlement). … */
quanto: QuantoQuote | null
}FeeInAsset2 fields
/** A fee kept in its own asset (no USD rate at fill time). */
export interface FeeInAsset {
/** Catalogue asset id (the venue symbol when uncatalogued). */
asset_id: string
/** + paid, - rebate. */
amount: Decimal
}RouteInfo7 fields
/** Where an on-chain fill happened (EVM wallets). */
export interface RouteInfo {
/** `swap`, or what a transfer was. … */
kind: string
/** The DEX, aggregator or bridge (`Uniswap v4`, `1inch`, `DEX swap`). */
via: string | null
/** Its catalogue icon. */
icon_url: string | null
tx: string | null
/** The transaction on the chain's explorer. */
url: string | null
/** The pools' fee as a fraction of the amount swapped (already in the price). */
pool_fee: number | null
counterparty: string | null
}QuantoQuote6 fields
/** A fill on a quanto perpetual as the venue reports it. */
export interface QuantoQuote {
/** The venue's price per base unit, in `quote_asset_id`. */
price: Decimal
/** Catalogue id of the asset prices are quoted in. */
quote_asset_id: string
quote_symbol: string
/** Catalogue id of the asset its notional and P&L are in. */
settlement: string
settlement_symbol: string
/** `|qty| x price`, in `settlement` units. */
notional: Decimal
}TransferRow8 fields
/** An on-chain balance change that is not a trade. */
export interface TransferRow {
time: string | null
segment_id: string
asset_id: string
symbol: string
/** The token's own symbol (`WPRL` for Pearl). */
token_symbol: string
/** Signed base units: + in, - out. */
qty: Decimal
/** At the asset's rate then; null: no rate. */
usd: Decimal | null
route: RouteInfo
}AssetInfo7 fields
/** Display data of an asset, on the wire. */
export interface AssetInfo {
id: string
symbol: string
/** Catalogue display name (`None` for uncatalogued and synthetic assets). */
name: string | null
/** Icon URL (catalogue CDN), when the catalogue has one. */
icon_url: string | null
/** Asset class (`None` when unknown: uncatalogued, unprefixed synthetic ids). */
category: 'crypto' | 'stablecoin' | 'stock' | 'fund' | 'index' | 'commodity' | 'fiat' | 'rwa' | null
/** Not in the catalogue yet: an identity the tracker inferred from symbol and price (`provisional`), shown as unverified. */
provisional: boolean
/** Provisional because the AI resolver identified it; absent: false. */
resolver?: boolean
}VenuePrice4 fields
/** Where a venue-priced asset's price comes from, on the wire (`venue_prices`). */
export interface VenuePrice {
/** Venue exchange (`hyperliquid:spot`). */
segment_id: string
/** Native market id. */
market: string
/** Venue display symbol (`QONE/USDC`). */
symbol: string
/** End of the quote bucket the price is from. */
observed_at: string | null
}NoPrice3 fields
/** What a view left out of its totals for lack of a USD rate. */
export interface NoPrice {
/** Assets shown with their quantity and no price, left out of every total. */
assets: number
/** Window fills whose fee stayed in its own asset, left out of the fee totals. */
fees: number
/** Spot balances of the selected buckets left out of their equity at the last read. */
balances: number
}Conn5 fields
/** One of the user's connections, as the answer reports its freshness. */
export interface Conn {
venue_id: string
label: string | null
/** End of the last successful `accounts` pass over it; null: never synced. */
synced_at: string | null
/** `ok`, `error` (the last read failed), `unchecked` (not checked yet), `suspended` (the key re-check refused the key). */
status: 'ok' | 'error' | 'unchecked' | 'suspended'
/** Above the plan's connection limit: served from what was synced, not synced. */
read_only: boolean
}SelectionSummary22 fields
/** The overview's window totals, plus the selection's risk figures now. */
export interface SelectionSummary {
/** P&L over the window in USD, every part together: trading, funding, fees and (where valued) collateral. */
pnl: Decimal
/** P&L from price moves on the positions held and traded. */
trading: Decimal
/** Funding received (+) or paid (−) on perp positions. */
funding: Decimal
/** Of `funding`, the borrowing fees. */
borrow?: Decimal
/** Of `funding`, the equity-perp dividend adjustments. */
dividend?: number
/** Of `funding`, the loss-refund bonuses. */
bonus?: number
/** Trading fees paid in the window, positive when paid (a maker rebate counts negative). … */
fees: Decimal
/** USD volume traded in the window. */
volume: Decimal
/** Fills in the window. */
fills: number
/** Fraction of the volume filled as maker. */
maker_share: number
/** Total P&L over total volume, in basis points. */
pnl_bps: number
/** Current net exposure in quote units. */
net_delta: Decimal
/** Current gross position value: every leg's notional, long and short. */
gross_notional: Decimal
/** Gross notional of the legs that pay or earn funding (spot legs aside). … */
perp_notional: Decimal
/** Expected funding income per hour at current rates and positions. */
carry_hourly: Decimal
/** Equity of the selected buckets. */
equity: Decimal
/** What the perp buckets' collateral coins made as their USD rates moved. */
collateral: Decimal
/** Open notional over equity, over the selected accounts (their `exposure`). … */
leverage: number | null
/** The smallest move of a mark, as a positive fraction, that liquidates a selected position (`0.25`. … */
min_liq_distance: number | null
/** Free collateral of the selected buckets, summed. */
free_collateral: Decimal
/** Maintenance margin of the selected buckets, summed. */
maintenance_margin: Decimal
/** Funding per day at the current predicted rates on the selection's open positions (`carry_hourly` x 24). … */
carry_daily_usd: Decimal
}PnlDay7 fields
export interface PnlDay {
/** The UTC day, `YYYY-MM-DD`. */
date: string
/** P&L made that day in USD: `trading + funding - fees_paid`, plus what the collateral coins made where the profile values them (`Profile.value_collateral`). */
pnl: Decimal
/** Of `pnl`, price moves on the positions held and traded. */
trading: Decimal
/** Of `pnl`, funding received (+) or paid (-). */
funding: Decimal
/** Trading fees paid that day, positive when paid (a rebate is negative). */
fees_paid: Decimal
/** Equity at the day's end (UTC midnight after it; the open day: now). */
equity_close: Decimal
/** The day is not over (today), or the series starts within it. */
partial: boolean
}AssetDetail25 fields
export interface AssetDetail {
asset_id: string
symbol: string
info: AssetInfo
/** Exchange -> market, for the exchanges charted. */
markets: { [key: string]: string }
/** Exchange whose price marks the asset (P&L). */
reference: string | null
time: string[]
/** USD price per grid point on each exchange (per base unit). … */
price: { [key: string]: (Decimal | null)[] }
/** Each other exchange's price over the reference's, minus one, in bps. */
basis_bps: { [key: string]: (number | null)[] }
pos: { [key: string]: Decimal[] }
net: Decimal[]
pnl: Decimal[]
trading: Decimal[]
funding: Decimal[]
fees: Decimal[]
fills: { [key: string]: FillPoint[] }
/** Annualized funding rate history `(t, rate)` per perp exchange (its asset market there. … */
funding_rates: { [key: string]: {
time: string
value: number
}[] }
/** Every market holding or trading the asset (the By market table's rows), in exchange order. … */
market_lines: MarketLine[]
/** Exchanges of `price` no market line repeats (the reference, an active venue where nothing is held). … */
price_only: string[]
/** Observation time of the unified rates used; `None`: none read. */
prices_at: string | null
/** Assets of this answer valued now at their reference price (quality `aggregator`) instead of a market rate, with when that price was observed. … */
reference_prices: { [key: string]: string }
/** The asset, when valued now at a venue price, with that market. */
venue_prices: { [key: string]: VenuePrice }
no_price: NoPrice
/** When the asset is valued from, when after the window start. … */
priced_from_at?: string | null
conns: { [key: string]: Conn }
next_sync_at: string | null
}FillPoint6 fields
/** A fill on the price chart. */
export interface FillPoint {
time: string | null
price: Decimal
/** Signed base units. */
qty: Decimal
maker: boolean
/** As on `FillRow`: the asset `price` is in when its quote had no USD rate at fill time; null: USD. */
price_in_asset: string | null
/** Forced by the venue at liquidation (as on `FillRow`); absent: not. */
liquidation?: boolean
}MarketLine11 fields
/** One market holding or trading the asset, as the drill-down's By market table lists them. … */
export interface MarketLine {
segment_id: string
/** Native market id: the leg's own, else the exchange's asset market; empty: none known. */
market: string
/** Venue display symbol. */
symbol: string
/** What its prices are quoted in (`USDC`, `USDT`, `USD`), as the pricer labels it. … */
quote_symbol: string | null
/** A perpetual's settlement (margin) currency (`USDC` for dYdX `BTC-USD`); null: spot, or unknown. */
settlement_symbol: string | null
/** Position (base units) per grid point. */
pos: Decimal[]
/** Annualized funding rate history `(t, rate)`; empty: spot, or none stored. */
funding_rates: {
time: string
value: number
}[]
/** USD price of its market per grid point, as `price` (all null: not charted). */
price: (Decimal | null)[]
/** Its price over the reference market's, minus one, in bps. … */
basis_bps: (number | null)[]
/** Its fills in the window (a spot or whole-exchange line: the exchange's). */
fills: FillPoint[]
/** Its market is the asset's reference market. */
reference: boolean
}FundingPayment12 fields
/** A funding payment. */
export interface FundingPayment {
time: string | null
segment_id: string
asset_id: string
symbol: string
market: string
market_symbol: string
/** USD received (+) or paid (-) at its settlement asset's rate then; as paid when `amount_in_asset` is set. */
amount: Decimal
/** Symbol of the asset `amount` is in when it had no USD rate then; `None`: USD. */
amount_in_asset: string | null
/** Symbol of the asset the payment was settled in (`USDC` for Hyperliquid `BTC`). … */
settlement_symbol: string | null
/** Of `amount`, the venue's borrowing fee, valued alike; absent where the venue splits none out. */
borrow?: Decimal
/** Of `amount`, an equity perpetual's dividend adjustment, valued alike. … */
dividend?: number
/** Of `amount`, a loss-refund bonus the venue credited, valued alike. … */
bonus?: number
}PositionAnswer5 fields
/** One asset's position across your accounts. */
export interface PositionAnswer {
/** The asset's net position, P&L, funding and fees (`null`: you hold none). */
position: {
symbol: string
asset_id: string
funding: Decimal
price: Decimal | null
fees: Decimal
net: Decimal | null
net_usd: Decimal
pos: { [key: string]: Decimal }
pnl: Decimal
trading: Decimal
} | null
/** Exchange id to its display name, for the exchanges the position names. */
labels: { [key: string]: string }
/** The profile the figures cover (the reader's default). */
profile: {
id: string
name: string
} | null
/** The currency the figures are in: the reader's, or USD without a rate. */
currency: 'usd' | 'eur' | 'gbp' | 'jpy' | 'chf' | 'cad' | 'aud' | 'nzd' | 'cny' | 'hkd' | 'sgd' | 'krw' | 'inr' | 'idr' | 'myr' | 'php' | 'thb' | 'sek' | 'nok' | 'dkk' | 'isk' | 'pln' | 'czk' | 'huf' | 'ron' | 'try' | 'ils' | 'aed' | 'zar' | 'brl' | 'mxn' | 'ars'
/** Said under the figures, or null. */
note: string | null
}SavedPlot7 fields
export interface SavedPlot {
/** The chart's id (16 letters and digits). */
id: string
/** Its name. */
name: string
/** What it plots. */
kind: 'history' | 'earn' | 'depth' | 'index'
/** Its settings, or `null` for the kind's defaults. */
config: HistoryConfig | DepthConfig | IndexConfig | EarnConfig | null
/** When it was saved. */
created_at: string | null
/** When it last changed. */
updated_at: string | null
/** Whether the key's owner made it (else it was shared). */
owner: boolean
}HistoryConfig17 fields
export interface HistoryConfig {
v: 1
kind: 'history'
/** The base asset. */
asset_id: string
/** The quote: one asset (`usd-coin`, `euro`), every line a market of the pair, those listed the other way round inverted. … */
quote_asset_id?: string
/** The lines on the chart: venue chips (`binance:usdm`, the venue's default market) or single markets of one. … */
exchanges: string[]
/** The preset the venues follow; absent. … */
venues?: 'cex' | 'dex' | 'top' | 'mine'
/** The lines whose base is not `asset`, line key to base asset id; absent: every line is a market of `asset`. */
bases?: LineBases
series: ('funding' | 'price' | 'index' | 'mark' | 'next_funding' | 'basis' | 'borrow' | 'holding')[]
range: '1d' | '7d' | '30d' | '90d' | '1y' | 'live'
/** The Live range's window; only with `range: 'live'`. */
window?: '1h' | '1m' | '5m' | '15m'
/** `overlay`: the series themselves; `diff`: each exchange against `reference`. */
mode: 'overlay' | 'diff'
/** The venue `diff` is against, or `median`. … */
reference: string | null
/** Price series (index, mark, price) in US dollars, converted with our own USDT/USD and USDC/USD rates. … */
usd?: true
/** Overlaid prices (index, mark, price) as each line's % change from its first value on the chart. … */
pct?: true
/** `median`, each bucket's median open, high, low and close of the lines (one base only), or one line's own (a line key). … */
candles?: string
/** Only present when on, and only with a funding series. */
cum?: true
/** With `cum`: the by-line Totals strip turned off (it shows from three lines). Only present when off. */
totals?: false
}LineBasestype
/** The base of each line whose base is not the chart's `asset`. */
export type LineBases = { [key: string]: string }DepthConfig11 fields
export interface DepthConfig {
v: 1
kind: 'depth'
asset_id: string
/** As `HistoryConfig.quote`. */
quote_asset_id?: string
exchanges: string[]
venues?: 'cex' | 'dex' | 'top' | 'mine'
/** As `HistoryConfig.bases`. */
bases?: LineBases
/** `merged`: every book on one axis in bps from the reference mid. … */
view: 'merged' | 'side' | 'cost'
/** Exchange whose mid is the zero of the axis; `null`: the median of the mids. */
reference: string | null
/** Half-width of the depth axis, in bps of the reference mid. … */
span: number
/** Live depth's price scale: `usd` every book converted at its quote's unified rate (the default), `quoted` each in its own quote. … */
prices: 'usd' | 'quoted'
}IndexConfig10 fields
/** Live index: one asset's index price on each venue as it updates, from its LiveHub asset topic (`asset:<id>`), each against the median of the venues' indexes (or one venue's), with a rolling chart of those differences. */
export interface IndexConfig {
v: 1
kind: 'index'
asset_id: string
exchanges: string[]
venues?: 'cex' | 'dex' | 'top' | 'mine'
/** As `HistoryConfig.bases`. */
bases?: LineBases
/** The venue every other is measured against; `null`: the median of the indexes. */
reference: string | null
/** The rolling chart's span. */
window: '1m' | '5m' | '15m'
/** Each index as its venue quotes it (USDT, USDC, USD). … */
quoted?: true
/** The chart follows each venue's mark price; absent: its index. */
measure?: 'mark'
}EarnConfig10 fields
/** Earn APR: what an amount earns on each venue's earn products over time, one line per asset and venue. … */
export interface EarnConfig {
v: 1
kind: 'earn'
/** The first line's asset (the builder's market state reads it). */
asset_id: string
/** Always empty: an Earn APR chart has no market lines. */
exchanges: string[]
reference: null
/** The lines, `<asset>@<venue>` (`tether@binance`): the best product of the asset on the venue on each day. */
lines: string[]
/** The amount in US dollars each line prices (`/earn`'s $1,000 basis by default). */
amount: Decimal
range: '1d' | '7d' | '30d' | '90d' | '1y'
/** `flexible`: products without a lock-up only (the default); `all`: fixed terms too. */
products: 'flexible' | 'all'
/** Promotions and new-user offers count too; absent: they are left out. */
promos?: true
}Market data (/v1)#
On this page
- Assets & search
- GET /assets
- GET /assets/
{id} - GET /assets/
{id}/ summary - GET /assets/
{id}/ instruments - GET /search
- Prices & candles
- GET /candles
- GET /prices/
latest - GET /prices/
historical - Tickers, perps & funding
- GET /market/
tickers/ latest - GET /market/
perps/ stats/ latest - GET /market/
perps/ funding/ latest - GET /market/
perps/ funding/ historical - Earn
- GET /earn/
latest - GET /earn/
facets - GET /earn/
historical - Directory
- GET /networks
- GET /networks/
{id}
Prices, candles, tickers, perpetual stats and funding, earn products, and the asset,
venue and network directories. Scope market:read, Ultra.
Every answer is { "data", "meta" } (see Conventions). meta.as_of is
the newest observation in data (the catalogue's update time on the directories and
search; null: no row carried one), meta.currency the currency of every money
figure. Lists page with limit and cursor (ranked lists also with page); pass
meta.page.next_cursor back as cursor until it is null.
Assets & search#
GET/v1/assets
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v1/assets?limit=3"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
assets = await t.v1.assets.list(limit=3)// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const assets = await t.v1.assets.list({ limit: 3 })Response 200recorded 2026-11-17
{
"data": [
{
"id": "apple",
"symbol": "AAPL",
"name": "Apple",
"category": "stock",
"icon_url": "https://catalogue.tribulnation.com/icons/asset/apple.svg",
"price": "350.54",
"market_cap": "5094111182848",
"observed_at": "2026-11-17T20:30:20.804Z",
"price_24h_ago": "352.035",
"price_7d_ago": "348.510009765625",
"peg_currency": null
},
{
"id": "microsoft",
"symbol": "MSFT",
"name": "Microsoft",
"category": "stock",
"icon_url": "https://catalogue.tribulnation.com/icons/asset/microsoft.svg",
"price": "505.315",
"market_cap": "3752567504896",
"observed_at": "2026-11-17T20:30:20.804Z",
"price_24h_ago": "517.795",
"price_7d_ago": "533.1599731445312",
"peg_currency": null
},
{
"id": "nvidia",
"symbol": "NVDA",
"name": "NVIDIA",
"category": "stock",
"icon_url": "https://catalogue.tribulnation.com/icons/asset/nvidia.svg",
"price": "153.42",
"market_cap": "3704632639488",
"observed_at": "2026-11-17T20:30:20.804Z",
"price_24h_ago": "155.62",
"price_7d_ago": "168.88999938964844",
"peg_currency": null
… 14 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
pagecursor; meta.page.number and meta.page.total say where you are.limitcursormeta.page.next_cursor, bound to the same query.currencyusd (default) or eur.categoriessearchsparklineResponse 200RankedAssetEnvelope
dataRankedAsset[]The answer: one object, or a list of rows.idstringThe catalogue asset id (bitcoin): what every other route takes.symbolstringTicker symbol (BTC).namestringName to show (Bitcoin).category'crypto' | 'stock' | 'fiat' | 'stablecoin' | 'commodity' | 'rwa' | 'fund' | nullThe asset's category, ornullwhen the catalogue gives none.icon_urlstring | nullIcon URL, ornull.priceDecimal | nullReference price inmeta.currency, a decimal string, ornullwhen never priced.market_capDecimal | nullMarket capitalisation inmeta.currency, a decimal string, ornull.observed_atstring | nullWhenpricewas observed (ISO-8601 UTC), ornull.price_24h_agoDecimal | nullThe price about 24 hours beforeobserved_at, ornullwhen not known.price_7d_agoDecimal | nullThe price ~7 days beforeobserved_at, ornullwhen that is not something we know — same doctrine asprice24hAgo, at a wider window.peg_currencystring | nullSeePegCurrency.nullfor anything that is not a resolvable stablecoin.
metaMetaAbout the answer: its freshness, currency, window and page.
GET/v1/assets/{id}
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v1/assets/bitcoin?currency=usd"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
asset = await t.v1.assets.get('bitcoin', currency='usd')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const asset = await t.v1.assets.get('bitcoin', { currency: 'usd' })Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": {
"asset": {
"id": "bitcoin",
"symbol": "BTC",
"name": "Bitcoin",
"category": "crypto",
"icon_url": "https://catalogue.tribulnation.com/icons/asset/bitcoin.svg",
"about_en": "Bitcoin is the original decentralized cryptocurrency, secured by proof-of-work and operated without a central issuer or administrator. BTC is widely used as a store of value, reserve asset, and peer-to-peer settlement network, and it remains a widely used benchmark asset in the broader crypto market. Its monetary policy and security model define much of the industry's baseline.",
"about_ca": "Bitcoin és la criptomoneda descentralitzada original, assegurada per prova de treball (proof-of-work) i operada sense un emissor ni administrador central. BTC s…",
"about_es": "Bitcoin es la criptomoneda descentralizada original, asegurada por prueba de trabajo (proof-of-work) y operada sin un emisor ni administrador central. BTC se ut…",
"urls": {
"Website": "https://www.bitcoin.org"
},
"tags": [
"Popular"
],
"external": {
"coingecko": "bitcoin",
"coinmarketcap": "1"
}
},
"price": {
"asset_id": "bitcoin",
"price": "63944.79435895965",
"market_cap": "1285903361845",
"observed_at": "2026-11-17T20:30:20.804Z",
"price_24h_ago": "65124.584382579116"
},
"price_history": [
{
"asset_id": "bitcoin",
"time": "2025-11-16T00:00:00.000Z",
"price": "94188.27668924726",
"market_cap": "1906286799108.28",
"source": "coingecko_export",
"fetched_at": "2026-08-06T15:52:48.248Z"
},
{
"asset_id": "bitcoin",
… 416 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
idrequiredpathcurrencyusd (default) or eur.Response 200AssetAggregateEnvelope
dataAssetAggregateThe answer: one object, or a list of rows.assetAssetProfileThe asset and its catalogue copy.priceLatestPrice | nullnullwhen the sampler has never priced this asset.price_historyPricePoint[]Oldest first. Bounded — the whole series is/v1/prices/historical.tickersAssetTicker[]Every ticker for this asset, venue and quote asset resolved to names/icons — seeAssetTicker.perpsAssetPerpStats[]Every perpetual for this asset, resolved the same way.fundingFunding[]Latest funding of its perpetuals, per venue market.earnEarnInstrument[]Earn products on the asset.instrumentsAssetInstrument[]The asset's trading pages, ordered by venue, kind and market; empty where the serving path carries none (the retained Supabase handler) — seeAssetInstrument.listingsAssetListing[]Every market the asset trades on, ordered by venue, kind and market; empty where the serving path carries none — seeAssetListing.
metaMetaAbout the answer: its freshness, currency, window and page.
GET/v1/assets/{id}/summary
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v1/assets/bitcoin/summary"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
summary = await t.v1.assets.summary('bitcoin')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const summary = await t.v1.assets.summary('bitcoin')Response 200recorded 2026-11-17
{
"data": {
"asset": {
"id": "bitcoin",
"symbol": "BTC",
"name": "Bitcoin",
"category": "crypto",
"icon_url": "https://catalogue.tribulnation.com/icons/asset/bitcoin.svg",
"about_en": "Bitcoin is the original decentralized cryptocurrency, secured by proof-of-work and operated without a central issuer or administrator. BTC is widely used as a store of value, reserve asset, and peer-to-peer settlement network, and it remains a widely used benchmark asset in the broader crypto market. Its monetary policy and security model define much of the industry's baseline.",
"about_ca": "Bitcoin és la criptomoneda descentralitzada original, assegurada per prova de treball (proof-of-work) i operada sense un emissor ni administrador central. BTC s…",
"about_es": "Bitcoin es la criptomoneda descentralizada original, asegurada por prueba de trabajo (proof-of-work) y operada sin un emisor ni administrador central. BTC se ut…",
"urls": {
"Website": "https://www.bitcoin.org"
},
"tags": [
"Popular"
],
"external": {
"coingecko": "bitcoin",
"coinmarketcap": "1"
}
},
"price": {
"asset_id": "bitcoin",
"price": "63944.79435895965",
"market_cap": "1285903361845",
"observed_at": "2026-11-17T20:30:20.804Z",
"price_24h_ago": "65124.584382579116"
}
},
"meta": {
"as_of": "2026-11-17T20:30:20.804Z",
"currency": "usd"
}
}Parameters
idrequiredpathcurrencyusd (default) or eur.Response 200AssetSummaryEnvelope
dataAssetSummaryThe answer: one object, or a list of rows.assetAssetProfileThe asset and its catalogue copy.priceLatestPrice | nullnullwhen the sampler has never priced this asset.
metaMetaAbout the answer: its freshness, currency, window and page.
GET/v1/assets/{id}/instruments
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v1/assets/bitcoin/instruments"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
instruments = await t.v1.assets.instruments('bitcoin')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const instruments = await t.v1.assets.instruments('bitcoin')Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": [
{
"venue_id": "aevo",
"kind": "perp",
"segment": "perp",
"market": "BTC-PERP",
"url": "https://app.aevo.xyz/perpetual/btc"
},
{
"venue_id": "apex",
"kind": "perp",
"segment": "perp",
"market": "BTCUSDT",
"url": "https://omni.apex.exchange/trade/BTCUSDT"
},
{
"venue_id": "aster",
"kind": "perp",
"segment": "perp",
"market": "BTCU",
"url": "https://www.asterdex.com/en/trade/pro/futures/BTCU"
}
],
"meta": {
"as_of": "2026-11-17T21:24:25.967Z"
}
}Parameters
idrequiredpathResponse 200AssetInstrumentEnvelope
dataAssetInstrument[]The answer: one object, or a list of rows.venue_idstringThe venue (catalogue platform id).kind'spot' | 'perp'spotorperp.segmentstring | nullThe catalogue instrument'sexchange(the SDK exchange id,usdm,spot; a Hyperliquid dex),nullwhere the catalogue names none.marketstringThe venue's own market symbol.urlstringThe market's page on the venue.
metaMetaAbout the answer: its freshness, currency, window and page.
GET/v1/search
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v1/search?search=bitcoin"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
search = await t.v1.search('bitcoin')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const search = await t.v1.search('bitcoin')Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": [
{
"kind": "asset",
"id": "bitcoin",
"symbol": "BTC",
"name": "Bitcoin",
"category": "crypto",
"icon_url": "https://catalogue.tribulnation.com/icons/asset/bitcoin.svg"
},
{
"kind": "network",
"id": "bitcoin",
"name": "Bitcoin",
"icon_url": "https://catalogue.tribulnation.com/icons/asset/bitcoin.svg"
},
{
"kind": "asset",
"id": "bitcoin-cash",
"symbol": "BCH",
"name": "Bitcoin Cash",
"category": "crypto",
"icon_url": "https://catalogue.tribulnation.com/icons/asset/bitcoin-cash.svg"
}
],
"meta": {
"as_of": "2026-11-17T20:31:36.030Z"
}
}Parameters
searchrequiredResponse 200SearchResultEnvelope
dataSearchResult[]The answer: one object, or a list of rows.metaMetaAbout the answer: its freshness, currency, window and page.
Types 29
RankedAsset12 fields
/** One row of the market-cap ranking. */
export interface RankedAsset {
/** The catalogue asset id (`bitcoin`): what every other route takes. */
id: string
/** Ticker symbol (`BTC`). */
symbol: string
/** Name to show (`Bitcoin`). */
name: string
/** The asset's category, or `null` when the catalogue gives none. */
category: 'crypto' | 'stock' | 'fiat' | 'stablecoin' | 'commodity' | 'rwa' | 'fund' | null
/** Icon URL, or `null`. */
icon_url: string | null
/** Reference price in `meta.currency`, a decimal string, or `null` when never priced. */
price: Decimal | null
/** Market capitalisation in `meta.currency`, a decimal string, or `null`. */
market_cap: Decimal | null
/** When `price` was observed (ISO-8601 UTC), or `null`. */
observed_at: string | null
/** The price about 24 hours before `observed_at`, or `null` when not known. */
price_24h_ago: Decimal | null
/** The price ~7 days before `observed_at`, or `null` when that is not something we know -- same doctrine as `price24hAgo`, at a wider window. */
price_7d_ago: Decimal | null
/** See `PegCurrency`. `null` for anything that is not a resolvable stablecoin. */
peg_currency: string | null
sparkline?: Sparkline
}Sparkline3 fields
/** A daily price series on an implicit axis: point `i` is at `start_time + i * interval`. */
export interface Sparkline {
/** The first point's instant. `null` when there are no points. */
start_time: string | null
/** The step between points: one day. */
interval: '1d'
/** Decimal strings in `meta.currency`; `null` for a day without a price. */
prices: (Decimal | null)[]
}Meta9 fields
export interface Meta {
/** The newest observation the answer reflects (an instant), or the catalogue's applied time for directories and search. … */
as_of: string | null
/** The currency every money value in `data` is in. Only on routes whose `data` holds money. */
currency?: 'usd' | 'eur'
/** The newest observation in the whole dataset, before any filter or page. … */
collected_at?: string | null
/** Collection routes: how much of what the venues published the answer holds. */
coverage?: Coverage
/** `GET /v1/earn/latest?venues=<one>`: the venue's best non-promotional APR, a fraction. */
best_apr?: number | null
/** `GET /v1/earn/latest`: the USD stake `earnings_30d` is about, a decimal string. */
stake?: string
/** The interval the series is in, echoed so a caller never assumes it. */
interval?: string
/** Windowed routes: the effective half-open window the answer covers. */
range?: Range
/** Paginated routes: where this page is and how to read on. */
page?: Page
}Coverage4 fields
/** What the venues in scope published, against what the catalogue could translate. */
export interface Coverage {
/** Markets the venues in scope published, translated or not. */
observed: number
/** Rows in `data`. */
returned: number
/** Markets the venues published that no catalogue instrument resolves. */
untranslated: number
/** Venues these numbers cover, so a filtered request's coverage is legible. */
venues: string[]
}Range2 fields
/** A half-open instant range: `from` inclusive, `to` exclusive. */
export interface Range {
/** Start, inclusive (an instant). */
from: string
/** End, exclusive (an instant). */
to: string
}Page5 fields
/** Pagination, one object on every paginated route. … */
export interface Page {
/** Rows asked for per page. */
limit: number
/** Whether another page exists. */
has_more: boolean
/** Pass back as `?cursor=`; `null` at the end. */
next_cursor: string | null
/** Ranked routes: the 1-based page number. */
number?: number
/** Ranked routes: the rows the query matches across every page. */
total?: number
}RankedAssetEnvelope2 fields
/** Every successful response, so a caller reads `meta` the same way everywhere. */
export interface RankedAssetEnvelope {
/** The answer: one object, or a list of rows. */
data: RankedAsset[]
/** About the answer: its freshness, currency, window and page. */
meta: Meta
}AssetAggregate9 fields
export interface AssetAggregate {
/** The asset and its catalogue copy. */
asset: AssetProfile
/** `null` when the sampler has never priced this asset. */
price: LatestPrice | null
/** Oldest first. Bounded -- the whole series is `/v1/prices/historical`. */
price_history: PricePoint[]
/** Every ticker for this asset, venue and quote asset resolved to names/icons — see `AssetTicker`. */
tickers: AssetTicker[]
/** Every perpetual for this asset, resolved the same way. */
perps: AssetPerpStats[]
/** Latest funding of its perpetuals, per venue market. */
funding: Funding[]
/** Earn products on the asset. */
earn: EarnInstrument[]
/** The asset's trading pages, ordered by venue, kind and market. … */
instruments: AssetInstrument[]
/** Every market the asset trades on, ordered by venue, kind and market. … */
listings: AssetListing[]
}AssetProfile11 fields
/** An asset plus the catalogue's descriptive copy. */
export interface AssetProfile {
/** The catalogue asset id (`bitcoin`): what every other route takes. */
id: string
/** Ticker symbol (`BTC`). */
symbol: string
/** Name to show (`Bitcoin`). */
name: string
/** The asset's category, or `null` when the catalogue gives none. */
category: 'crypto' | 'stock' | 'fiat' | 'stablecoin' | 'commodity' | 'rwa' | 'fund' | null
/** Icon URL, or `null`. */
icon_url: string | null
/** About the asset, English Markdown, or `null`. */
about_en: string | null
/** About the asset, Catalan Markdown, or `null`. */
about_ca: string | null
/** About the asset, Spanish Markdown, or `null`. */
about_es: string | null
/** Links (website, explorer, socials) as the catalogue holds them. */
urls: Json
/** Catalogue tags. */
tags: Json
/** Ids of the asset on other data providers. */
external: Json
}LatestPrice5 fields
/** One asset's current price. */
export interface LatestPrice {
/** The catalogue asset id. */
asset_id: string
/** Reference price in `meta.currency`, a decimal string; `null` when none is known. */
price: Decimal | null
/** Market capitalisation in `meta.currency`, a decimal string, or `null`. */
market_cap: Decimal | null
/** This row's own observation time; `meta.asOf` is the newest of them. */
observed_at: string | null
/** The price about 24 hours before `observed_at`, or `null` when not known. */
price_24h_ago: Decimal | null
}PricePoint6 fields
/** One day of one asset's price. */
export interface PricePoint {
/** The catalogue asset id. */
asset_id: string
/** The day the price is for, labelled by its start (00:00Z), an instant. */
time: string
/** The day's reference price in `meta.currency`, a decimal string, or `null`. */
price: Decimal | null
/** The day's market capitalisation, a decimal string, or `null`. */
market_cap: Decimal | null
/** Which of the up-to-four price sources won this day, or `PEG_SOURCE` and the id of the asset this one is pegged to 1:1, for a day taken from that asset's history before this one had its own. */
source: string | null
/** When the run that wrote this row ran (a cache validator, not a freshness signal). */
fetched_at: string | null
}AssetTicker23 fields
/** A `Ticker`, with its venue and quote asset resolved to names/icons. What `AssetAggregate.tickers` carries. */
export interface AssetTicker {
/** The catalogue id of the market's base asset. */
asset_id: string
/** The venue (catalogue platform id, `binance`). */
venue_id: string
/** Exact SDK exchange ID; an empty string is a valid ID. */
segment: string | null
/** SDK market type, independent of the opaque exchange ID. */
kind: 'spot' | 'perp' | null
/** The venue's own market symbol (`BTCUSDT`). */
market: string
/** Catalogue id of the quote asset prices are in, or `null` when unresolved. */
quote_asset_id: string | null
/** Catalogue id of the asset a perpetual settles in, or `null`. */
settlement_asset_id: string | null
/** When the venue reported these figures, ISO-8601 UTC. */
observed_at: string | null
/** Last trade price, in the quote asset. */
last: Decimal | null
/** Best bid price, in the quote asset. */
bid: Decimal | null
/** Best ask price, in the quote asset. */
ask: Decimal | null
/** Size at the best bid, base units. */
bid_qty: Decimal | null
/** Size at the best ask, base units. */
ask_qty: Decimal | null
/** Traded volume over 24 hours, base units. */
base_volume_24h: Decimal | null
/** The row's figures at least the Free plan's delay old. … */
delayed?: DelayedTicker | null
/** SDK exchange display metadata; absent on older API versions or legacy stats-only rows. */
segment_name?: string | null
/** The market's page on the venue, or `null`. */
market_url?: string | null
/** The venue's display name, or `null` when the catalogue does not carry it. */
venue_name: string | null
/** The venue's icon URL, or `null`. */
venue_icon_url: string | null
/** `cex`, `dex` or `blockchain`; `null` for a venue not in the catalogue. */
venue_kind: 'cex' | 'dex' | 'blockchain' | null
/** Symbol of the quote asset, or `null`. */
quote_asset_symbol: string | null
/** Name of the quote asset, or `null`. */
quote_asset_name: string | null
/** Icon URL of the quote asset, or `null`. */
quote_asset_icon_url: string | null
}DelayedTicker7 fields
/** A ticker's figures as of at least the Free plan's delay before the aggregate or the market dataset was published. */
export interface DelayedTicker {
/** When the venue reported these figures, ISO-8601 UTC. */
observed_at: string | null
/** Last trade price, in the quote asset. */
last: Decimal | null
/** Best bid price, in the quote asset. */
bid: Decimal | null
/** Best ask price, in the quote asset. */
ask: Decimal | null
/** Size at the best bid, base units. */
bid_qty: Decimal | null
/** Size at the best ask, base units. */
ask_qty: Decimal | null
/** Traded volume over 24 hours, base units. */
base_volume_24h: Decimal | null
}AssetPerpStats22 fields
/** A `PerpStats`, resolved the same way. What `AssetAggregate.perps` carries. */
export interface AssetPerpStats {
/** The catalogue id of the perpetual's base asset. */
asset_id: string
/** The venue (catalogue platform id). */
venue_id: string
/** The venue's own market symbol. */
market: string
/** Catalogue id of the quote asset prices are in, or `null`. */
quote_asset_id: string | null
/** Catalogue id of the settlement asset, or `null`. */
settlement_asset_id: string | null
/** When the venue reported these figures, ISO-8601 UTC. */
observed_at: string | null
/** The venue's index price, in the quote asset. */
index_price: Decimal | null
/** The venue's mark price, in the quote asset. */
mark_price: Decimal | null
/** Relative units, as every rate on this API is: `0.0001` is 0.01%. See `EarnInstrument.apr`. */
funding_rate: number | null
/** When the next funding settles, ISO-8601 UTC, or `null`. */
next_funding_at: string | null
/** Seconds between funding settlements, or `null` when unknown. */
funding_interval_s: number | null
/** Set when `funding_rate` is not the venue's current rate but its last settled one (ISO, the settlement's time). … */
funding_settled_at?: string | null
/** Open interest, base units. */
open_interest: Decimal | null
/** As `Ticker.delayed`, for the stats. */
delayed?: DelayedPerpStats | null
/** SDK exchange display metadata; absent on older API versions or legacy stats-only rows. */
segment_name?: string | null
/** The market's page on the venue, or `null`. */
market_url?: string | null
/** The venue's display name, or `null` when the catalogue does not carry it. */
venue_name: string | null
/** The venue's icon URL, or `null`. */
venue_icon_url: string | null
/** `cex`, `dex` or `blockchain`; `null` for a venue not in the catalogue. */
venue_kind: 'cex' | 'dex' | 'blockchain' | null
/** Symbol of the quote asset, or `null`. */
quote_asset_symbol: string | null
/** Name of the quote asset, or `null`. */
quote_asset_name: string | null
/** Icon URL of the quote asset, or `null`. */
quote_asset_icon_url: string | null
}DelayedPerpStats8 fields
/** A perp's stats as of at least the Free plan's delay before publication. */
export interface DelayedPerpStats {
/** When the venue reported these figures, ISO-8601 UTC. */
observed_at: string | null
/** The venue's index price, in the quote asset. */
index_price: Decimal | null
/** The venue's mark price, in the quote asset. */
mark_price: Decimal | null
/** Relative units, as every rate on this API is: `0.0001` is 0.01%. See `EarnInstrument.apr`. */
funding_rate: number | null
/** When the next funding settles, ISO-8601 UTC, or `null`. */
next_funding_at: string | null
/** Seconds between funding settlements, or `null` when unknown. */
funding_interval_s: number | null
/** Set when `funding_rate` is not the venue's current rate but its last settled one (ISO, the settlement's time). … */
funding_settled_at?: string | null
/** Open interest, base units. */
open_interest: Decimal | null
}Funding8 fields
/** The most recent settled funding on one venue's perpetual. */
export interface Funding {
/** The catalogue id of the perpetual's base asset. */
asset_id: string
/** The venue (catalogue platform id). */
venue_id: string
/** The venue's own market symbol. */
market: string
/** Catalogue id of the quote asset, or `null`. */
quote_asset_id: string | null
/** Catalogue id of the settlement asset, or `null`. */
settlement_asset_id: string | null
/** When the rate was observed, ISO-8601 UTC, or `null`. */
time: string | null
/** Relative units, as every rate on this API is: `0.0001` is 0.01%. See `EarnInstrument.apr`. */
rate: number | null
/** Mark over index, a fraction, or `null`. */
premium: number | null
}EarnInstrument21 fields
/** One earn product. */
export interface EarnInstrument {
/** The venue offering it (catalogue platform id). */
venue_id: string
/** The venue's own product id. */
instrument: string
/** Catalogue id of the asset earned on. */
asset_id: string | null
/** `market.assets.symbol` for `asset_id`, or `null` when there is no asset. */
asset_symbol: string | null
/** `market.assets.display_name` for `asset_id` -- `Tether USD`. `null` as above. */
asset_name: string | null
/** `market.assets.icon` for `asset_id`. … */
asset_icon_url: string | null
/** `market.platforms.display_name` for `venue` -- `MEXC`, `Binance`. */
venue_name: string | null
/** **An icon to show, not `market.platforms.icon`** -- the same promise `Platform.icon` makes, resolved the same way. */
venue_icon_url: string | null
/** **Where to open this product on the venue's own site**, or `null` when the venue publishes no link for it. */
url: string | null
/** *A fraction of one, not percentage points: `0.0123` is 1.23%.** */
apr: number | null
/** Lock-up in whole seconds; `null` or 0 for flexible. */
lock_s: number | null
/** Product tags (`flexible`, `locked`, `staking`,...). */
tags: Json
/** When the offer was read, ISO-8601 UTC. */
observed_at: string | null
/** The smallest and largest amount this product accepts. … */
min_qty: Decimal | null
/** Most you can subscribe, asset units, or `null` for no cap. */
max_qty: Decimal | null
price: Decimal | null
/** **What a $1,000 stake earns from this product over 30 days, in US dollars** -- the figure `?sort=earnings` ranks by. */
earnings_1k_30d: Decimal | null
earnings_30d: Decimal | null
/** A promotion on top of `apr`, which stays the product's base rate. … */
bonus?: EarnBonus
/** Who may take the product and when. … */
offer?: EarnOffer
/** The regions the product is not offered in. … */
unavailable_in?: ('eu' | 'us')[]
}EarnBonus8 fields
/** A venue's promotion on an earn product. … */
export interface EarnBonus {
/** The bonus APR, a fraction. */
apr: number
/** The bonus by amount: each band's extra rate on the slice of a balance inside it. */
tiers: EarnTier[] | null
/** Amount the bonus applies up to, asset units, or `null`. */
max_qty: Decimal | null
/** The venue symbol the bonus is paid in, when not the product's asset. */
reward_asset_id: string | null
/** When it ends (ISO-8601), `null`: not published. */
ends_at: string | null
/** `true`: new accounts only; `null`: not stated. */
new_users: boolean | null
/** Anything else that limits it, in words. */
conditions: string | null
/** `api`: from the venue's own data. … */
source: 'page' | 'api'
}EarnTier3 fields
/** One band of an earn product's tier ladder. … */
export interface EarnTier {
/** Tier lower bound, asset units. */
min_qty: Decimal | null
/** Tier upper bound, asset units, or `null` for no bound. */
max_qty: Decimal | null
/** The tier's APR, a fraction. */
apr: number | null
}EarnOffer7 fields
/** Who may take an earn product and when (`EarnInstrument.offer`). */
export interface EarnOffer {
/** The verification level required (`L2`), `null`: not stated. */
kyc: string | null
/** What the venue calls the rate it shows; `apr` stays the number either way. */
rate_label: 'apr' | 'apy' | null
/** When it opens to subscriptions and stops taking them (dates), `null`: not published. */
starts_at: string | null
/** When the promotion ends, ISO-8601 UTC, or `null`. */
ends_at: string | null
/** The interest period of a subscription made now, when the venue states it. */
term_start_at: string | null
/** When the product's term ends, ISO-8601 UTC, or `null`. */
term_end_at: string | null
/** The venue's conditions, in its words, or `null`. */
conditions: string | null
}AssetInstrument5 fields
/** One of the asset's instruments with a trading page. … */
export interface AssetInstrument {
/** The venue (catalogue platform id). */
venue_id: string
/** `spot` or `perp`. */
kind: 'spot' | 'perp'
/** The catalogue instrument's `exchange` (the SDK exchange id, `usdm`, `spot`. … */
segment: string | null
/** The venue's own market symbol. */
market: string
/** The market's page on the venue. */
url: string
}AssetListing20 fields
/** One market the asset trades on, from the catalogue. … */
export interface AssetListing {
/** The venue (catalogue platform id). */
venue_id: string
/** `spot` or `perp`. */
kind: 'spot' | 'perp'
/** As `AssetInstrument.segment`. */
segment: string | null
/** The venue's own market symbol. */
market: string
/** Catalogue id of the base asset. */
base_asset_id: string
/** Catalogue id of the quote asset, or `null`. */
quote_asset_id: string | null
/** Catalogue id of the settlement asset, or `null`. */
settlement_asset_id: string | null
/** The asset is this market's quote (a currency pair, listed on its quote's page). */
quote_side: boolean
/** The catalogue's trading page, verbatim; null where it has none. */
url: string | null
/** The catalogue's contract multiplier. … */
multiplier?: number
/** Symbol of the base asset, or `null`. */
base_asset_symbol: string | null
/** Icon URL of the base asset, or `null`. */
base_asset_icon_url: string | null
/** SDK exchange display metadata; absent on older API versions or legacy stats-only rows. */
segment_name?: string | null
/** The market's page on the venue, or `null`. */
market_url?: string | null
/** The venue's display name, or `null` when the catalogue does not carry it. */
venue_name: string | null
/** The venue's icon URL, or `null`. */
venue_icon_url: string | null
/** `cex`, `dex` or `blockchain`; `null` for a venue not in the catalogue. */
venue_kind: 'cex' | 'dex' | 'blockchain' | null
/** Symbol of the quote asset, or `null`. */
quote_asset_symbol: string | null
/** Name of the quote asset, or `null`. */
quote_asset_name: string | null
/** Icon URL of the quote asset, or `null`. */
quote_asset_icon_url: string | null
}AssetAggregateEnvelope2 fields
/** Every successful response, so a caller reads `meta` the same way everywhere. */
export interface AssetAggregateEnvelope {
/** The answer: one object, or a list of rows. */
data: AssetAggregate
/** About the answer: its freshness, currency, window and page. */
meta: Meta
}AssetSummary2 fields
/** Identity/profile and current price, without history or secondary sections. */
export interface AssetSummary {
/** The asset and its catalogue copy. */
asset: AssetProfile
/** `null` when the sampler has never priced this asset. */
price: LatestPrice | null
}AssetSummaryEnvelope2 fields
/** Every successful response, so a caller reads `meta` the same way everywhere. */
export interface AssetSummaryEnvelope {
/** The answer: one object, or a list of rows. */
data: AssetSummary
/** About the answer: its freshness, currency, window and page. */
meta: Meta
}AssetInstrumentEnvelope2 fields
/** Every successful response, so a caller reads `meta` the same way everywhere. */
export interface AssetInstrumentEnvelope {
/** The answer: one object, or a list of rows. */
data: AssetInstrument[]
/** About the answer: its freshness, currency, window and page. */
meta: Meta
}SearchResulttype
export type SearchResult = {
kind: 'asset'
id: string
symbol: string
name: string
category: string | null
icon_url: string | null
} | {
kind: 'venue'
id: string
name: string
icon_url: string | null
} | {
kind: 'network'
id: string
name: string
icon_url: string | null
}SearchResultEnvelope2 fields
/** Every successful response, so a caller reads `meta` the same way everywhere. */
export interface SearchResultEnvelope {
/** The answer: one object, or a list of rows. */
data: SearchResult[]
/** About the answer: its freshness, currency, window and page. */
meta: Meta
}Prices & candles#
GET/v1/candles
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v1/candles?asset=bitcoin&interval=1d&from=2026-11-10&to=2026-11-17&limit=3"from datetime import date
from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
candles = await t.v1.candles(
asset='bitcoin',
interval='1d',
start=date(2026, 11, 10),
end=date(2026, 11, 17),
limit=3,
)// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const candles = await t.v1.candles({
asset: 'bitcoin',
interval: '1d',
start: '2026-11-10',
end: '2026-11-17',
limit: 3,
})Response 200recorded 2026-11-17
{
"data": [
{
"asset_id": "bitcoin",
"time": "2026-11-10T00:00:00.000Z",
"interval": "1d",
"source": "venues",
"open": "75261.452885242054541615",
"high": "76569.420783645655877342",
"low": "71845.386533665835411471",
"close": "73698.399441956625938442",
"turnover": "1902160123.433038202633763341",
"built_at": "2026-11-16T19:30:10.791Z",
"period": {
"hours": null,
"closed": true
}
},
{
"asset_id": "bitcoin",
"time": "2026-11-11T00:00:00.000Z",
"interval": "1d",
"source": "venues",
"open": "73703.706161363856079544",
"high": "77756.784610099622122982",
"low": "71651.376146788990825688",
"close": "73927.822600206621882017",
"turnover": "1292927024.794119131088183627",
"built_at": "2026-11-16T19:31:56.357Z",
"period": {
"hours": null,
"closed": true
}
},
{
"asset_id": "bitcoin",
"time": "2026-11-12T00:00:00.000Z",
"interval": "1d",
"source": "venues",
"open": "73926.765313183342211744",
… 26 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
assetrequiredintervalfromrequiredYYYY-MM-DD, its 00:00Z) or an ISO-8601 instant with a zone (Z or ±HH:MM).tolimitmeta.page.next_cursor reads on.currencyusd (default) or eur.cursormeta.page.next_cursor, bound to the same query.Response 200CandlePointEnvelope
dataCandlePoint[]The answer: one object, or a list of rows.asset_idstringThe catalogue asset id.timestringBucket start, ISO-8601 UTC.interval'1h' | '4h' | '1d'Bucket width:1h,4hor1d.source'venues' | 'perpetuals'venues: the spot asset index.perpetuals: an asset that trades only as perpetuals (gold, stocks), from its perpetual markets' trade candles; a chart series carrying their basis and funding, never a valuation price.openDecimalFirst price of the bucket, a decimal string.highDecimalHighest price of the bucket, a decimal string.lowDecimalLowest price of the bucket, a decimal string.closeDecimalLast price of the bucket, a decimal string.turnoverDecimalTraded value in the bucket (quote turnover), inmeta.currency, a decimal string.built_atstringWhen this candle was built, an instant.period{ hours: number | null; closed: boolean }The bucket's period: how much of it was observed and whether it has ended.
metaMetaAbout the answer: its freshness, currency, window and page.
GET/v1/prices/latest
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v1/prices/latest?assets=bitcoin,ethereum"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
prices = await t.v1.prices.latest(assets=['bitcoin', 'ethereum'])// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const prices = await t.v1.prices.latest({ assets: ['bitcoin', 'ethereum'] })Response 200recorded 2026-11-17
{
"data": [
{
"asset_id": "bitcoin",
"price": "63944.79435895965",
"market_cap": "1285903361845",
"observed_at": "2026-11-17T20:30:20.804Z",
"price_24h_ago": "65124.584382579116"
},
{
"asset_id": "ethereum",
"price": "1798.2402973472815",
"market_cap": "219745474650",
"observed_at": "2026-11-17T20:30:20.804Z",
"price_24h_ago": "1820.9377276671955"
}
],
"meta": {
"as_of": "2026-11-17T20:30:20.804Z",
"currency": "usd"
}
}Parameters
assetsrequiredcurrencyusd (default) or eur.Response 200LatestPriceEnvelope
dataLatestPrice[]The answer: one object, or a list of rows.asset_idstringThe catalogue asset id.priceDecimal | nullReference price inmeta.currency, a decimal string;nullwhen none is known.market_capDecimal | nullMarket capitalisation inmeta.currency, a decimal string, ornull.observed_atstring | nullThis row's own observation time;meta.asOfis the newest of them.price_24h_agoDecimal | nullThe price about 24 hours beforeobserved_at, ornullwhen not known.
metaMetaAbout the answer: its freshness, currency, window and page.
GET/v1/prices/historical
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v1/prices/historical?assets=bitcoin&from=2026-11-14&to=2026-11-17&limit=3"from datetime import date
from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
prices_history = await t.v1.prices.historical(
assets=['bitcoin'],
start=date(2026, 11, 14),
end=date(2026, 11, 17),
limit=3,
)// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const pricesHistory = await t.v1.prices.historical({
assets: ['bitcoin'],
start: '2026-11-14',
end: '2026-11-17',
limit: 3,
})Response 200recorded 2026-11-17
{
"data": [
{
"asset_id": "bitcoin",
"time": "2026-11-14T00:00:00.000Z",
"price": "64128.051104094855",
"market_cap": "1289719957066.902729137925",
"source": "coinmarketcap_public",
"fetched_at": "2026-11-16T02:00:23.668Z"
}
],
"meta": {
"as_of": "2026-11-14T00:00:00.000Z",
"currency": "usd",
"range": {
"from": "2026-11-14T00:00:00.000Z",
"to": "2026-11-17T00:00:00.000Z"
},
"page": {
"limit": 3,
"has_more": false,
"next_cursor": null
}
}
}Parameters
assetsrequiredfromrequiredYYYY-MM-DD, its 00:00Z) or an ISO-8601 instant with a zone (Z or ±HH:MM).tolimitmeta.page.next_cursor reads on.currencyusd (default) or eur.cursormeta.page.next_cursor, bound to the same query.Response 200PricePointEnvelope
dataPricePoint[]The answer: one object, or a list of rows.asset_idstringThe catalogue asset id.timestringThe day the price is for, labelled by its start (00:00Z), an instant.priceDecimal | nullThe day's reference price inmeta.currency, a decimal string, ornull.market_capDecimal | nullThe day's market capitalisation, a decimal string, ornull.sourcestring | nullWhich of the up-to-four price sources won this day, orPEG_SOURCEand the id of the asset this one is pegged to 1:1, for a day taken from that asset's history before this one had its own.fetched_atstring | nullWhen the run that wrote this row ran (a cache validator, not a freshness signal).
metaMetaAbout the answer: its freshness, currency, window and page.
Types 4
CandlePoint11 fields
export interface CandlePoint {
/** The catalogue asset id. */
asset_id: string
/** Bucket start, ISO-8601 UTC. */
time: string
/** Bucket width: `1h`, `4h` or `1d`. */
interval: '1h' | '4h' | '1d'
/** `venues`: the spot asset index. … */
source: 'venues' | 'perpetuals'
/** First price of the bucket, a decimal string. */
open: Decimal
/** Highest price of the bucket, a decimal string. */
high: Decimal
/** Lowest price of the bucket, a decimal string. */
low: Decimal
/** Last price of the bucket, a decimal string. */
close: Decimal
/** Traded value in the bucket (quote turnover), in `meta.currency`, a decimal string. */
turnover: Decimal
/** When this candle was built, an instant. */
built_at: string
/** The bucket's period: how much of it was observed and whether it has ended. */
period: {
hours: number | null
closed: boolean
}
}CandlePointEnvelope2 fields
/** Every successful response, so a caller reads `meta` the same way everywhere. */
export interface CandlePointEnvelope {
/** The answer: one object, or a list of rows. */
data: CandlePoint[]
/** About the answer: its freshness, currency, window and page. */
meta: Meta
}LatestPriceEnvelope2 fields
/** Every successful response, so a caller reads `meta` the same way everywhere. */
export interface LatestPriceEnvelope {
/** The answer: one object, or a list of rows. */
data: LatestPrice[]
/** About the answer: its freshness, currency, window and page. */
meta: Meta
}PricePointEnvelope2 fields
/** Every successful response, so a caller reads `meta` the same way everywhere. */
export interface PricePointEnvelope {
/** The answer: one object, or a list of rows. */
data: PricePoint[]
/** About the answer: its freshness, currency, window and page. */
meta: Meta
}Tickers, perps & funding#
GET/v1/market/tickers/latest
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v1/market/tickers/latest?assets=bitcoin&limit=3"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
tickers = await t.v1.market.tickers.latest(assets=['bitcoin'], limit=3)// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const tickers = await t.v1.market.tickers.latest({ assets: ['bitcoin'], limit: 3 })Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": [
{
"asset_id": "bitcoin",
"venue_id": "aevo",
"segment": "perp",
"kind": "perp",
"market": "BTC-PERP",
"quote_asset_id": "usd-coin",
"settlement_asset_id": "usd-coin",
"observed_at": "2026-11-17T21:23:08.745Z",
"last": null,
"bid": "64089.5",
"ask": "64094.6",
"bid_qty": "0.022",
"ask_qty": "0.016",
"base_volume_24h": "39.4",
"delayed": {
"observed_at": "2026-11-17T21:02:57.820Z",
"last": null,
"bid": "63950.2",
"ask": "63960.8",
"bid_qty": "0.016",
"ask_qty": "0.022",
"base_volume_24h": "38.967"
}
},
{
"asset_id": "bitcoin",
"venue_id": "apex",
"segment": "perp",
"kind": "perp",
"market": "BTCUSDT",
"quote_asset_id": "tether",
"settlement_asset_id": "tether",
"observed_at": "2026-11-17T21:14:05.474Z",
"last": "64084.7",
"bid": null,
"ask": null,
"bid_qty": null,
… 59 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
kindsspot, perp, comma-separated.assetsvenuespagecursor; meta.page.number and meta.page.total say where you are.limitcursormeta.page.next_cursor, bound to the same query.Response 200LatestRowEnvelope
GET/v1/market/perps/stats/latest
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v1/market/perps/stats/latest?assets=bitcoin&limit=3"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
perps = await t.v1.market.perps.stats.latest(assets=['bitcoin'], limit=3)// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const perps = await t.v1.market.perps.stats.latest({ assets: ['bitcoin'], limit: 3 })Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": [
{
"asset_id": "bitcoin",
"venue_id": "aevo",
"market": "BTC-PERP",
"quote_asset_id": "usd-coin",
"settlement_asset_id": "usd-coin",
"observed_at": "2026-11-17T21:22:05.351Z",
"index_price": "64128.611923",
"mark_price": "64099.109244",
"funding_rate": 0.000004,
"funding_interval_s": 3600,
"open_interest": "28.722998",
"delayed": {
"observed_at": "2026-11-17T21:02:04.215Z",
"index_price": "63975.794786",
"mark_price": "63954.364292",
"funding_rate": 0.000004,
"funding_interval_s": 3600,
"open_interest": "28.682998",
"next_funding_at": "2026-11-17T22:00:00.000Z"
},
"next_funding_at": "2026-11-17T22:00:00.000Z"
},
{
"asset_id": "bitcoin",
"venue_id": "apex",
"market": "BTCUSDT",
"quote_asset_id": "tether",
"settlement_asset_id": "tether",
"observed_at": "2026-11-17T21:14:05.462Z",
"index_price": "64110.24",
"mark_price": "64086",
"funding_rate": 0.0000125,
"funding_interval_s": 3600,
"open_interest": "1604.786",
"delayed": {
"observed_at": "2026-11-17T21:03:54.760Z",
"index_price": "64013.66",
… 53 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
assetsvenuespagecursor; meta.page.number and meta.page.total say where you are.limitcursormeta.page.next_cursor, bound to the same query.Response 200LatestRowEnvelope
GET/v1/market/perps/funding/latest
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v1/market/perps/funding/latest?assets=bitcoin&limit=3"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
funding = await t.v1.market.perps.funding.latest(assets=['bitcoin'], limit=3)// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const funding = await t.v1.market.perps.funding.latest({
assets: ['bitcoin'],
limit: 3,
})Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": [
{
"asset_id": "bitcoin",
"venue_id": "aevo",
"market": "BTC-PERP",
"quote_asset_id": "usd-coin",
"settlement_asset_id": "usd-coin",
"time": "2026-11-17T21:00:00.000Z",
"rate": 0.000004,
"premium": null
},
{
"asset_id": "bitcoin",
"venue_id": "apex",
"market": "BTCUSDT",
"quote_asset_id": "tether",
"settlement_asset_id": "tether",
"time": "2026-11-17T21:00:00.000Z",
"rate": 0.0000125,
"premium": null
},
{
"asset_id": "bitcoin",
"venue_id": "aster",
"market": "BTCU",
"quote_asset_id": "united-stables",
"settlement_asset_id": "united-stables",
"time": "2026-11-17T16:00:00.000Z",
"rate": 0.00003275,
"premium": null
}
],
"meta": {
"as_of": "2026-11-17T21:00:00.000Z",
"coverage": {
"observed": 5230,
"returned": 3,
"untranslated": 0,
"venues": [
… 14 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
assetsvenuespagecursor; meta.page.number and meta.page.total say where you are.limitcursormeta.page.next_cursor, bound to the same query.Response 200LatestRowEnvelope
GET/v1/market/perps/funding/historical
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v1/market/perps/funding/historical?assets=bitcoin&from=2026-11-16T21:00:00Z&to=2026-11-17T21:00:00Z&limit=3"from datetime import datetime, timezone
from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
funding_history = await t.v1.market.perps.funding.historical(
assets=['bitcoin'],
start=datetime(2026, 11, 16, 21, 0, tzinfo=timezone.utc),
end=datetime(2026, 11, 17, 21, 0, tzinfo=timezone.utc),
limit=3,
)// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const fundingHistory = await t.v1.market.perps.funding.historical({
assets: ['bitcoin'],
start: '2026-11-16T21:00:00Z',
end: '2026-11-17T21:00:00Z',
limit: 3,
})Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": [
{
"asset_id": "bitcoin",
"venue_id": "aevo",
"market": "BTC-PERP",
"time": "2026-11-16T21:00:00.000Z",
"rate": 0.000007,
"premium": null
},
{
"asset_id": "bitcoin",
"venue_id": "aevo",
"market": "BTC-PERP",
"time": "2026-11-16T22:00:00.000Z",
"rate": 0.000005,
"premium": null
},
{
"asset_id": "bitcoin",
"venue_id": "aevo",
"market": "BTC-PERP",
"time": "2026-11-16T23:00:00.000Z",
"rate": 0.000002,
"premium": null
}
],
"meta": {
"as_of": "2026-11-16T23:00:00.000Z",
"coverage": {
"observed": 5230,
"returned": 3,
"untranslated": 0,
"venues": [
"aevo",
"apex",
"aster"
]
},
"interval": "1h",
… 11 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
assetsvenuesmarketsUSDJPYUSDT), with venues: only these markets. Comma-separated, at most 100.fromrequiredYYYY-MM-DD, its 00:00Z) or an ISO-8601 instant with a zone (Z or ±HH:MM).tointerval1h: each settlement; 1d: summed per UTC day, labelled by its start.limitmeta.page.next_cursor reads on.cursormeta.page.next_cursor, bound to the same query.Response 200FundingPointEnvelope
dataFundingPoint[]The answer: one object, or a list of rows.asset_idstringThe catalogue id of the perpetual's base asset.venue_idstringThe venue (catalogue platform id).marketstringThe venue's own market symbol.timestringSettlement instant, or the UTC day it fell in. See above.ratenumber | nullSettled rate; the day's total atinterval=day. Relative units, as every rate on this API is:0.0001is 0.01%. SeeEarnInstrument.apr.premiumnumber | nullMark-to-index spread; the day's mean atinterval=day.funding_shortoptionalnumberThe per-side holding rates, each a fraction per interval likerate(+ = that side pays; the day's total atinterval=day).rateis what a long pays in funding;funding_shortis what a short pays;borrow_long/borrow_shortare what each side pays the venue or pool to hold, on top of funding. A key is absent where the venue does not charge or report it: a one-rate venue's short side is-rateand it charges no borrow. Only gTrade carries them today (from 2026-09-01; a borrowing-v1 pair's hours after its one read carry no borrow). gTrade's funding is zero-sum: the earning side is 0 where the paying side held no open interest, and an hour whose payer is unknown hasratenull and nofunding_short(its borrow stays).borrow_longoptionalnumberBorrow fee a long pays per interval, a fraction (venues that charge one).borrow_shortoptionalnumberBorrow fee a short pays per interval, a fraction (venues that charge one).
metaMetaAbout the answer: its freshness, currency, window and page.
Types 6
Ticker15 fields
/** A ticker enriched through Catalogue, retaining exact SDK exchange and market IDs. */
export interface Ticker {
/** The catalogue id of the market's base asset. */
asset_id: string
/** The venue (catalogue platform id, `binance`). */
venue_id: string
/** Exact SDK exchange ID; an empty string is a valid ID. */
segment: string | null
/** SDK market type, independent of the opaque exchange ID. */
kind: 'spot' | 'perp' | null
/** The venue's own market symbol (`BTCUSDT`). */
market: string
/** Catalogue id of the quote asset prices are in, or `null` when unresolved. */
quote_asset_id: string | null
/** Catalogue id of the asset a perpetual settles in, or `null`. */
settlement_asset_id: string | null
/** When the venue reported these figures, ISO-8601 UTC. */
observed_at: string | null
/** Last trade price, in the quote asset. */
last: Decimal | null
/** Best bid price, in the quote asset. */
bid: Decimal | null
/** Best ask price, in the quote asset. */
ask: Decimal | null
/** Size at the best bid, base units. */
bid_qty: Decimal | null
/** Size at the best ask, base units. */
ask_qty: Decimal | null
/** Traded volume over 24 hours, base units. */
base_volume_24h: Decimal | null
/** The row's figures at least the Free plan's delay old. … */
delayed?: DelayedTicker | null
}PerpStats14 fields
/** One venue's perpetual on an asset. */
export interface PerpStats {
/** The catalogue id of the perpetual's base asset. */
asset_id: string
/** The venue (catalogue platform id). */
venue_id: string
/** The venue's own market symbol. */
market: string
/** Catalogue id of the quote asset prices are in, or `null`. */
quote_asset_id: string | null
/** Catalogue id of the settlement asset, or `null`. */
settlement_asset_id: string | null
/** When the venue reported these figures, ISO-8601 UTC. */
observed_at: string | null
/** The venue's index price, in the quote asset. */
index_price: Decimal | null
/** The venue's mark price, in the quote asset. */
mark_price: Decimal | null
/** Relative units, as every rate on this API is: `0.0001` is 0.01%. See `EarnInstrument.apr`. */
funding_rate: number | null
/** When the next funding settles, ISO-8601 UTC, or `null`. */
next_funding_at: string | null
/** Seconds between funding settlements, or `null` when unknown. */
funding_interval_s: number | null
/** Set when `funding_rate` is not the venue's current rate but its last settled one (ISO, the settlement's time). … */
funding_settled_at?: string | null
/** Open interest, base units. */
open_interest: Decimal | null
/** As `Ticker.delayed`, for the stats. */
delayed?: DelayedPerpStats | null
}LatestRowEnvelope2 fields
/** Every successful response, so a caller reads `meta` the same way everywhere. */
export interface LatestRowEnvelope {
/** The answer: one object, or a list of rows. */
data: LatestRow[]
/** About the answer: its freshness, currency, window and page. */
meta: Meta
}FundingPoint9 fields
/** One settled funding payment, or one UTC day of them. */
export interface FundingPoint {
/** The catalogue id of the perpetual's base asset. */
asset_id: string
/** The venue (catalogue platform id). */
venue_id: string
/** The venue's own market symbol. */
market: string
/** Settlement instant, or the UTC day it fell in. See above. */
time: string
/** Settled rate; the day's **total** at `interval=day`. … */
rate: number | null
/** Mark-to-index spread; the day's **mean** at `interval=day`. */
premium: number | null
/** The per-side holding rates, each a fraction per interval like `rate` (+ = that side pays. … */
funding_short?: number
/** Borrow fee a long pays per interval, a fraction (venues that charge one). */
borrow_long?: number
/** Borrow fee a short pays per interval, a fraction (venues that charge one). */
borrow_short?: number
}FundingPointEnvelope2 fields
/** Every successful response, so a caller reads `meta` the same way everywhere. */
export interface FundingPointEnvelope {
/** The answer: one object, or a list of rows. */
data: FundingPoint[]
/** About the answer: its freshness, currency, window and page. */
meta: Meta
}Earn#
GET/v1/earn/latest
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v1/earn/latest?assets=ethereum&limit=3"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
earn = await t.v1.earn.latest(assets=['ethereum'], limit=3)// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const earn = await t.v1.earn.latest({ assets: ['ethereum'], limit: 3 })Response 200recorded 2026-11-17
{
"data": [
{
"venue_id": "mexc",
"instrument": "mexc:ETH:86400.0:fixed,new-users:0.03:0.1",
"asset_id": "ethereum",
"asset_symbol": "ETH",
"asset_name": "Ethereum",
"asset_icon_url": "https://catalogue.tribulnation.com/icons/asset/ethereum.svg",
"venue_name": "MEXC",
"venue_icon_url": "https://catalogue.tribulnation.com/icons/platform/mexc.svg",
"url": "https://www.mexc.com/earn",
"apr": 2,
"tags": [
"fixed",
"new-users"
],
"observed_at": "2026-11-17T20:51:00.828Z",
"min_qty": "0.03",
"max_qty": "0.1",
"lock_s": 86400,
"earnings_1k_30d": "0.985337149231387",
"earnings_30d": "0.985337149231387",
"price": "1798.2402973472815",
"unavailable_in": [
"us"
]
},
{
"venue_id": "bitunix",
"instrument": "bitunix:ETH-fix-new-5-20251013-0002",
"asset_id": "ethereum",
"asset_symbol": "ETH",
"asset_name": "Ethereum",
"asset_icon_url": "https://catalogue.tribulnation.com/icons/asset/ethereum.svg",
"venue_name": "Bitunix",
"venue_icon_url": "https://catalogue.tribulnation.com/icons/platform/bitunix.svg",
"url": "https://www.bitunix.com/earn/financial-management",
"apr": 1,
"tags": [
… 54 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
assetsvenuestypesregionpagecursor; meta.page.number and meta.page.total say where you are.limitcursormeta.page.next_cursor, bound to the same query.currencyusd (default) or eur.sortstakeResponse 200EarnInstrumentEnvelope
dataEarnInstrument[]The answer: one object, or a list of rows.venue_idstringThe venue offering it (catalogue platform id).instrumentstringThe venue's own product id.asset_idstring | nullCatalogue id of the asset earned on.asset_symbolstring | nullmarket.assets.symbolforasset_id, ornullwhen there is no asset.asset_namestring | nullmarket.assets.display_nameforasset_id—Tether USD.nullas above.asset_icon_urlstring | nullmarket.assets.iconforasset_id: a path relative tohttps://catalogue.tribulnation.com/, like every othericonon this API.venue_namestring | nullmarket.platforms.display_nameforvenue—MEXC,Binance.venue_icon_urlstring | nullAn icon to show, notmarket.platforms.icon— the same promisePlatform.iconmakes, resolved the same way.urlstring | nullWhere to open this product on the venue's own site, ornullwhen the venue publishes no link for it.aprnumber | nullA fraction of one, not percentage points:0.0123is 1.23%.lock_snumber | nullLock-up in whole seconds;nullor 0 for flexible.tagsJsonProduct tags (flexible,locked,staking,...).observed_atstring | nullWhen the offer was read, ISO-8601 UTC.min_qtyDecimal | nullThe smallest and largest amount this product accepts. Both promoted out ofrawthe same wayurlwas:nullon either means the venue publishes no such bound, not that the collector failed to read one.max_qtyDecimal | nullMost you can subscribe, asset units, ornullfor no cap.priceDecimal | nullearnings_1k_30dDecimal | nullWhat a $1,000 stake earns from this product over 30 days, in US dollars — the figure?sort=earningsranks by.earnings_30dDecimal | null- A promotion on top of
apr, which stays the product's base rate: absent when the product has none.apr,earnings_1k_30dand the ranking never include it, because a bonus is capped, ends, and is often for new accounts only. - Who may take the product and when: the KYC level, what the venue calls its rate, the offer's dates. Absent when the venue states none (most products); set on new-user products.
unavailable_inoptional('eu' | 'us')[]The regions the product is not offered in:[]when none is known, which does not claim it is offered everywhere.
metaMetaAbout the answer: its freshness, currency, window and page.
GET/v1/earn/facets
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v1/earn/facets"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
facets = await t.v1.earn.facets()// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const facets = await t.v1.earn.facets()Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": {
"venues": [
{
"id": "backpack",
"name": "Backpack Exchange",
"icon_url": "https://catalogue.tribulnation.com/icons/asset/backpack.svg"
},
{
"id": "binance",
"name": "Binance",
"icon_url": "https://catalogue.tribulnation.com/icons/platform/binance.svg"
},
{
"id": "bit2me",
"name": "Bit2Me",
"icon_url": "https://catalogue.tribulnation.com/icons/asset/bit2me.svg"
}
],
"assets": [
{
"id": "0x",
"symbol": "ZRX",
"name": "0x",
"icon_url": "https://catalogue.tribulnation.com/icons/asset/0x.svg"
},
{
"id": "1inch",
"symbol": "1INCH",
"name": "1inch",
"icon_url": "https://catalogue.tribulnation.com/icons/asset/1inch.svg"
},
{
"id": "375ai",
"symbol": "EAT",
"name": "375ai",
"icon_url": "https://catalogue.tribulnation.com/icons/asset/375ai.svg"
}
],
"tags": [
… 11 more lines: the whole answer is this operation’s example in /openapi.jsonResponse 200{ data: EarnFacets; meta: { as_of: string | null; collected_at: string | null } }
dataEarnFacetsvenues{ id: string; name: string | null; icon_url: string | null }[]Venues with earn products.assets{ id: string; symbol: string | null; name: string | null; icon_url: string | null }[]Assets with earn products.tagsstring[]Product tags in use, with counts.
meta{ as_of: string | null; collected_at: string | null }as_ofstring | nullcollected_atstring | null
GET/v1/earn/historical
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v1/earn/historical?assets=bitcoin&from=2026-11-01T00:00:00Z"from datetime import datetime, timezone
from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
earn_history = await t.v1.earn.historical(
assets=['bitcoin'],
start=datetime(2026, 11, 1, 0, 0, tzinfo=timezone.utc),
)// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const earnHistory = await t.v1.earn.historical({
assets: ['bitcoin'],
start: '2026-11-01T00:00:00Z',
})No recorded answer: none recorded yet.
Parameters
assetsrequiredfromrequiredYYYY-MM-DD, its 00:00Z) or an ISO-8601 instant with a zone (Z or ±HH:MM).tovenueslimitmeta.page.next_cursor reads on.cursormeta.page.next_cursor, bound to the same query.Response 200EarnHistoryPointEnvelope
dataEarnHistoryPoint[]The answer: one object, or a list of rows.asset_idstringCatalogue id of the asset earned on.timestringThe day, labelled by its start (00:00Z), an instant.venue_idstringThe venue (catalogue platform id).instrumentstringThe product, asEarnInstrument.instrumentnames it.aprnumber | nullThe product's rate as collected (a fraction:0.05is 5 %).tiersEarnTier[]APR tiers by amount.ladderedbooleanWhethertiersis a collected ladder, rather than the row as one tier.lock_snumber | nullLock-up in whole seconds;nullor 0 for flexible.tagsstring[] | nullProduct tags.min_qtyDecimal | nullLeast you can subscribe, asset units, ornull.max_qtyDecimal | nullMost you can subscribe, asset units, ornull.priceDecimal | nullThe asset's USD price atobserved_at, ornull.observed_atstringWhen the offer was read, ISO-8601 UTC.
metaMetaAbout the answer: its freshness, currency, window and page.
Types 4
EarnInstrumentEnvelope2 fields
/** Every successful response, so a caller reads `meta` the same way everywhere. */
export interface EarnInstrumentEnvelope {
/** The answer: one object, or a list of rows. */
data: EarnInstrument[]
/** About the answer: its freshness, currency, window and page. */
meta: Meta
}EarnFacets3 fields
/** market.earn_facet_{platforms,assets,tags}. … */
export interface EarnFacets {
/** Venues with earn products. */
venues: {
id: string
name: string | null
icon_url: string | null
}[]
/** Assets with earn products. */
assets: {
id: string
symbol: string | null
name: string | null
icon_url: string | null
}[]
/** Product tags in use, with counts. */
tags: string[]
}EarnHistoryPoint13 fields
/** One earn product on one UTC day: its last observation that day. */
export interface EarnHistoryPoint {
/** Catalogue id of the asset earned on. */
asset_id: string
/** The day, labelled by its start (00:00Z), an instant. */
time: string
/** The venue (catalogue platform id). */
venue_id: string
/** The product, as `EarnInstrument.instrument` names it. */
instrument: string
/** The product's rate as collected (a fraction: `0.05` is 5 %). */
apr: number | null
/** APR tiers by amount. */
tiers: EarnTier[]
/** Whether `tiers` is a collected ladder, rather than the row as one tier. */
laddered: boolean
/** Lock-up in whole seconds; `null` or 0 for flexible. */
lock_s: number | null
/** Product tags. */
tags: string[] | null
/** Least you can subscribe, asset units, or `null`. */
min_qty: Decimal | null
/** Most you can subscribe, asset units, or `null`. */
max_qty: Decimal | null
/** The asset's USD price at `observed_at`, or `null`. */
price: Decimal | null
/** When the offer was read, ISO-8601 UTC. */
observed_at: string
}EarnHistoryPointEnvelope2 fields
/** Every successful response, so a caller reads `meta` the same way everywhere. */
export interface EarnHistoryPointEnvelope {
/** The answer: one object, or a list of rows. */
data: EarnHistoryPoint[]
/** About the answer: its freshness, currency, window and page. */
meta: Meta
}Directory#
GET/v1/networks
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v1/networks"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
networks = await t.v1.networks.list()// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const networks = await t.v1.networks.list()Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": [
{
"id": "ab",
"name": "AB",
"kind": "blockchain",
"about_en": "AB is a blockchain network for transferring digital assets and connecting on-chain applications. It is the network associated with the AB token and the former Newton project.",
"about_ca": null,
"about_es": null,
"urls": {
"Website": "https://www.ab.org/"
},
"category": "evm",
"namespace": "eip155",
"chain_id": "36888",
"snapshot_supported": false,
"icon_url": "https://catalogue.tribulnation.com/icons/platform/ab.svg",
"native_asset_id": "newton-project",
"native_asset_name": "AB",
"native_asset_symbol": "AB",
"native_asset_icon_url": "https://catalogue.tribulnation.com/icons/asset/newton-project.svg"
},
{
"id": "acala",
"name": "Acala",
"kind": "blockchain",
"about_en": "Acala is a Polkadot parachain focused on decentralized finance, including liquid staking and exchange services. Its applications use Polkadot's shared security.",
"about_ca": null,
"about_es": null,
"urls": {
"Website": "https://acala.network/"
},
"category": "substrate",
"namespace": "polkadot",
"chain_id": "fc41b9bd8ef8fe53d58c7ea67c794c7e",
"snapshot_supported": false,
"icon_url": "https://catalogue.tribulnation.com/icons/asset/acala.svg",
"native_asset_id": "acala",
"native_asset_name": "Acala",
"native_asset_symbol": "ACA",
… 27 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
searchResponse 200PlatformListEnvelope
GET/v1/networks/{id}
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v1/networks/ethereum"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
network = await t.v1.networks.get('ethereum')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const network = await t.v1.networks.get('ethereum')Response 200recorded 2026-11-17
{
"data": {
"id": "ethereum",
"name": "Ethereum",
"kind": "blockchain",
"about_en": "Ethereum is the leading programmable blockchain, launched in 2015, and the foundation for most of the decentralized finance, NFT, and Web3 ecosystem. It transit…",
"about_ca": "Ethereum és la principal blockchain programable, llançada el 2015, i el fonament de la major part de l'ecosistema de finances descentralitzades, NFTs i Web3. El…",
"about_es": "Ethereum es la principal blockchain programable, lanzada en 2015, y el fundamento de la mayor parte del ecosistema de finanzas descentralizadas, NFTs y Web3. En…",
"urls": {
"Website": "https://www.ethereum.org/"
},
"category": "evm",
"namespace": "eip155",
"chain_id": "1",
"snapshot_supported": false,
"icon_url": "https://catalogue.tribulnation.com/icons/asset/ethereum.svg",
"native_asset_id": "ethereum",
"native_asset_name": "Ethereum",
"native_asset_symbol": "ETH",
"native_asset_icon_url": "https://catalogue.tribulnation.com/icons/asset/ethereum.svg"
},
"meta": {
"as_of": "2026-11-17T12:43:28.933Z"
}
}Types 3
Platform16 fields
/** One row of `market.platforms` -- a venue, a chain, or a DEX, discriminated by `kind`. … */
export interface Platform {
/** The catalogue platform id (`binance`). */
id: string
/** Name to show. */
name: string
/** `cex`, `dex` or `blockchain`. */
kind: 'cex' | 'dex' | 'blockchain'
/** **An icon to show, not `market.platforms.icon`.** 25 of the 97 rows have no icon of their own, and all 25 carry a `native_asset` whose asset row does -- so the API serves that one instead and every platform comes back with an icon. … */
icon_url: string | null
/** About the platform, English Markdown, or `null`. */
about_en: string | null
/** About the platform, Catalan Markdown, or `null`. */
about_ca: string | null
/** About the platform, Spanish Markdown, or `null`. */
about_es: string | null
/** Links as the catalogue holds them. */
urls: Json
/** The catalogue's `BlockchainCategory`, which today has **exactly one value**. … */
category: string | null
/** The catalogue **asset id** of the chain's gas asset. … */
native_asset_id: string | null
/** `market.assets.display_name` for `native_asset` -- "xDAI", "Toncoin", "Bitget Token". */
native_asset_name: string | null
/** `market.assets.symbol` for `native_asset` -- "ETH", "BGB", "xDAI". */
native_asset_symbol: string | null
/** `market.assets.icon` for `native_asset` -- the asset's own mark, whatever `icon` above ended up being. */
native_asset_icon_url: string | null
/** A **CAIP-2 namespace**, from the catalogue's `BlockchainNamespace`. … */
namespace: string | null
/** A chain id, as a **string**. `market.platforms.chain_id` is `text`, deliberately. … */
chain_id: string | null
/** **True when the portfolio can snapshot this venue** — what the connect form offers, minus the credential-schema condition. */
snapshot_supported: boolean
}Series & snapshots (/v2)#
On this page
Typed series and snapshots with published contracts: each id names a contract (its
fields, key, cadence and guarantees), and /data serves its records. /v2/series and
/v2/snapshots list what your key can read. A contract is opened to keys once its
redistribution is cleared; until then a read is 403 saying so.
Every route below takes an id from the catalogue. Unlike /v1, /v2
refuses parameters it does not know.
GET/v2/series
#400 bad_request naming it, as on every /v2 route.curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v2/series"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
series = await t.v2.series.list()// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const series = await t.v2.series.list()Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": [
{
"id": "asset.price.candles.1h",
"status": "served",
"public": "not_assessed",
"contract": "/v2/series/asset.price.candles.1h"
},
{
"id": "asset.price.candles.4h",
"status": "served",
"public": "not_assessed",
"contract": "/v2/series/asset.price.candles.4h"
},
{
"id": "asset.price.candles.1d",
"status": "served",
"public": "not_assessed",
"contract": "/v2/series/asset.price.candles.1d"
}
],
"meta": {
"as_of": null,
"publication": null,
"catalogue": null
}
}Response 200{ data: V2SeriesEntry[]; meta: V2Meta }
dataV2SeriesEntry[]idstringstatusstringpublic'yes' | 'no' | 'not_assessed'contractstring
metaV2Meta
GET/v2/series/corrections
#/v2/series/{id}. Until the corrections log ships the feed is unavailable, never empty: an empty feed would claim nothing was ever corrected.curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v2/series/corrections"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
answer = await t.get('/v2/series/corrections')No recorded answer: none recorded yet.
GET/v2/series/{id}
#asset.price.candles.1h contract: what each field means, coverage, gaps, precision, retention.curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v2/series/asset.price.candles.1h"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
serie = await t.v2.series.get('asset.price.candles.1h')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const serie = await t.v2.series.get('asset.price.candles.1h')Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": {
"id": "asset.price.candles.1h",
"status": "served",
"specification": "data/index.html#series-asset.price.candles.1h",
"contract": {
"id": {
"text": "`asset.price.candles.1h`, `asset.price.candles.4h` and\n`asset.price.candles.1d`: three series with one method at three intervals.",
"value": "asset.price.candles.1h"
},
"keyed_by": {
"text": "catalogue asset.",
"subject": "asset",
"key": [
"asset"
],
"instance": [
{
"name": "asset",
"type": "string",
"unit": null,
"nullable": false,
"description": "Catalogue asset ID."
}
]
},
"shape": {
"text": "candle: `open`, `high`, `low`, `close` in USD, and\nincluded turnover in USD. The 4h and daily candles also count the hours\nthat contributed.",
"type": "candle",
"fields": [
{
"name": "asset",
"type": "string",
"unit": null,
"nullable": false,
"description": "Catalogue asset ID."
},
{
"name": "time",
"type": "timestamp",
… 93 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
idrequiredpathasset.price.candles.1h).Response 200{ data: V2SeriesContract; meta: V2Meta }
dataV2SeriesContractmetaV2Meta
GET/v2/series/{id}/data
#asset.price.candles.1h records with from <= time < to, in (time, asset) order.curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v2/series/bitcoin/data?from=2026-11-01T00:00:00Z"from datetime import datetime, timezone
from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
records = await t.v2.series.data(
'bitcoin',
start=datetime(2026, 11, 1, 0, 0, tzinfo=timezone.utc),
)// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const records = await t.v2.series.data('bitcoin', { start: '2026-11-01T00:00:00Z' })No recorded answer: none recorded yet.
Parameters
idrequiredpathasset.price.candles.1h).assetsasset is one of these (comma-separated).fromrequiredZ or ±HH:MM).tofrom. Defaults to now.limitcursormeta.cursor.next, bound to the same filters and range.Response 200V2RecordsEnvelope & { data?: AssetPriceCandles1hRecord[] }
assetstringCatalogue asset ID.timestringStart of the interval. Unit: UTC.openDecimalTurnover-weighted mean open across included markets. Unit: USD.highDecimalHighest high of the included markets. Unit: USD.lowDecimalLowest low of the included markets. Unit: USD.closeDecimalTurnover-weighted mean close across included markets. Unit: USD.turnoverDecimalIncluded turnover. Unit: USD.
metaV2MetaThe publication the records are from, and the page.
GET/v2/series/{id}/latest
#asset.price.candles.1h instance's most recent record.curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v2/series/bitcoin/latest"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
series = await t.v2.series.latest('bitcoin')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const series = await t.v2.series.latest('bitcoin')No recorded answer: none recorded yet.
Parameters
idrequiredpathasset.price.candles.1h).assetsasset is one of these (comma-separated).limitcursormeta.cursor.next, bound to the same filters and range.Response 200V2RecordsEnvelope & { data?: AssetPriceCandles1hRecord[] }
assetstringCatalogue asset ID.timestringStart of the interval. Unit: UTC.openDecimalTurnover-weighted mean open across included markets. Unit: USD.highDecimalHighest high of the included markets. Unit: USD.lowDecimalLowest low of the included markets. Unit: USD.closeDecimalTurnover-weighted mean close across included markets. Unit: USD.turnoverDecimalIncluded turnover. Unit: USD.
metaV2MetaThe publication the records are from, and the page.
GET/v2/series/{id}/instances
#asset.price.candles.1h instances with served records and their coverage, in key order (asset).curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v2/series/bitcoin/instances"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
instances = await t.v2.series.instances('bitcoin')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const instances = await t.v2.series.instances('bitcoin')No recorded answer: none recorded yet.
Parameters
idrequiredpathasset.price.candles.1h).assetsasset is one of these (comma-separated).limitcursormeta.cursor.next, bound to the same filters and range.Response 200V2RecordsEnvelope & { data?: AssetPriceCandles1hInstance[] }
assetstringCatalogue asset ID.stateoptional'data' | 'no_data'recordsoptionalnumberRecords served for this instance.
metaV2MetaThe publication the records are from, and the page.
GET/v2/snapshots
#400 bad_request naming it, as on every /v2 route.curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v2/snapshots"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
snapshots = await t.v2.snapshots.list()// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const snapshots = await t.v2.snapshots.list()Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": [
{
"id": "market.ticker",
"status": "served",
"public": "not_assessed",
"contract": "/v2/snapshots/market.ticker"
},
{
"id": "perp.funding.next",
"status": "served",
"public": "not_assessed",
"contract": "/v2/snapshots/perp.funding.next"
},
{
"id": "asset.price.reference",
"status": "served",
"public": "not_assessed",
"contract": "/v2/snapshots/asset.price.reference"
}
],
"meta": {
"as_of": null,
"publication": null,
"catalogue": null
}
}Response 200{ data: V2SnapshotEntry[]; meta: V2Meta }
dataV2SnapshotEntry[]idstringstatusstringpublic'yes' | 'no' | 'not_assessed'contractstring
metaV2Meta
GET/v2/snapshots/{id}
#market.ticker contract.curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v2/snapshots/market.ticker"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
serie = await t.v2.series.get('market.ticker')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const serie = await t.v2.series.get('market.ticker')Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": {
"id": "market.ticker",
"status": "served",
"specification": "data/index.html#snapshot-market.ticker",
"contract": {
"id": {
"text": "`market.ticker`",
"value": "market.ticker"
},
"keyed_by": {
"text": "venue market, spot or perpetual.",
"key": [
"venue",
"exchange",
"kind",
"market"
],
"descriptors": [
{
"name": "asset",
"type": "string",
"unit": null,
"nullable": false,
"description": "Base asset, catalogue ID."
},
{
"name": "quote",
"type": "string",
"unit": null,
"nullable": true,
"description": "Quote asset, catalogue ID; null while unmapped."
},
{
"name": "settlement",
"type": "string",
"unit": null,
"nullable": true,
"description": "Settlement asset, catalogue ID; null while unmapped."
}
… 80 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
idrequiredpathmarket.ticker).Response 200{ data: V2SnapshotContract; meta: V2Meta }
metaV2Meta
GET/v2/snapshots/{id}/data
#market.ticker records, in key order (venue, exchange, kind, market).curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/v2/snapshots/market.ticker/data?assets=bitcoin&limit=3"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
records = await t.v2.series.data('market.ticker', assets=['bitcoin'], limit=3)// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const records = await t.v2.series.data('market.ticker', {
assets: ['bitcoin'],
limit: 3,
})Response 200recorded 2026-11-17
{
"data": [
{
"venue": "aster",
"exchange": "perp",
"kind": "perpetual",
"market": "BTCU",
"last": "80567.7",
"bid": "80524.3",
"ask": "80625.6",
"bid_size": "0.083",
"ask_size": "0.459",
"volume_24h": "46.386",
"observed_at": "2026-10-29T18:45:00.135Z"
},
{
"venue": "aster",
"exchange": "perp",
"kind": "perpetual",
"market": "BTCUSD1",
"last": "80647",
"bid": "80662.1",
"ask": "80672.4",
"bid_size": "0.108",
"ask_size": "0.412",
"volume_24h": "36.078",
"observed_at": "2026-10-29T18:45:00.135Z"
},
{
"venue": "aster",
"exchange": "perp",
"kind": "perpetual",
"market": "BTCUSDC",
"last": "81428.3",
"bid": "80592.3",
"ask": "80605.2",
"bid_size": "0.434",
"ask_size": "0.758",
"volume_24h": "0.641",
"observed_at": "2026-10-29T18:45:00.135Z"
… 19 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
idrequiredpathmarket.ticker).assetsasset is one of these (comma-separated).venuesvenue is one of these (comma-separated).exchangeexchange is this.kindkind is this.marketmarket is this.limitcursormeta.cursor.next, bound to the same filters and range.Response 200V2RecordsEnvelope & { data?: MarketTickerSnapshot[] }
dataMarketTickerSnapshot[]venuestringVenue ID.exchangestring | nullThe venue's product family.kindstringspotorperpetual.marketstringThe venue's native market ID.lastDecimal | nullLast trade price. Unit: market's quote.bidDecimal | nullBest bid price. Unit: market's quote.askDecimal | nullBest ask price. Unit: market's quote.bid_sizeDecimal | nullSize at the best bid. Unit: base units.ask_sizeDecimal | nullSize at the best ask. Unit: base units.volume_24hDecimal | nullTraded volume over 24 hours. Unit: base units.observed_atstringWhen the values were collected. A failed collection leaves the record with its old observation time. Unit: UTC.
metaV2MetaThe publication the records are from, and the page.
Types 14
V2SeriesEntry4 fields
export interface V2SeriesEntry {
id: string
status: string
public: 'yes' | 'no' | 'not_assessed'
contract: string
}V2Meta6 fields
export interface V2Meta {
/** The newest record time on this page (an instant), or `null` (contracts, registries, empty pages). */
as_of: string | null
/** `null` for contracts and registries, which are not publications. */
publication: Publication | null
/** The catalogue release the ids are from, or `null`. */
catalogue: CatalogueRelease | null
/** Collection routes only: `next_cursor: null` is the end. */
page?: {
limit: number
has_more: boolean
next_cursor: string | null
}
/** Present only on a final, empty page. … */
no_data?: 'no_matching_instance' | 'no_data' | 'no_records_in_range'
/** Instances whose records are withheld, and why. … */
held?: {
asset_id: string
reason: string
}[]
}Publication2 fields
/** One consistent set of served data, scoped to one series or snapshot. */
export interface Publication {
/** Opaque; changes whenever the served records change. */
id: string
/** When the publication was built, an instant. */
published_at: string
}CatalogueRelease2 fields
/** The catalogue applied when the publication was built. */
export interface CatalogueRelease {
/** When the catalogue refresh that produced the mappings ran, an instant. */
applied_at: string
/** The archive's release identifier. … */
release: string | null
}V2SeriesContract5 fields
export interface V2SeriesContract {
id: string
status: 'not_served' | 'served'
specification: string
contract: {
id: {
text: string
value: string
}
keyed_by: {
text: string
subject: 'asset' | 'venue_market'
key: string[]
instance: RecordField[]
}
shape: {
text: string
type: 'candle' | 'point' | 'event'
fields: RecordField[]
}
semantics: {
text: string
time: 'interval_start' | 'observation' | 'settlement' | 'date'
}
kind: {
text: string
value: 'source_history' | 'live_feed' | 'derived' | 'source_history_or_live_feed'
}
resolution_and_lag: {
text: string
interval: string | null
}
coverage: {
text: string
start_origin: 'source_history' | 'derived' | 'collection_start' | 'per_instance'
}
gaps: {
text: string
}
precision: {
text: string
value: 'float' | 'exact'
}
retention: {
text: string
days: number | null
}
corrections: {
text: string
}
built_from: {
text: string
datasets: string[]
}
public: {
text: string
value: 'yes' | 'no' | 'not_assessed'
}
}
serving: {
filters: {
name: string
field: string
list: boolean
}[]
order: {
data: string[]
latest: string[]
instances: string[]
}
routes: {
contract: string
instances: string
data: string
latest: string
}
notes: string[]
}
}RecordField5 fields
/** One field of a record or an instance. */
export interface RecordField {
/** Field name on the wire. */
name: string
/** Wire type. */
type: 'string' | 'number' | 'boolean' | 'integer' | 'decimal' | 'timestamp' | 'string[]'
/** Unit or quote, where the value has one. */
unit: string | null
/** Whether the value may be `null`. */
nullable: boolean
/** What the field holds. */
description: string
}AssetPriceCandles1hRecord7 fields
/** One `asset.price.candles.1h` record (candle, 1h). */
export interface AssetPriceCandles1hRecord {
/** Catalogue asset ID. */
asset: string
/** Start of the interval. Unit: UTC. */
time: string
/** Turnover-weighted mean open across included markets. Unit: USD. */
open: Decimal
/** Highest high of the included markets. Unit: USD. */
high: Decimal
/** Lowest low of the included markets. Unit: USD. */
low: Decimal
/** Turnover-weighted mean close across included markets. Unit: USD. */
close: Decimal
/** Included turnover. Unit: USD. */
turnover: Decimal
}V2RecordsEnvelope2 fields
export interface V2RecordsEnvelope {
/** The records (or the contract, or the listing). */
data: WireRecord[]
/** The publication the records are from, and the page. */
meta: V2Meta
}WireRecordtype
/** One record; its fields are the route’s record schema. */
export type WireRecord = Record<string, unknown>AssetPriceCandles1hInstance4 fields
/** One `asset.price.candles.1h` instance and its coverage. */
export interface AssetPriceCandles1hInstance {
/** Catalogue asset ID. */
asset: string
coverage?: V2Coverage
state?: 'data' | 'no_data'
/** Records served for this instance. */
records?: number
}V2Coverage4 fields
export interface V2Coverage {
/** First record's time, ISO-8601 UTC, or `null`. */
firstTime: string | null
/** Last record's time, ISO-8601 UTC, or `null`. */
lastTime: string | null
/** Why the series starts where it does. */
startOrigin: string
/** When the instance stopped (delisted), or `null` while it runs. */
endedAt: string | null
}V2SnapshotEntry4 fields
export interface V2SnapshotEntry {
id: string
status: string
public: 'yes' | 'no' | 'not_assessed'
contract: string
}V2SnapshotContract5 fields
export interface V2SnapshotContract {
id: string
status: 'not_served' | 'served'
specification: string
contract: {
id: {
text: string
value: string
}
keyed_by: {
text: string
key: string[]
descriptors: RecordField[]
}
fields: {
text: string
fields: RecordField[]
}
updated: {
text: string
}
built_from: {
text: string
}
public: {
text: string
value: 'yes' | 'no' | 'not_assessed'
}
}
serving: {
filters: {
name: string
field: string
list: boolean
}[]
order: {
data: string[]
}
routes: {
contract: string
data: string
}
notes: string[]
}
}MarketTickerSnapshot11 fields
/** One `market.ticker` record. */
export interface MarketTickerSnapshot {
/** Venue ID. */
venue: string
/** The venue's product family. */
exchange: string | null
/** `spot` or `perpetual`. */
kind: string
/** The venue's native market ID. */
market: string
/** Last trade price. Unit: market's quote. */
last: Decimal | null
/** Best bid price. Unit: market's quote. */
bid: Decimal | null
/** Best ask price. Unit: market's quote. */
ask: Decimal | null
/** Size at the best bid. Unit: base units. */
bid_size: Decimal | null
/** Size at the best ask. Unit: base units. */
ask_size: Decimal | null
/** Traded volume over 24 hours. Unit: base units. */
volume_24h: Decimal | null
/** When the values were collected. … */
observed_at: string
}Catalogue#
Every id the routes above take. A record's fields are its contract's; expand a row for its type.
asset.price.candles.1hseries1hasset time open high low +2
asset.price.candles.1h record (candle, 1h).assetstringCatalogue asset ID.timestringStart of the interval. Unit: UTC.openDecimalTurnover-weighted mean open across included markets. Unit: USD.highDecimalHighest high of the included markets. Unit: USD.lowDecimalLowest low of the included markets. Unit: USD.closeDecimalTurnover-weighted mean close across included markets. Unit: USD.turnoverDecimalIncluded turnover. Unit: USD.
asset.price.candles.4hseries4hasset time open high low +3
asset.price.candles.4h record (candle, 4h).assetstringCatalogue asset ID.timestringStart of the interval. Unit: UTC.openDecimalTurnover-weighted mean open across included markets. Unit: USD.highDecimalHighest high of the included markets. Unit: USD.lowDecimalLowest low of the included markets. Unit: USD.closeDecimalTurnover-weighted mean close across included markets. Unit: USD.turnoverDecimalIncluded turnover. Unit: USD.hoursnumberHours that contributed to the candle. Unit: hours.
asset.price.candles.1dseries1dasset time open high low +3
asset.price.candles.1d record (candle, 1d).assetstringCatalogue asset ID.timestringStart of the interval. Unit: UTC.openDecimalTurnover-weighted mean open across included markets. Unit: USD.highDecimalHighest high of the included markets. Unit: USD.lowDecimalLowest low of the included markets. Unit: USD.closeDecimalTurnover-weighted mean close across included markets. Unit: USD.turnoverDecimalIncluded turnover. Unit: USD.hoursnumber | nullHours that contributed to the candle; null until the daily build records it. Unit: hours.
asset.price.reference.1dseries1dasset time price market_cap source
asset.price.reference.1d record (point, 1d).assetstringCatalogue asset ID.timestring00:00 UTC of the date the value is for; which instant of the day it stands for is the source’s convention. Unit: UTC.priceDecimal | nullReference price. Unit: USD.market_capDecimal | nullMarket capitalization. Unit: USD.sourcestringWhere the value came from: venues (our daily asset candle, where the day is eligible), else the source, in this precedence: ecb_public (ECB reference rates, fiat only), coingecko_export, coinmarketcap_public, yahoo_public or fred_public.
market.price.candles.5mseries5mvenue exchange kind market time +7
market.price.candles.5m record (candle, 5m).venuestringVenue ID.exchangestring | nullThe venue's product family; null where the catalogue has none.kindstringspotorperpetual.marketstringThe venue's native market ID.timestringStart of the interval. Unit: UTC.openDecimalThe venue's open. Unit: market's quote.highDecimalThe venue's high. Unit: market's quote.lowDecimalThe venue's low. Unit: market's quote.closeDecimalThe venue's close. Unit: market's quote.volumeDecimal | nullBase volume, where the venue reports it. Unit: base units.quote_volumeDecimal | nullQuote volume, where the venue reports it. Unit: market's quote.tradesnumber | nullTrade count, where the venue reports it.
perp.funding.settlementsserieseventvenue exchange kind market time +4
perp.funding.settlements record (event, no fixed interval).venuestringVenue ID.exchangestring | nullThe venue's product family; null where the catalogue has none.kindstringspotorperpetual.marketstringThe venue's native market ID.timestringSettlement time. Unit: UTC.ratenumberThe rate the venue applied, as it reports it. Unit: fraction of position value per settlement period.premiumnumber | nullPremium component, where the venue reports it. Unit: fraction.interval_snumber | nullThe settlement period: the time since the previous settlement where it repeats a neighbouring interval; null for a first settlement and after a gap. Unit: seconds.aprnumber | nullrate × 365 days / interval_s; null wheninterval_sis. Unit: fraction per year, simple.
perp.index.candles.5mseries5mvenue exchange kind market time +4
perp.index.candles.5m record (candle, 5m).venuestringVenue ID.exchangestring | nullThe venue's product family; null where the catalogue has none.kindstringspotorperpetual.marketstringThe venue's native market ID.timestringStart of the interval. Unit: UTC.openDecimalFirst value of the interval. Unit: market's quote.highDecimalHighest value of the interval. Unit: market's quote.lowDecimalLowest value of the interval. Unit: market's quote.closeDecimalLast value of the interval. Unit: market's quote.
perp.mark.candles.5mseries5mvenue exchange kind market time +4
perp.mark.candles.5m record (candle, 5m).venuestringVenue ID.exchangestring | nullThe venue's product family; null where the catalogue has none.kindstringspotorperpetual.marketstringThe venue's native market ID.timestringStart of the interval. Unit: UTC.openDecimalFirst value of the interval. Unit: as the venue quotes it, per contract.highDecimalHighest value of the interval. Unit: as the venue quotes it, per contract.lowDecimalLowest value of the interval. Unit: as the venue quotes it, per contract.closeDecimalLast value of the interval. Unit: as the venue quotes it, per contract.
perp.open_interest.candles.5mseries5mvenue exchange kind market time +4
perp.open_interest.candles.5m record (candle, 5m).venuestringVenue ID.exchangestring | nullThe venue's product family; null where the catalogue has none.kindstringspotorperpetual.marketstringThe venue's native market ID.timestringStart of the interval. Unit: UTC.openDecimalFirst value of the interval. Unit: base units.highDecimalHighest value of the interval. Unit: base units.lowDecimalLowest value of the interval. Unit: base units.closeDecimalLast value of the interval. Unit: base units.
market.tickersnapshotlatestvenue exchange kind market last +6
market.ticker record.venuestringVenue ID.exchangestring | nullThe venue's product family.kindstringspotorperpetual.marketstringThe venue's native market ID.lastDecimal | nullLast trade price. Unit: market's quote.bidDecimal | nullBest bid price. Unit: market's quote.askDecimal | nullBest ask price. Unit: market's quote.bid_sizeDecimal | nullSize at the best bid. Unit: base units.ask_sizeDecimal | nullSize at the best ask. Unit: base units.volume_24hDecimal | nullTraded volume over 24 hours. Unit: base units.observed_atstringWhen the values were collected. A failed collection leaves the record with its old observation time. Unit: UTC.
perp.funding.nextsnapshotlatestvenue exchange kind market rate +4
perp.funding.next record.venuestringVenue ID.exchangestring | nullThe venue's product family.kindstringspotorperpetual.marketstringThe venue's native market ID.ratenumber | nullThe rate the venue publishes for the next settlement; on most venues an estimate. Unit: fraction of position value per settlement period.interval_snumber | nullThe settlement period. Unit: seconds.aprnumber | nullrate × 365 days / interval_s, not compounded; null when either is. Unit: fraction per year, simple.next_funding_atstring | nullWhen the next settlement is due. Unit: UTC.observed_atstringWhen the values were collected. A failed collection leaves the record with its old observation time. Unit: UTC.
asset.price.referencesnapshotlatestasset price market_cap price_24h_ago source +1
asset.price.reference record.assetstringCatalogue asset ID.priceDecimal | nullLatest reference price: our latest hourly asset candle close where the asset has a venue price, else the aggregators’ latest. Unit: USD.market_capDecimal | nullLatest market capitalization, from the aggregators. Unit: USD.price_24h_agoDecimal | nullThe reference price 24 hours earlier. Unit: USD.sourcestringWhere price came from: venues, else the name of the aggregator that answered (coingecko, coinmarketcap,...), or aggregator where the stored row does not name it.observed_atstringWhen the values were collected. A failed collection leaves the record with its old observation time. Unit: UTC.
venue.earnsnapshotlatestvenue product asset paid_asset apr +6
venue.earn record.venuestringVenue ID.productstringThe venue's product ID.assetstringDeposited asset, catalogue ID.paid_assetstring | nullAsset the yield is paid in, catalogue ID; null where the venue does not say or it is unmapped.aprnumber | nullAnnual rate as the venue states it. Unit: fraction per year.kindsstring[]Product kind as the venue tags it: flexible, fixed and others.min_amountDecimal | nullMinimum deposit. Unit: deposited asset.max_amountDecimal | nullMaximum deposit. Unit: deposited asset.lock_secondsnumber | nullLock period; null when flexible. Unit: seconds.urlstring | nullThe product's page.observed_atstringWhen the values were collected. A failed collection leaves the record with its old observation time. Unit: UTC.
Live#
On this page
- Which to use
- WebSocket
- Topics
- Book depth and frame size
- Connection lifecycle
- Refusals
- Examples
- Snapshots over HTTP
- GET /book/
{asset} - GET /asset/
{asset} - Live JSON
- GET /opportunities
- GET /opportunities/
{asset} - GET /funding
- GET /funding/
history - GET /funding/
perps - GET /spreads/
history - GET /exchanges
- GET /profile
- Socket reference
- WS /{topic}
Live order books, markets, rates and opportunities across venues, never older than
30 s. Everything here needs a key with the market:read scope; market data
over the API is included with Ultra, and a key on another plan is refused with 403.
Which to use#
| You need | Use | Answers |
|---|---|---|
| Every update as it is built | WebSocket wss://api.tribulnation.com/live/<topic> |
One frame per build, about every second for books, for as long as the socket is open |
| The current book or asset now and then | Snapshot GET /live/book/{asset}, GET /live/asset/{asset} |
The topic's current view, fresh, in one HTTP answer |
| Ranked opportunities, funding, profiles | Live JSON GET /live/opportunities, /live/funding, … |
JSON pages and filters over the same live data |
A WebSocket frame and a snapshot carry the same view, with the same field names, types
and units as the rest of the API. The socket only adds type, seq, v and ts_ms.
WebSocket#
wss://api.tribulnation.com/live/<topic>[?depth=N]
Authorization: Bearer tn_key_…Open the socket with the key in the Authorization header, as on every other route. No
cookie, Origin or subprotocol is needed. Browsers cannot set that header on a
WebSocket and the API sends no CORS headers, so connect from a server or a script and
keep the key there.
Every frame is a whole view of the topic, not a change to the one before. Missing a frame, or reconnecting, loses nothing: the next frame is complete. Frames are JSON text:
view("type": "view"): the topic's latest build.seqis one higher per build,vis the frame format (2), andts_msis the build time in epoch milliseconds (the one epoch number in the API; every other instant is ISO-8601). The fields that do not belong to the topic's kind arenull, for examplemarketson abook:topic.control("type": "control",statereconnectingorstale): the source went away, or nothing new came for 30 s. Treat the last view as old until the nextviewarrives. The socket stays open.pong: the bare text answer to yourping, not JSON. Sendpingabout every 20 s so proxies do not drop an idle socket.
The first view comes within a second for a topic someone is already watching. On a
book or asset nobody watches, opening the socket starts the build. The first frame then
comes from that build, never from an older one, and it can hold top-of-book only
(source: "top", note: "rest_loading") until the depth loads a few seconds later.
Topics#
| Topic | Frames carry | Built |
|---|---|---|
book:<asset> |
books: the order book of each of the asset's markets, each venue's main market first, up to 50 [price, size] levels a side (decimal strings), with bid, ask, levels (what the venue's feed holds) and source |
About every second, while someone watches |
asset:<asset> |
markets (fees, funding, mark and index, depth curve, maker quotes), rate (the asset's USD rate and how it was found) and rows (its opportunities) |
About every second, while someone watches |
rates |
rates: every asset's USD rate as [usd, quality, hops, spread_bps, oldest_s, source] |
When the rates are recomputed |
page:<strategy>, page:<strategy>:<n> |
rows: the best 64 opportunities of funding-carry, cash-carry, earn-carry, hedged-taker or hedged-maker; :2, :3, … are the next 64 each |
About every second |
Assets are catalogue ids such as bitcoin: GET /v1/search?search= finds one. The
rates topic holds up to 900 assets. Above that it is published in parts instead,
rates:<c> holding the assets whose id starts with the character c. Then open the
parts you need; rates itself stops updating and turns stale.
Recorded frames, cut to a few entries (open one):
Frame book:bitcoinrecorded 2026-11-25 · books cut to 3 of 115, levels cut to 3 a side
wss://api.tribulnation.com/live/book:bitcoin?depth=5
{
"type": "view",
"seq": 9555,
"v": 2,
"ts_ms": 1795619294902,
"topic": "book:bitcoin",
"plan": "ultra",
"delayed_s": 0,
"status": "ok",
"rows": [],
"truncated": false,
"locked": null,
"withheld": null,
"markets": null,
"rate": null,
"rates": null,
"books": [
{
"segment_id": "aster:perp",
"market": "BTCUSDT",
"kind": "perp",
"quote_asset_id": "tether",
"settlement_asset_id": "tether",
"tier": "core",
"source": "stream",
"note": null,
"error": null,
"bid": "58020",
"ask": "58020.1",
"received_at": "2026-11-25T15:08:14.861Z",
"depth_at": "2026-11-25T15:08:14.713Z",
"levels": 20,
"bids": [
["58020", "0.026"],
["58018.4", "0.002"],
["58015", "0.002"]
],
"asks": [
["58020.1", "3.415"],
["58020.5", "2.626"],
["58020.9", "0.025"]
]
},
{
"segment_id": "aster:spot",
"market": "BTCUSDT",
"kind": "spot",
"quote_asset_id": "tether",
"tier": "core",
"source": "stream",
"note": null,
"error": null,
"bid": "58049.71",
"ask": "58050.3",
"received_at": "2026-11-25T15:08:14.758Z",
"depth_at": "2026-11-25T15:08:14.758Z",
"levels": 20,
"bids": [
["58049.71", "0.08986"],
["58045.64", "0.01583"],
["58015.45", "0.00276"]
],
"asks": [
["58050.3", "0.79433"],
["58052.61", "0.29832"],
["58052.62", "0.07778"]
]
},
{
"segment_id": "binance:spot",
"market": "BTCUSDT",
"kind": "spot",
"quote_asset_id": "tether",
"tier": "core",
"source": "rest",
"note": null,
"error": null,
"bid": "58050",
"ask": "58050.01",
"received_at": "2026-11-25T15:08:14.898Z",
"depth_at": "2026-11-25T15:08:13.900Z",
"levels": 38,
"bids": [
["58050", "0.3566"],
["58045", "4.66259"],
["58040", "9.09131"]
],
"asks": [
["58050.01", "4.33235"],
["58053.29", "1.67685"],
["58053.91", "0.0002"]
]
}
],
"starting": []
}Frame asset:bitcoinrecorded 2026-11-25 · rows cut to 1 of 24, markets cut to 1 of 160
wss://api.tribulnation.com/live/asset:bitcoin
{
"type": "view",
"seq": 5552,
"v": 2,
"ts_ms": 1795619296164,
"topic": "asset:bitcoin",
"plan": "ultra",
"delayed_s": 0,
"status": "ok",
"rows": [
{
"id": "funding-carry:bitcoin:evedex:perp/BTCUSD+gtrade:polygon-usdc/polygon-usdc:BTC/USD",
"strategy": "funding-carry",
"asset_id": "bitcoin",
"symbol": "BTC",
"legs": [
{
"segment_id": "evedex:perp",
"market": "BTCUSD",
"kind": "perp",
"side": "buy",
"quote_asset_id": "tether",
"peg_asset_id": "usd",
"settlement_asset_id": "tether",
"tier": "extended",
"age_s": 0,
"funding_interval_s": 3600
}
],
"tier": "extended",
"age_s": 0,
"headline": {
"apr": 0.854
},
"rank": 74.82,
"edge_bps": -17.7,
"edge_usd_bps": -3.7,
"basis_bps": -14,
"basis": [
"tether",
"usd"
],
"quote_exposure": null,
"kind": "perp",
"pair": "bitcoin|gtrade:polygon-usdc|evedex:perp",
"long": "evedex:perp",
"short": "gtrade:polygon-usdc",
"long_market": "BTCUSD",
"short_market": "polygon-usdc:BTC/USD",
"apr": 0.854,
"long_apr": -0.381,
"short_apr": 0.473,
"entry_bps": -17.7,
"entry_bps_usd": -3.7,
"cost_bps": 20.3,
"cost_bps_usd": 20.3,
"breakeven_s": 104400,
"breakeven_usd_s": 50400,
"size_usd": "100000",
"fees_known": true,
"premium_bps": -7.5,
"premium_bps_usd": 6.5,
"short_funding_apr": 0.493,
"short_borrow_apr": 0.02
}
],
"truncated": false,
"locked": null,
"withheld": null,
"markets": [
{
"segment_id": "aster:perp",
"market": "BTCU",
"kind": "perp",
"quote_asset_id": "united-stables",
"settlement_asset_id": "united-stables",
"tier": "core",
"bid": "58012.5",
"ask": "58020.1",
"bid_qty": "0.368",
"ask_qty": "1.68",
"mark_price": "58041.3",
"index_price": "58062.62511044",
"funding_rate": 0.00002239,
"funding_interval_s": 28800,
"next_funding_at": "2026-11-25T16:00:00.000Z",
"open_interest": null,
"received_at": "2026-11-25T15:08:16.159Z",
"age_s": 0.005,
"ctx_age_s": 0.999,
"live": true,
"taker_fee_bps": 3.5,
"maker_fee_bps": 1,
"fee_source": "configured",
"levels": 20,
"depth_age_s": 0.362,
"curve": null,
"maker": {
"bid": "58002.9",
"ask": "58010.5",
"buy": [
{
"quote": "58326.3",
"vs_best_bps": 55.76,
"join_bps": 55.6,
"filled": 1,
"hedges": [
"bitfinex:spot",
"mexc:spot",
"okx:spot"
]
}
],
"sell": [
{
"quote": "57942.5",
"vs_best_bps": 11.73,
"join_bps": 11.73,
"filled": 1,
"hedges": [
"mexc:perp",
"whitebit:spot"
]
}
]
}
}
],
"rate": {
"usd": "57967.065",
"quality": "ok",
"source": "markets",
"markets": [
{
"segment_id": "binance:spot",
"market": "BTCUSD",
"hop": 1,
"mid": "58028.95"
}
],
"dropped": [
{
"segment_id": "bitfinex:spot",
"market": "BTCUSD",
"mid": "58146"
}
],
"hops": 1,
"spread_bps": 13.1816230475005,
"oldest_s": 7.447
},
"rates": null,
"books": null,
"starting": null
}Frame ratesrecorded 2026-11-25 · rates cut to 3 of 896 assets
wss://api.tribulnation.com/live/rates
{
"type": "view",
"seq": 51692,
"v": 2,
"ts_ms": 1795537279462,
"topic": "rates",
"plan": "ultra",
"delayed_s": 0,
"status": "ok",
"rows": [],
"truncated": false,
"locked": null,
"withheld": null,
"markets": null,
"rate": null,
"rates": {
"0x": [
"0.07570733450000001",
"ok",
2,
7.56510255951487,
4.251,
"markets"
],
"1inch": [
"0.05817",
"ok",
1,
6.87639676809324,
5.248,
"markets"
],
"375ai": [
"0.002635",
"thin",
1,
0,
5.112,
"markets"
]
},
"books": null,
"starting": null
}Frame page:funding-carryrecorded 2026-11-25 · rows cut to 1 of 64
wss://api.tribulnation.com/live/page:funding-carry
{
"type": "view",
"seq": 81947,
"v": 2,
"ts_ms": 1795619273653,
"topic": "page:funding-carry",
"plan": "ultra",
"delayed_s": 0,
"status": "ok",
"rows": [
{
"id": "funding-carry:solayer:bitunix:perp/LAYERUSDT+apex:perp/LAYERUSDT",
"strategy": "funding-carry",
"asset_id": "solayer",
"symbol": "LAYER",
"legs": [
{
"segment_id": "bitunix:perp",
"market": "LAYERUSDT",
"kind": "perp",
"side": "buy",
"quote_asset_id": "tether",
"peg_asset_id": "usd",
"settlement_asset_id": "tether",
"tier": "extended",
"age_s": 0.419,
"funding_interval_s": 14400
}
],
"tier": "extended",
"age_s": 1.018,
"headline": {
"apr": 13.3
},
"rank": 1293.97,
"edge_bps": -31.2,
"edge_usd_bps": -31.2,
"basis_bps": null,
"basis": null,
"quote_exposure": null,
"kind": "perp",
"pair": "solayer|apex:perp|bitunix:perp",
"long": "bitunix:perp",
"short": "apex:perp",
"long_market": "LAYERUSDT",
"short_market": "LAYERUSDT",
"apr": 13.3,
"long_apr": -13.5,
"short_apr": -0.172,
"entry_bps": -31.2,
"entry_bps_usd": -31.2,
"cost_bps": 69.1,
"cost_bps_usd": 69.1,
"breakeven_s": 14400,
"breakeven_usd_s": 14400,
"size_usd": "1000",
"fees_known": true,
"premium_bps": 3.4,
"premium_bps_usd": 3.4,
"hedge": 0
}
],
"truncated": true,
"locked": null,
"withheld": null,
"markets": null,
"rate": null,
"rates": null,
"books": null,
"starting": null
}Book depth and frame size#
?depth=N cuts every book of a book: socket (or snapshot) to its best N levels a side,
1 to 50. Without it you get every level the source holds, up to
50. levels still says how many the source holds. Depth applies to book:
topics only; elsewhere it is refused with 400. A socket that needs the top ten levels
receives about half the bytes:
| Topic | depth | One frame | Holding |
|---|---|---|---|
book:bitcoin | every level (50) | 141 KB | 115 books |
book:bitcoin | 20 | 101 KB | 115 books |
book:bitcoin | 10 | 74 KB | 115 books |
book:bitcoin | 5 | 56 KB | 115 books |
book:bitcoin | 1 | 40 KB | 115 books |
asset:bitcoin | – | 140 KB | 160 markets, 24 rows |
rates | – | 63 KB | 896 assets |
page:funding-carry | – | 75 KB | 64 rows |
Measured on the prototype on 2026-11-25; sizes follow the number of markets and levels the venues hold.
Connection lifecycle#
Every socket gets a grant of 60 s. When it ends, the server closes the socket with 4001. Reconnect at once: the key, its scope and your plan are checked again, and the first frame after the reconnect is the topic's latest build, so nothing is lost. The slot of the closed socket is freed before the close, so the reconnect never counts against the limits twice.
| Close code | Means | Do |
|---|---|---|
4001 |
The socket’s one-minute grant ended: every socket gets it about a minute after it opens; your key and plan are checked again on reconnect. | Reconnect at once |
4401 |
The key was revoked. | Stop; the next open is 401 |
4003 |
The topic is not in your plan. | Stop |
4004 |
Unknown topic. | Stop |
1011 |
The server could not build the topic’s view for this socket. | Reconnect with backoff |
Any other close, or a dropped connection, means: reconnect with backoff (1 s, doubling
to about 30 s, reset after a frame). When a key is revoked on https://app.tribulnation.com/integrations, its
sockets stop receiving frames at once and close with 4401 shortly after.
After a move off Ultra, open sockets run to the end of their grant and the reconnect is
refused with 403: within about a minute and a half.
Refusals#
A socket is refused before it opens, as a plain HTTP answer with the error body every route uses:
{"error": {"code": "rate_limited", "message": "this key already holds 32 live sockets (the limits are 32 sockets and 16 topics per key, 32 sockets per account); close one first"}}| Status | code |
When | Retry? |
|---|---|---|---|
400 |
bad_request |
depth is not a whole number from 1 to 50, or is set on a topic other than book: |
No |
401 |
unauthorized |
No key, or the key is unknown, expired or revoked | No |
403 |
forbidden |
The key has no market:read, the plan is not Ultra, or the topic is not open to keys |
No |
404 |
not_found |
No such topic (page:nope), or an asset the catalogue does not hold |
No |
426 |
upgrade_required |
A plain GET on a socket path: use a WebSocket, or a snapshot |
No |
429 |
rate_limited |
Over a socket limit (Retry-After: 10), or over your account's fair use (Retry-After: 60) |
After Retry-After |
503 |
unavailable |
The live service did not answer | After Retry-After |
Each socket open counts as one request against your account's fair use. Frames on an open socket do not count; the bound there is the socket limits: 32 sockets and 16 distinct topics per key, 32 sockets per account across all its keys. Several sockets may share one topic.
Examples#
The Python client (tribulnation-terminal 0.5.0 or later) and the TypeScript client
(@tribulnation/terminal 0.2.0 or later) do all of the above for you: they send the key,
ping, reconnect at once on 4001, back off on other closes, retry 429 and
5xx after Retry-After, and stop with an error on 4401, 4003,
4004 or a refusal that will not change.
from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
async for frame in t.live.stream('book:bitcoin', depth=10):
if frame['type'] == 'view':
for b in frame['books'][:3]:
print(b['segment_id'], b['bid'], b['ask'])// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
for await (const frame of t.live.stream('book:bitcoin', { depth: 10 })) {
if (frame.type === 'view') console.log(frame.books?.slice(0, 3).map((b) => [b.segment_id, b.bid, b.ask]))
}Without a client, in Python with websockets
(pip install websockets):
import asyncio, contextlib, json, os
from websockets.asyncio.client import connect
from websockets.exceptions import ConnectionClosed, InvalidStatus
URL = 'wss://api.tribulnation.com/live/book:bitcoin?depth=10'
HEADERS = {'Authorization': f'Bearer {os.environ["TN_API_KEY"]}'}
STOP = {4401, 4003, 4004} # revoked, not in plan, unknown topic
async def ping(ws):
with contextlib.suppress(ConnectionClosed):
while True:
await asyncio.sleep(20)
await ws.send('ping')
async def main():
delay = 1
while True:
code = None
try:
async with connect(URL, additional_headers=HEADERS, ping_interval=None, max_size=2**22) as ws:
pinger = asyncio.create_task(ping(ws))
try:
async for text in ws:
if text == 'pong':
continue
frame = json.loads(text)
if frame['type'] == 'view':
delay = 1
for b in frame['books'][:3]:
print(b['segment_id'], b['bid'], b['ask'])
except ConnectionClosed:
pass
finally:
pinger.cancel()
code = ws.close_code
except InvalidStatus as e: # refused before the upgrade
r = e.response
if r.status_code != 429 and r.status_code < 500:
raise SystemExit(f'refused {r.status_code}: {r.body.decode()}')
await asyncio.sleep(float(r.headers.get('Retry-After', delay)))
continue
except OSError:
pass # no connection: back off below
if code == 4001:
continue # the once-a-minute close: reconnect at once
if code in STOP:
raise SystemExit(f'closed {code}')
await asyncio.sleep(delay)
delay = min(delay * 2, 30)
asyncio.run(main())In JavaScript on Node 22 or later, whose built-in WebSocket takes a headers option:
const URL = 'wss://api.tribulnation.com/live/book:bitcoin?depth=10'
const headers = { Authorization: `Bearer ${process.env.TN_API_KEY}` }
const STOP = new Set([4401, 4003, 4004]) // revoked, not in plan, unknown topic
let delay = 1000
function open() {
const ws = new WebSocket(URL, { headers })
let ping
ws.onopen = () => {
ping = setInterval(() => ws.send('ping'), 20_000)
}
ws.onmessage = ({ data }) => {
if (data === 'pong') return
const frame = JSON.parse(data)
if (frame.type !== 'view') return
delay = 1000
for (const b of frame.books.slice(0, 3)) console.log(b.segment_id, b.bid, b.ask)
}
ws.onclose = ({ code }) => {
clearInterval(ping)
if (code === 4001) return open() // the once-a-minute close: reconnect at once
if (STOP.has(code)) return console.error('closed', code)
// A refused open also lands here (1006, without its status): the same key on
// GET /live/book/bitcoin answers why.
setTimeout(open, delay)
delay = Math.min(delay * 2, 30_000)
}
}
open()From a shell, tn terminal watch book:bitcoin --depth 10 prints a refreshing top of book
per venue, and --json one frame per line (Command line). The
MCP server does not stream: its order_book tool reads a fresh book
snapshot (depth 10 unless asked), and an agent that needs a stream writes a program
against this socket.
Snapshots over HTTP#
GET /live/book/{asset} and GET /live/asset/{asset} answer the topic's current view as
data, with age_s and the header Data-Delay-Ms: 0. A read of an asset someone is
watching answers at once. A read of one nobody watches starts its build and waits for
full books, typically 2 to 4 s, at most 3.5 s; if none is ready by then the
answer is 503 with code warming and Retry-After: 2: retry after
that. Each read keeps the asset warm for 30 s, so polling it answers at
once. One account keeps at most 16 assets warm at a time; one more is
429 until the oldest expires (Live freshness). Each read counts
against your fair use. The Python client's t.live.book(asset, depth=) and t.live.asset(asset) retry warming for you.
curl -sH "Authorization: Bearer $TN_API_KEY" "https://api.tribulnation.com/live/book/bitcoin?depth=5"GET/live/book/{asset}
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/live/book/bitcoin?depth=3"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
book = await t.live.book('bitcoin', depth=3)// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const book = await t.live.book('bitcoin', { depth: 3 })Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": {
"v": 2,
"topic": "book:bitcoin",
"plan": "ultra",
"delayed_s": 0,
"status": "ok",
"locked": null,
"withheld": null,
"books": [
{
"segment_id": "aster:perp",
"market": "BTCUSDT",
"kind": "perp",
"quote_asset_id": "tether",
"settlement_asset_id": "tether",
"tier": "core",
"source": "stream",
"note": null,
"error": null,
"bid": "64399.4",
"ask": "64399.5",
"received_at": "2026-11-17T21:30:00.119Z",
"depth_at": "2026-11-17T21:29:59.968Z",
"levels": 20,
"bids": [
[
"64399.4",
"3.097"
],
[
"64398.6",
"1.91"
],
[
"64397.2",
"2.298"
]
],
"asks": [
… 109 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
assetrequiredpathbitcoin); /v1/search finds it.depthResponse 200{ data: { age_s: number; stale: false; v: 2; topic: string; plan: 'free' | 'pro' | 'ultra'; delayed_s: number; status: 'ok' | 'not_ready'; locked: Locked | null; withheld: Withheld | null; books: Book[] | null; starting: string[] | null }; meta: { as_of: string | null } }
data{ age_s: number; stale: false; v: 2; topic: string; plan: 'free' | 'pro' | 'ultra'; delayed_s: number; status: 'ok' | 'not_ready'; locked: Locked | null; withheld: Withheld | null; books: Book[] | null; starting: string[] | null }GET /live/book/{asset}: thebook:<asset>topic's view for the key's plan, never older than the freshness limit.booksholds each venue's order book.age_snumberHow old the build is, seconds (by LiveHub's receipt; served asage_s).stalefalseAlwaysfalse: a stale view is never answered (503 warminginstead).v2The view format’s version, the same as a socket frame’svof this view.topicstringThe topic this view is of (book:bitcoin).plan'free' | 'pro' | 'ultra'The plan the view is cut for.delayed_snumberHow much older than the view’s build time (a frame’sts_ms) the rows are: 0 for live plans and when not ready.status'ok' | 'not_ready'ok, ornot_readybefore the first build.lockedLocked | nullFree's locked rows, as their count and best; null when none.withheldWithheld | nullPro's extended rows, replaced by their count and best; null when none.booksBook[] | nullbooktopics: the books the plan sees (Pro: core venues' only); null for other topics.startingstring[] | nullbooktopics: the snapshot'sstarting, the exchange ids whose feed has not listed its markets yet (a chip's venue there is starting, not unlisted); null for other topics.
meta{ as_of: string | null }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.
GET/live/asset/{asset}
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/live/asset/bitcoin"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
asset = await t.live.asset('bitcoin')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const asset = await t.live.asset('bitcoin')Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": {
"v": 2,
"topic": "asset:bitcoin",
"plan": "ultra",
"delayed_s": 0,
"status": "ok",
"rows": [
{
"id": "funding-carry:bitcoin:evedex:perp/BTCUSD+gtrade:megaeth-usdm/megaeth-usdm:BTC/USD",
"strategy": "funding-carry",
"asset_id": "bitcoin",
"symbol": "BTC",
"legs": [
{
"segment_id": "evedex:perp",
"market": "BTCUSD",
"kind": "perp",
"side": "buy",
"quote_asset_id": "tether",
"peg_asset_id": "usd",
"settlement_asset_id": "tether",
"tier": "extended",
"age_s": 0,
"funding_interval_s": 3600
},
{
"segment_id": "gtrade:megaeth-usdm",
"market": "megaeth-usdm:BTC/USD",
"kind": "perp",
"side": "sell",
"quote_asset_id": "usd",
"peg_asset_id": "usd",
"settlement_asset_id": "megausd",
"tier": "extended",
"age_s": 0.122,
"funding_interval_s": 3600
}
],
"tier": "extended",
… 523 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
assetrequiredpathbitcoin); /v1/search finds it.Response 200{ data: { age_s: number; stale: false; v: 2; topic: string; plan: 'free' | 'pro' | 'ultra'; delayed_s: number; status: 'ok' | 'not_ready'; rows: (TakerRow | FundingCarryRow | CashCarryRow | EarnCarryRow | MakerRow)[]; truncated: boolean; locked:
data{ age_s: number; stale: false; v: 2; topic: string; plan: 'free' | 'pro' | 'ultra'; delayed_s: number; status: 'ok' | 'not_ready'; rows: (TakerRow | FundingCarryRow | CashCarryRow | EarnCarryRow | MakerRow)[]; truncated: boolean; locked: Locked | null; withheld: Withheld | null; markets: Market[] | null; rate: Rate | null; rates: { [key: string]: CompactRate } | null; books: Book[] | null; starting: string[] | null }GET /live/asset/{asset}: theasset:<asset>topic's view for the key's plan (markets,rate,rows), never older than the freshness limit.age_snumberHow old the build is, seconds (by LiveHub's receipt; served asage_s).stalefalseAlwaysfalse: a stale view is never answered (503 warminginstead).v2The view format’s version, the same as a socket frame’svof this view.topicstringThe topic this view is of (book:bitcoin).plan'free' | 'pro' | 'ultra'The plan the view is cut for.delayed_snumberHow much older than the view’s build time (a frame’sts_ms) the rows are: 0 for live plans and when not ready.status'ok' | 'not_ready'ok, ornot_readybefore the first build.rows(TakerRow | FundingCarryRow | CashCarryRow | EarnCarryRow | MakerRow)[]Rows the plan sees with every figure. An asset topic's rows of every strategy, in strategy order, each strategy's best first.truncatedbooleanThe plan sees more rows thanrowsholds (cut atlimit, or the snapshot holds only the best of them): the page reads the rest over HTTP.lockedLocked | nullFree's locked rows, as their count and best; null when none.withheldWithheld | nullPro's extended rows, replaced by their count and best; null when none.marketsMarket[] | nullAsset topics: the markets the plan sees; null for other topics.rateRate | nullAsset topics: the asset's rate (null also when it has none).rates{ [key: string]: CompactRate } | nullratestopics: every rate; null for other topics.booksBook[] | nullbooktopics: the books the plan sees (Pro: core venues' only); null for other topics.startingstring[] | nullbooktopics: the snapshot'sstarting, the exchange ids whose feed has not listed its markets yet (a chip's venue there is starting, not unlisted); null for other topics.
meta{ as_of: string | null }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.
Types 20
Locked2 fields
/** Free's locked rows: one line, their count and best figure (owner, 2026-10-28). … */
export interface Locked {
/** How many rows are locked. */
count: number
/** The best locked row's headline: the teaser line's "up to 42 % APR". */
best: {
apr?: number
edge_bps?: number
}
}Withheld3 fields
export interface Withheld {
/** How many rows are withheld. */
count: number
/** The best withheld row's headline: "up to 38 % APR". */
best: {
apr?: number
edge_bps?: number
}
/** The plan that shows them. */
tier: 'extended'
}Book18 fields
/** One market's order book in a `book:` snapshot. */
export interface Book {
/** Exchange id `<venue>:<exchange>`. */
segment_id: string
/** The venue's own symbol. */
market: string
kind: 'perp' | 'spot'
/** Price-tracking quote, a catalogue asset id. */
quote_asset_id: string
settlement_asset_id?: string
/** As on `Market`: size x price is in `settlement_asset_id`. */
quanto?: true
/** As on `Market`: base units per contract where not 1; levels are per contract. */
multiplier?: number
tier: 'core' | 'extended'
source: 'stream' | 'rest' | 'top'
/** Why a `top` book has no levels; null for `stream` and `rest`. */
note: 'tops_only' | 'rest_loading' | 'rest_failed' | 'rest_over_budget' | null
/** The last REST read's error when `note` is `rest_failed`; else null. */
error: string | null
/** The market's top of book (null when not held). */
bid: Decimal | null
ask: Decimal | null
/** When the top was received. */
received_at: string | null
/** When the levels were received (stream) or read (rest); null for `top`. */
depth_at: string | null
/** Levels the source holds, the deeper side's, before the cut to `bids`/`asks`; null for `top`. */
levels: number | null
/** Best first, at most `TOPIC_LIMITS.bookLevels`; empty for `top`. */
bids: [Decimal, Decimal][]
asks: [Decimal, Decimal][]
}TakerRow33 fields
/** Hedged taker: the tracker's `TakerOpportunity` plus the quote view. */
export interface TakerRow {
/** Stable while the opportunity lasts (row.md). … */
id: string
strategy: 'hedged-taker'
asset_id: string
symbol: string
/** Every leg, the primary leg first. */
legs: Leg[]
/** `extended` when any leg is, else `core`. */
tier: 'core' | 'extended'
/** Receive age of the oldest leg, seconds. */
age_s: number
headline: {
apr?: number
edge_bps?: number
}
/** The number the page sorts and locks by. … */
rank: number
/** The strategy's edge as quoted, bps. */
edge_bps: number | null
/** `edge_bps` with every leg in USD at its quote's rate. */
edge_usd_bps: number | null
/** `edge_bps − edge_usd_bps`; null when the legs share one quote or a rate is missing. */
basis_bps: number | null
/** The two quote asset ids the basis is between. */
basis: [string, string] | null
/** Quotes whose rate moved more than the USD edge over the last hour. */
quote_exposure: string[] | null
/** Hedged taker and maker: the asset class's sanity bound, the largest edge (as quoted or in USD) LiveHub shows of the row. … */
bound_bps?: number
/** Hedged taker and maker: the underlying's market is shut now (a stock or fund outside the US session, forex or a commodity at the weekend). … */
market_closed?: boolean
/** Exchange id taken on. */
taker: string
/** Side taken on `taker`; the hedge is the other side. */
side: 'buy' | 'sell'
buy: string[]
sell: string[]
edges_bps: Ladder
edges_usd_bps: Ladder
capacity: (Decimal | null)[]
capacity_usd: (Decimal | null)[]
best_edge_bps: number | null
best_edge_usd_bps: number | null
profit_usd: Decimal | null
size_usd: Decimal | null
depth: 'full' | 'partial' | 'none'
since_at: string | null
/** The part of the edge that is the legs' index gap, bps. … */
index_bps?: number | null
/** Episode statistics of this row. … */
stats?: TakerStats | null
/** When it was priced. */
time: string | null
}Leg12 fields
/** One leg of a row. */
export interface Leg {
/** Exchange id `<venue>:<exchange>`, or the earn venue for an earn leg. */
segment_id: string
/** The venue's own symbol (or the earn product id). */
market: string
kind: 'perp' | 'spot'
side: 'buy' | 'sell'
/** Price-tracking quote asset. */
quote_asset_id: string
/** The quote's peg family: the asset its `pegged_to` chain ends at (tether. … */
peg_asset_id?: string
/** Settlement asset. */
settlement_asset_id: string
tier: 'core' | 'extended'
/** Receive age of this leg's top, seconds. */
age_s: number
/** The leg is priced from the venue's bulk REST data at a coarse cadence (its age is up to that period), not streamed live. … */
polled?: boolean
/** A carry row's perp leg: the funding interval its funding is annualized over, seconds, as the venue states it or as learned from its settlement cadence. … */
funding_interval_s?: number
/** `funding_hours` is neither stated by the venue nor learned from its settlements, only estimated from the next funding time. … */
funding_interval_guessed?: boolean
}Laddertype
export type Ladder = (number | null)[]TakerStats4 fields
/** A hedged-taker row's episode statistics at `notional` USD (the tracker's `OpportunityStats`). … */
export interface TakerStats {
/** USD notional the episodes count at (the tracker's `STATS_NOTIONAL`). */
notional: '1000'
/** Episodes positive at `notional` that ended in the last 24 hours, or are open. */
n_24h: number
/** Share of the last 24 hours positive at `notional` (an episode that started before the window counts pro rata), 0 to 1, four decimals. */
share_24h: number
/** Median time positive at `notional` per episode over 7 days, seconds, one decimal. */
median_s: number | null
}FundingCarryRow40 fields
export interface FundingCarryRow {
/** Stable while the opportunity lasts (row.md). … */
id: string
strategy: 'funding-carry'
asset_id: string
symbol: string
/** Every leg, the primary leg first. */
legs: Leg[]
/** `extended` when any leg is, else `core`. */
tier: 'core' | 'extended'
/** Receive age of the oldest leg, seconds. */
age_s: number
headline: {
apr?: number
edge_bps?: number
}
/** The number the page sorts and locks by. … */
rank: number
/** The strategy's edge as quoted, bps. */
edge_bps: number | null
/** `edge_bps` with every leg in USD at its quote's rate. */
edge_usd_bps: number | null
/** `edge_bps − edge_usd_bps`; null when the legs share one quote or a rate is missing. */
basis_bps: number | null
/** The two quote asset ids the basis is between. */
basis: [string, string] | null
/** Quotes whose rate moved more than the USD edge over the last hour. */
quote_exposure: string[] | null
/** Hedged taker and maker: the asset class's sanity bound, the largest edge (as quoted or in USD) LiveHub shows of the row. … */
bound_bps?: number
/** Hedged taker and maker: the underlying's market is shut now (a stock or fund outside the US session, forex or a commodity at the weekend). … */
market_closed?: boolean
pair: string
/** Exchange id of the long leg. */
long: string
/** Exchange id of the short leg. */
short: string
long_market: string
short_market: string
/** Funding earned per year, a fraction of the notional. */
apr: number
long_apr: number | null
short_apr: number | null
entry_bps: number | null
entry_bps_usd: number | null
cost_bps: number | null
cost_bps_usd: number | null
breakeven_s: number | null
breakeven_usd_s: number | null
size_usd: Decimal | null
fees_known: boolean
/** Short leg's mid over the long leg's − 1, bps (the tracker's carry `basis_bps`). */
premium_bps: number | null
premium_bps_usd: number | null
/** On a carry page: the row's place among its asset's pairs (one strategy and peg family), 0 its best by rank, 1.. … */
hedge?: number
/** The funding and borrow parts of a leg's APR, set only on a leg whose venue charges borrow. … */
long_funding_apr?: number
long_borrow_apr?: number
short_funding_apr?: number
short_borrow_apr?: number
kind: 'perp'
}CashCarryRow40 fields
export interface CashCarryRow {
/** Stable while the opportunity lasts (row.md). … */
id: string
strategy: 'cash-carry'
asset_id: string
symbol: string
/** Every leg, the primary leg first. */
legs: Leg[]
/** `extended` when any leg is, else `core`. */
tier: 'core' | 'extended'
/** Receive age of the oldest leg, seconds. */
age_s: number
headline: {
apr?: number
edge_bps?: number
}
/** The number the page sorts and locks by. … */
rank: number
/** The strategy's edge as quoted, bps. */
edge_bps: number | null
/** `edge_bps` with every leg in USD at its quote's rate. */
edge_usd_bps: number | null
/** `edge_bps − edge_usd_bps`; null when the legs share one quote or a rate is missing. */
basis_bps: number | null
/** The two quote asset ids the basis is between. */
basis: [string, string] | null
/** Quotes whose rate moved more than the USD edge over the last hour. */
quote_exposure: string[] | null
/** Hedged taker and maker: the asset class's sanity bound, the largest edge (as quoted or in USD) LiveHub shows of the row. … */
bound_bps?: number
/** Hedged taker and maker: the underlying's market is shut now (a stock or fund outside the US session, forex or a commodity at the weekend). … */
market_closed?: boolean
pair: string
/** Exchange id of the long leg. */
long: string
/** Exchange id of the short leg. */
short: string
long_market: string
short_market: string
/** Funding earned per year, a fraction of the notional. */
apr: number
long_apr: number | null
short_apr: number | null
entry_bps: number | null
entry_bps_usd: number | null
cost_bps: number | null
cost_bps_usd: number | null
breakeven_s: number | null
breakeven_usd_s: number | null
size_usd: Decimal | null
fees_known: boolean
/** Short leg's mid over the long leg's − 1, bps (the tracker's carry `basis_bps`). */
premium_bps: number | null
premium_bps_usd: number | null
/** On a carry page: the row's place among its asset's pairs (one strategy and peg family), 0 its best by rank, 1.. … */
hedge?: number
/** The funding and borrow parts of a leg's APR, set only on a leg whose venue charges borrow. … */
long_funding_apr?: number
long_borrow_apr?: number
short_funding_apr?: number
short_borrow_apr?: number
kind: 'spot'
}EarnCarryRow32 fields
/** Earn product held against a perp short (the app's `EarnCarry`, without its display fields, which the app adds from the catalogue). */
export interface EarnCarryRow {
/** Stable while the opportunity lasts (row.md). … */
id: string
strategy: 'earn-carry'
asset_id: string
symbol: string
/** Every leg, the primary leg first. */
legs: Leg[]
/** `extended` when any leg is, else `core`. */
tier: 'core' | 'extended'
/** Receive age of the oldest leg, seconds. */
age_s: number
headline: {
apr?: number
edge_bps?: number
}
/** The number the page sorts and locks by. … */
rank: number
/** The strategy's edge as quoted, bps. */
edge_bps: number | null
/** `edge_bps` with every leg in USD at its quote's rate. */
edge_usd_bps: number | null
/** `edge_bps − edge_usd_bps`; null when the legs share one quote or a rate is missing. */
basis_bps: number | null
/** The two quote asset ids the basis is between. */
basis: [string, string] | null
/** Quotes whose rate moved more than the USD edge over the last hour. */
quote_exposure: string[] | null
/** Hedged taker and maker: the asset class's sanity bound, the largest edge (as quoted or in USD) LiveHub shows of the row. … */
bound_bps?: number
/** Hedged taker and maker: the underlying's market is shut now (a stock or fund outside the US session, forex or a commodity at the weekend). … */
market_closed?: boolean
venue_id: string
instrument: string
earn_apr: number
lock_s: number | null
tags: string[]
max_qty: Decimal | null
max_usd: Decimal | null
url: string | null
perp: PerpFunding
combined_apr: number
entry_bps: number | null
entry_bps_usd: number | null
cost_bps: number | null
cost_bps_usd: number | null
breakeven_s: number | null
breakeven_usd_s: number | null
}PerpFunding11 fields
/** The tracker's `PerpFunding`: the perp of an asset whose funding pays a short most. */
export interface PerpFunding {
asset_id: string
symbol: string
segment_id: string
market: string
funding_apr: number
funding_interval_s: number | null
bid_usd: Decimal | null
taker_fee_bps: number | null
perps: number
/** The funding and borrow parts of `funding_apr`, set only where the perp's venue charges borrow. … */
short_funding_apr?: number
short_borrow_apr?: number
}MakerRow29 fields
/** Hedged maker quote: the tracker's `MakerOpportunity`. */
export interface MakerRow {
/** Stable while the opportunity lasts (row.md). … */
id: string
strategy: 'hedged-maker'
asset_id: string
symbol: string
/** Every leg, the primary leg first. */
legs: Leg[]
/** `extended` when any leg is, else `core`. */
tier: 'core' | 'extended'
/** Receive age of the oldest leg, seconds. */
age_s: number
headline: {
apr?: number
edge_bps?: number
}
/** The number the page sorts and locks by. … */
rank: number
/** The strategy's edge as quoted, bps. */
edge_bps: number | null
/** `edge_bps` with every leg in USD at its quote's rate. */
edge_usd_bps: number | null
/** `edge_bps − edge_usd_bps`; null when the legs share one quote or a rate is missing. */
basis_bps: number | null
/** The two quote asset ids the basis is between. */
basis: [string, string] | null
/** Quotes whose rate moved more than the USD edge over the last hour. */
quote_exposure: string[] | null
/** Hedged taker and maker: the asset class's sanity bound, the largest edge (as quoted or in USD) LiveHub shows of the row. … */
bound_bps?: number
/** Hedged taker and maker: the underlying's market is shut now (a stock or fund outside the US session, forex or a commodity at the weekend). … */
market_closed?: boolean
segment_id: string
market: string
side: 'buy' | 'sell'
/** Break-even quote price per base unit, in the market's quote. */
quote: Decimal | null
quote_usd: Decimal | null
vs_best_bps: number | null
join_bps: number | null
join_bps_usd: number | null
filled: number | null
hedges: string[]
spread_bps: number
maker_fee_bps: number
time: string | null
}Market37 fields
/** One market of an asset, in store units; null is unknown (0.2 item 2). */
export interface Market {
/** Exchange id `<venue>:<exchange>`. */
segment_id: string
/** The venue's own symbol. */
market: string
kind: 'perp' | 'spot'
/** Price-tracking quote, a catalogue asset id. */
quote_asset_id: string
/** Differs from `quote_asset_id` where the index tracks another currency than the margin (Lighter BTC. … */
settlement_asset_id?: string
/** The catalogue perpetual's `quanto`. … */
quanto?: true
/** The catalogue's base units per contract where not 1. … */
multiplier?: number
tier: 'core' | 'extended'
bid: Decimal | null
ask: Decimal | null
bid_qty: Decimal | null
ask_qty: Decimal | null
/** Perp context; null on spot. */
mark_price: Decimal | null
index_price: Decimal | null
/** Funding rate per interval, a fraction. */
funding_rate: number | null
funding_interval_s: number | null
/** The instant of the next funding. */
next_funding_at: string | null
/** Open interest, base units. */
open_interest: Decimal | null
/** When the top was received. */
received_at: string | null
/** Receive age of the top when the snapshot was built, seconds. */
age_s: number | null
/** Receive age of the perp context (mark, index, funding, interval, next funding, oi) when the snapshot was built, seconds. … */
ctx_age_s: number | null
/** The venue's impact bid and ask where its context carries them (Hyperliquid's impactPxs); absent elsewhere. */
impact_bid?: Decimal
impact_ask?: Decimal
/** One interval's funding rate bounds where the venue states them per market (Binance's and Aster's fundingInfo). … */
funding_cap?: number
funding_floor?: number
/** The short side's own funding rate per interval (+ = shorts pay) where the venue charges each side its own (gTrade. … */
funding_short?: number
/** The fee per interval a long pays the venue to hold, on top of funding (gTrade's borrowing fee to its vault. … */
borrow?: number
/** The same for a short; set with `borrow`. */
borrow_short?: number
/** The market's feed is connected and its top fresh (not the context: `ctx_age_s`). */
live: boolean
/** The top is the venue's bulk REST data at a coarse cadence, not a stream. Absent: streamed. */
polled?: boolean
/** Taker fee, bps of notional; null when VM-live prices the market with no fees. */
taker_fee_bps: number | null
/** Maker fee of a buy, bps of notional (negative a rebate); null as `taker_fee_bps`. */
maker_fee_bps: number | null
/** Where the fees come from: `api` the venue's public API, read with its listing. … */
fee_source: 'standard' | 'configured' | 'api' | null
/** Book levels held, the deeper side's; null for a feed that keeps tops only. */
levels: number | null
/** Receive age of the held levels when the snapshot was built, seconds; null as `levels`. */
depth_age_s: number | null
/** The held book's curve points (0.7 item 7). … */
curve: MarketCurve | null
/** The market's break-even maker quotes at `MAKER_NOTIONALS`; null when the pricer does not price the market. */
maker: MarketMaker | null
}MarketCurve6 fields
/** A market's curve points as `curve_ticks` stores them (0.7 item 7. … */
export interface MarketCurve {
bid: Decimal
ask: Decimal
/** Seven points, one per `CURVE_NOTIONALS_USD`. */
bid_ppm: (number | null)[]
ask_ppm: (number | null)[]
/** US dollars the held levels of each side hold, rounded. */
bid_depth_usd: Decimal
ask_depth_usd: Decimal
}MarketMaker4 fields
/** A market's maker ladder: its top per base unit and each side at each `MAKER_NOTIONALS` notional (null. … */
export interface MarketMaker {
bid: Decimal
ask: Decimal
/** Five entries, one per `MAKER_NOTIONALS`: quoting the bid. */
buy: (MakerSide | null)[]
/** Quoting the ask. */
sell: (MakerSide | null)[]
}MakerSide5 fields
/** One side of a maker market at one notional (the tracker's `MakerSideWire`). */
export interface MakerSide {
/** Break-even quote per base unit, in the market's quote (as 0.1 maker rows). */
quote: Decimal
/** Bps inside the best bid or ask (positive: inside). */
vs_best_bps: number
/** Bps edge of a fill at the best bid or ask itself, net of every fee. */
join_bps: number
/** Share of the notional the hedge absorbs, 0 to 1. */
filled: number
/** Hedge exchange ids, largest slice first. */
hedges: string[]
}Rate10 fields
export interface Rate {
/** US dollars per unit of the asset. */
usd: Decimal
quality: 'ok' | 'thin' | 'peg' | 'ecb' | 'aggregator'
source: 'markets' | 'peg' | 'ecb' | 'aggregator'
/** Kept estimates, sorted by exchange then market; empty unless `source` is `markets`. */
markets: RateMarket[]
/** Outliers dropped, sorted by exchange then market. Ineligible markets are listed nowhere. */
dropped: RateDropped[]
/** The largest hop kept; 0 for the fallbacks. */
hops: number
/** Range of the kept estimates in bps of `usd`; 0 for one estimate. */
spread_bps: number
/** Age in seconds, when the rate is computed, of the oldest input behind the kept estimates. */
oldest_s: number
/** ECB reference date `YYYY-MM-DD`; only when `source` is `ecb`. */
ref_date?: string
/** The ECB note: market rate vs ECB rate in bps, only for a fiat priced from markets more than 200 bps from its ECB rate. */
ecb_diff_bps?: number
}RateMarket4 fields
/** One kept estimate's market. `mid` is the market's own mid, in its quote. */
export interface RateMarket {
/** Exchange id `<venue>:<exchange>`. */
segment_id: string
/** The venue's own symbol. */
market: string
/** Markets between this estimate and the anchor, 1 to 3. */
hop: number
mid: Decimal
}RateDropped3 fields
/** One estimate dropped as an outlier. */
export interface RateDropped {
segment_id: string
market: string
mid: Decimal
}CompactRatetype
/** A rate in compact form: `[usd, quality, hops, spread_bps, oldest_s, source]`. … */
export type CompactRate = [Decimal, 'ok' | 'thin' | 'peg' | 'ecb' | 'aggregator', number, number, number, 'markets' | 'peg' | 'ecb' | 'aggregator']Live JSON#
GET/live/opportunities
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/live/opportunities"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
opportunities = await t.get('/live/opportunities')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const opportunities = await t.live.opportunities()Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": {
"delayed_s": 0,
"plan": "ultra",
"notionals": [
"250",
"1000",
"2500",
"5000",
"10000",
"25000",
"50000",
"100000"
],
"stats_notional": "1000",
"maker_notional": "10000",
"taker": [
{
"id": "hedged-taker:usd:toobit:perp/USDJPY-SWAP-USDT:sell",
"strategy": "hedged-taker",
"asset_id": "usd",
"symbol": "USD",
"legs": [
{
"segment_id": "toobit:perp",
"market": "USDJPY-SWAP-USDT",
"kind": "perp",
"side": "sell",
"quote_asset_id": "japanese-yen",
"peg_asset_id": "japanese-yen",
"settlement_asset_id": "tether",
"tier": "extended",
"age_s": 1.76,
"polled": true
},
{
"segment_id": "toobit:perp",
"market": "USDBRL-SWAP-USDT",
"kind": "perp",
"side": "buy",
… 975 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
limitcursormeta.page.next_cursor.Response 200{ data: { delayed_s: number; plan: 'free' | 'pro' | 'ultra'; notionals: Decimal[]; stats_notional: Decimal; maker_notional: Decimal; taker: (TakerRow | FundingCarryRow | CashCarryRow | EarnCarryRow | MakerRow)[]; carry: (TakerR
data{ delayed_s: number; plan: 'free' | 'pro' | 'ultra'; notionals: Decimal[]; stats_notional: Decimal; maker_notional: Decimal; taker: (TakerRow | FundingCarryRow | CashCarryRow | EarnCarryRow | MakerRow)[]; carry: (TakerRow | FundingCarryRow | CashCarryRow | EarnCarryRow | MakerRow)[]; earn: (TakerRow | FundingCarryRow | CashCarryRow | EarnCarryRow | MakerRow)[]; maker: (TakerRow | FundingCarryRow | CashCarryRow | EarnCarryRow | MakerRow)[]; strategies: { 'funding-carry': LiveStrategyState; 'cash-carry': LiveStrategyState; 'earn-carry': LiveStrategyState; 'hedged-taker': LiveStrategyState; 'hedged-maker': LiveStrategyState }; live: boolean; error: null }GET /live/opportunities: every strategy's rows the key's plan sees, ranked.delayed_snumberHow much older thanmeta.as_ofthe rows are, seconds: 0 for live plans.plan'free' | 'pro' | 'ultra'The plan the key reads at.notionalsDecimal[]The trade sizes (USD) each row's figures are given for.stats_notionalDecimalThe size (USD) the headline statistics use.maker_notionalDecimalThe size (USD) hedged maker quotes are sized for.taker(TakerRow | FundingCarryRow | CashCarryRow | EarnCarryRow | MakerRow)[]Hedged taker arbitrage rows (buy on one venue, sell on another, now).carry(TakerRow | FundingCarryRow | CashCarryRow | EarnCarryRow | MakerRow)[]Funding carry and cash and carry rows.earn(TakerRow | FundingCarryRow | CashCarryRow | EarnCarryRow | MakerRow)[]Earn carry rows (an earn product hedged with a perp).maker(TakerRow | FundingCarryRow | CashCarryRow | EarnCarryRow | MakerRow)[]Hedged maker quote rows.strategies{ 'funding-carry': LiveStrategyState; 'cash-carry': LiveStrategyState; 'earn-carry': LiveStrategyState; 'hedged-taker': LiveStrategyState; 'hedged-maker': LiveStrategyState }What each strategy said.livebooleanAlwaystrue: these are live rows.errornullAlwaysnullon a 200.
meta{ as_of: string | null; assets?: Record<string, unknown>; page?: { limit: number; has_more: boolean; next_cursor: string | null; total?: number } }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.assetsoptionalRecord<string, unknown>The assets the answer names, by id.pageoptional{ limit: number; has_more: boolean; next_cursor: string | null; total?: number }Where this page is: passnext_cursorback ascursor(null: the last page).
GET/live/opportunities/{asset}
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/live/opportunities/bitcoin"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
opportunities = await t.get('/live/opportunities/bitcoin')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const opportunities = await t.live.opportunities('bitcoin')Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": {
"asset_id": "bitcoin",
"plan": "ultra",
"delayed_s": 0,
"markets": [
{
"segment_id": "aster:perp",
"market": "BTCU",
"kind": "perp",
"quote_asset_id": "united-stables",
"settlement_asset_id": "united-stables",
"tier": "core",
"bid": "63976.7",
"ask": "63985",
"bid_qty": "1.523",
"ask_qty": "0.21",
"mark_price": "63989.44036651",
"index_price": "64014.51324727",
"funding_rate": 0.00001277,
"funding_interval_s": 28800,
"next_funding_at": "2026-11-18T00:00:00.000Z",
"open_interest": null,
"received_at": "2026-11-17T21:03:34.313Z",
"age_s": 0.085,
"ctx_age_s": 0.242,
"live": true,
"taker_fee_bps": 3.5,
"maker_fee_bps": 1,
"fee_source": "configured",
"levels": 20,
"depth_age_s": 0.287,
"curve": null,
"maker": {
"bid": "63976.7",
"ask": "63980.1",
"buy": [
{
"quote": "69589.7",
"vs_best_bps": 877.35,
… 535 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
assetrequiredpathbitcoin); /v1/search finds it.Response 200{ data: { asset_id: string; plan: 'free' | 'pro' | 'ultra'; delayed_s: number; markets: Market[] | null; rate: Rate | null; rows: (TakerRow | FundingCarryRow | CashCarryRow | EarnCarryRow | MakerRow)[];
data{ asset_id: string; plan: 'free' | 'pro' | 'ultra'; delayed_s: number; markets: Market[] | null; rate: Rate | null; rows: (TakerRow | FundingCarryRow | CashCarryRow | EarnCarryRow | MakerRow)[]; withheld: Withheld | null; truncated: boolean; live: boolean; error: null }GET /live/opportunities/{asset}: one asset's markets (fees, depth curve, maker ladder), its rate and its rows, for the key's plan.asset_idstringThe catalogue asset id.plan'free' | 'pro' | 'ultra'The plan the key reads at.delayed_snumberHow much older thanmeta.as_ofthe rows are, seconds: 0 for live plans.marketsMarket[] | nullThe asset's markets the plan sees.rateRate | nullThe asset's USD rate (null when it has none).rows(TakerRow | FundingCarryRow | CashCarryRow | EarnCarryRow | MakerRow)[]The asset's opportunity rows, every strategy, each strategy's best first.withheldWithheld | nullPro's extended rows, replaced by their count and best; null when none.truncatedbooleanThe asset has more rows thanrowsholds.livebooleanAlwaystrue: these are live rows.errornullAlwaysnullon a 200.
meta{ as_of: string | null }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.
GET/live/funding
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/live/funding"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
funding = await t.get('/live/funding')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const funding = await t.live.funding()Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": {
"end": "2026-11-14T00:00:00.000Z",
"pairs": [
{
"key": "applied-optoelectronics|hyperliquid:para|mexc:perp",
"asset_id": "applied-optoelectronics",
"symbol": "AAOI",
"source": "catalogue",
"a": {
"segment_id": "hyperliquid:para",
"market": "para:AAOI",
"funding_interval_s": 3600,
"current": 43.8,
"avg_7d": -0.0263219280714286,
"history": "ticks"
},
"b": {
"segment_id": "mexc:perp",
"market": "AAOISTOCK_USDT",
"funding_interval_s": 28800,
"current": 0,
"avg_7d": 0.0790485714285714,
"history": "ticks"
},
"long": "a",
"current": -43.8,
"avg_1d": -0.10178463,
"avg_7d": 0.1053704995,
"avg_30d": -0.212272577933333,
"stable_7d": 0.571428571428571,
"stable_30d": 0.566666666666667,
"history_s": 2592000,
"carry": 0.1053704995,
"carry_window": "7d",
"round_trip_bps": 68.4,
"fees_known": true,
"top_size": null,
"sizes": {
"a": null,
… 962 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
venuessegment_id before :), at most 200; venue_match says whether both legs or one must be on them. Ids in no pair are listed in meta.unmatched.venue_matchall (default): both legs on a listed venue, pairs the caller can trade there; any: at least one leg.assetsmin_aprcarry when sort is rank or breakeven) is at least this, a fraction a year (0.1 = 10 %).sortrank (default): the Opportunities page’s order; a figure (carry, current, avg_1d, avg_7d, avg_30d) highest first; breakeven shortest breakeven_s first. Pairs without the figure go last.limitmeta.page.total says how many pairs match.cursormeta.page.next_cursor, sent with the same filters and sort (a cursor of other filters is refused).Response 200{ data: { end: string | null; pairs: FundingRow[]; settlements_error?: string | null; locked: Locked | null; withheld: Withheld | null; others?: { [key: string]: number }; filter?: string; short?: boolean; teaser?: { total: number; best: { apr?: number; edge_bps?: number } } }; meta: { as_of: string | null; assets?: R
data{ end: string | null; pairs: FundingRow[]; settlements_error?: string | null; locked: Locked | null; withheld: Withheld | null; others?: { [key: string]: number }; filter?: string; short?: boolean; teaser?: { total: number; best: { apr?: number; edge_bps?: number } } }The overview as a plan gets it: its pairs, what the plan holds back of them, and per asset the pairs on the filter's venues it does not list.endstring | nullEndpairsFundingRow[]settlements_erroroptionalstring | nulllockedLocked | nullFree: the page's locked rows, left out ofpairs(their count and best only).withheldWithheld | nullPro: the page's extended-venue rows, left out ofpairs(their count and best).othersoptional{ [key: string]: number }Per asset: pairs on the filter's venues the overview does not list.filteroptionalstringThe reader's filter the pairs were cut under. The reader's filter the pairs were cut under (afilterKey).shortoptionalbooleanLiveHub's read was short of its rows (bodies late): read again soon (#446b). True when LiveHub's read was short of its rows (bodies late): not cached, the page reads it again soon (#446b).teaseroptional{ total: number; best: { apr?: number; edge_bps?: number } }A signed-out visitor's teaser:pairsare the best few only;totalis how many a free account lists,bestthe best figure among them. A signed-out visitor's teaser:pairsholds the top few only;totalis how many a free account lists,bestthe best figure among them (Free's delayed view: its locked best rows are not in it).
meta{ as_of: string | null; assets?: Record<string, unknown>; page?: { limit: number; has_more: boolean; next_cursor: string | null; total?: number }; unmatched?: { venues?: string[]; assets?: string[] } }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.assetsoptionalRecord<string, unknown>The assets the answer names, by id.pageoptional{ limit: number; has_more: boolean; next_cursor: string | null; total?: number }Where this page is: passnext_cursorback ascursor(null: the last page).unmatchedoptional{ venues?: string[]; assets?: string[] }Thevenuesandassetsasked for that are in no row of the plan's whole answer (a typo, or nothing live there); absent when every id matched.
GET/live/funding/history
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/live/funding/history?pair=bitcoin|binance|hyperliquid"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
funding_history = await t.get(
'/live/funding/history',
pair='bitcoin|binance|hyperliquid',
)// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const fundingHistory = await t.live.funding.history('bitcoin|binance|hyperliquid')No recorded answer: none recorded yet.
Parameters
pairrequired/live/funding lists it: <asset>|<segment A>|<segment B>.Response 200{ data: { a: (number | null)[]; b: (number | null)[]; avg_1d: (number | null)[]; avg_7d: (number | null)[]; spread: (number | null)[]; cumulative: number[]; pair: FundingRow; settlements_error?: string | null; borrow_included?: true; other?: { avg_1d: (number | null)[]; avg_7d: (number | null)[]; spread: (number | null)[]; cumulative: number[]; pair:
data{ a: (number | null)[]; b: (number | null)[]; avg_1d: (number | null)[]; avg_7d: (number | null)[]; spread: (number | null)[]; cumulative: number[]; pair: FundingRow; settlements_error?: string | null; borrow_included?: true; other?: { avg_1d: (number | null)[]; avg_7d: (number | null)[]; spread: (number | null)[]; cumulative: number[]; pair: FundingRow } }a(number | null)[]Ab(number | null)[]Bavg_1d(number | null)[]Avg 1Davg_7d(number | null)[]Avg 7Dspread(number | null)[]Spreadcumulativenumber[]CumulativepairFundingRowsettlements_erroroptionalstring | nullborrow_includedoptionaltrueotheroptional{ avg_1d: (number | null)[]; avg_7d: (number | null)[]; spread: (number | null)[]; cumulative: number[]; pair: FundingRow }
meta{ as_of: string | null }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.
GET/live/funding/perps
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/live/funding/perps"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
perps = await t.get('/live/funding/perps')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const perps = await t.live.funding.perps()Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": {
"perps": [
{
"asset_id": "applied-optoelectronics",
"symbol": "AAOI",
"segment_id": "hyperliquid:para",
"market": "para:AAOI",
"funding_apr": 43.8,
"funding_interval_s": null,
"bid_usd": null,
"taker_fee_bps": null,
"perps": 4
},
{
"asset_id": "ciena",
"symbol": "CIEN",
"segment_id": "hyperliquid:para",
"market": "para:CIEN",
"funding_apr": 43.8,
"funding_interval_s": null,
"bid_usd": null,
"taker_fee_bps": null,
"perps": 4
},
{
"asset_id": "reddit",
"symbol": "RDDT",
"segment_id": "hyperliquid:para",
"market": "para:RDDT",
"funding_apr": 43.8,
"funding_interval_s": null,
"bid_usd": null,
"taker_fee_bps": null,
"perps": 4
}
]
},
"meta": {
"as_of": "2026-11-17T21:29:42.630Z",
… 28 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
venuesmeta.unmatched.assetsmin_aprfunding_apr is at least this, a fraction a year (0.1 = 10 %).sortrank (default): the app’s order; funding_apr highest first.limitmeta.page.total says how many perps match.cursormeta.page.next_cursor, sent with the same filters and sort (a cursor of other filters is refused).Response 200{ data: { perps: { asset_id: string; symbol: string; segment_id: string; market: string; funding_apr: number; funding_interval_s: number | null; bid_usd: Decimal | null; taker_fee_bps: number | null; perps: number }[] }; meta: { as_of: string | null; assets?: Record<string, unknown>; page?: { limit: number; has_more: boolean; next_cursor: string | null; total?: number }; unmatched?: { venues
data{ perps: { asset_id: string; symbol: string; segment_id: string; market: string; funding_apr: number; funding_interval_s: number | null; bid_usd: Decimal | null; taker_fee_bps: number | null; perps: number }[] }perps{ asset_id: string; symbol: string; segment_id: string; market: string; funding_apr: number; funding_interval_s: number | null; bid_usd: Decimal | null; taker_fee_bps: number | null; perps: number }[]Perps
meta{ as_of: string | null; assets?: Record<string, unknown>; page?: { limit: number; has_more: boolean; next_cursor: string | null; total?: number }; unmatched?: { venues?: string[]; assets?: string[] } }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.assetsoptionalRecord<string, unknown>The assets the answer names, by id.pageoptional{ limit: number; has_more: boolean; next_cursor: string | null; total?: number }Where this page is: passnext_cursorback ascursor(null: the last page).unmatchedoptional{ venues?: string[]; assets?: string[] }Thevenuesandassetsasked for that are in no row of the plan's whole answer (a typo, or nothing live there); absent when every id matched.
GET/live/spreads/history
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/live/spreads/history?pair=bitcoin|binance:usdm|hyperliquid:"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
spreads_history = await t.get(
'/live/spreads/history',
pair='bitcoin|binance:usdm|hyperliquid:',
)// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const spreadsHistory = await t.live.spreads.history('bitcoin|binance:usdm|hyperliquid:')No recorded answer: none recorded yet.
Parameters
pairrequired<asset>|<segment A>|<segment B>, optionally with /<market> after a segment.fromto).toResponse 200{ data: { pair: string; asset_id: string; symbol: string; segment_id_a: string; market_a: string; segment_id_b: string; market_b: string; bucket_s: number; ab_last_bps: (number | null)[]; ab_max_bps: (number | null)[]; ba_last_bps: (number | null)[]; ba_max_bps: (number | null)[]; mid_diff_bps: (number | null)[]; index_diff_bps: (number | null)[]; premium_diff_bps: (number | null)[]; funding_a: (n
data{ pair: string; asset_id: string; symbol: string; segment_id_a: string; market_a: string; segment_id_b: string; market_b: string; bucket_s: number; ab_last_bps: (number | null)[]; ab_max_bps: (number | null)[]; ba_last_bps: (number | null)[]; ba_max_bps: (number | null)[]; mid_diff_bps: (number | null)[]; index_diff_bps: (number | null)[]; premium_diff_bps: (number | null)[]; funding_a: (number | null)[]; funding_b: (number | null)[]; index_a: (Decimal | null)[]; index_b: (Decimal | null)[] }pairstringPairasset_idstringAssetsymbolstringSymbolsegment_id_astringLeg A's segment id (<venue>:<segment>).market_astringLeg A's venue market symbol.segment_id_bstringLeg B's segment id (<venue>:<segment>).market_bstringLeg B's venue market symbol.bucket_snumberBucket width, secondsab_last_bps(number | null)[]Buy on A, sell on B: the edge net of taker fees, bps, the bucket's mean of its minute-end edges.ab_max_bps(number | null)[]Buy on A, sell on B: the bucket's largest minute-end edge net of taker fees, bps.ba_last_bps(number | null)[]Buy on B, sell on A: the edge net of taker fees, bps, the bucket's mean of its minute-end edges.ba_max_bps(number | null)[]Buy on B, sell on A: the bucket's largest minute-end edge net of taker fees, bps.mid_diff_bps(number | null)[]A's mid over B's, bps.index_diff_bps(number | null)[]A's index over B's, bps (a spot leg's mid is its index).premium_diff_bps(number | null)[]mid_diff_bpslessindex_diff_bps: the legs' premium gap, bps.funding_a(number | null)[]Leg A's funding rate, annualized (a fraction).funding_b(number | null)[]Leg B's funding rate, annualized (a fraction).index_a(Decimal | null)[]Index Aindex_b(Decimal | null)[]Index B
meta{ as_of: string | null }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.
GET/live/exchanges
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/live/exchanges"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
exchanges = await t.get('/live/exchanges')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const exchanges = await t.live.exchanges()Response 200recorded 2026-11-17 · arrays cut to 3 rows
{
"data": [
{
"id": "dydx:perp",
"kind": "perp",
"venue_id": "dydx",
"venue_type": "dex",
"icon_url": "https://catalogue.tribulnation.com/icons/asset/dydx.svg",
"rank": 1,
"slot": 1,
"badge": null,
"listed": 57,
"tradable": 57,
"paired": 10,
"name": "dYdX"
},
{
"id": "hyperliquid:",
"kind": "perp",
"venue_id": "hyperliquid",
"venue_type": "dex",
"icon_url": "https://catalogue.tribulnation.com/icons/asset/hyperliquid.svg",
"rank": 2,
"slot": 2,
"badge": null,
"listed": 179,
"tradable": 179,
"paired": 117,
"name": "HL"
},
{
"id": "hyperliquid:io",
"kind": "perp",
"venue_id": "hyperliquid",
"venue_type": "dex",
"icon_url": "https://catalogue.tribulnation.com/icons/asset/hyperliquid.svg",
"rank": 3,
"slot": 3,
"badge": "io",
"listed": 16,
… 9 more lines: the whole answer is this operation’s example in /openapi.jsonResponse 200{ data: ExchangeInfo[]; meta: { as_of: string | null } }
dataExchangeInfo[]idstringIdkindstringKindvenue_idstringVenuevenue_type'cex' | 'dex' | nullVenue Typeicon_urlstring | nullIconslotnumber | nullSlotbadgestring | nullBadgelistednumberListedtradablenumberTradablepairednumberPairedranknumber | nulldelistedoptionalbooleannamestringLabel
meta{ as_of: string | null }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.
GET/live/profile
#curl -sH "Authorization: Bearer $TN_API_KEY" \
"https://api.tribulnation.com/live/profile?asset=bitcoin&venue=hyperliquid"from tribulnation.terminal import Terminal
async with Terminal.new() as t: # reads TN_API_KEY
profile = await t.live.profile(asset='bitcoin', venue='hyperliquid')// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const profile = await t.live.profile({ asset: 'bitcoin', venue: 'hyperliquid' })Response 200recorded 2026-11-17
{
"data": {
"asset_id": "bitcoin",
"markets": [
{
"segment_id": "hyperliquid:",
"market": "BTC",
"venue_id": "hyperliquid",
"quote_asset_id": "tether",
"settlement_asset_id": "usd-coin",
"quanto": false,
"live": {
"index_price": "64435",
"mark_price": "64411",
"funding_rate": 0.0000125,
"funding_apr": 0.1095,
"funding_interval_s": 3600,
"next_funding_at": "2026-11-17T22:00:00.000Z",
"open_interest": "37597.76902",
"premium": -0.000372468378986524,
"ctx_age_s": 13.814,
"connected": true,
"impact_bid": "64399.5",
"impact_ask": "64410",
"funding_cap": null,
"funding_floor": null,
"funding_short": null,
"borrow": null,
"borrow_short": null
},
"formula": {
"venue_id": "hyperliquid",
"name": "Hyperliquid",
"funding": {
"funding_interval_s": 3600,
"cap": [
-0.04,
0.04
],
"clamp": 0.0005,
… 39 more lines: the whole answer is this operation’s example in /openapi.jsonParameters
assetrequiredbitcoin).venuehyperliquid).marketBTC).windowvenue and market).Response 200{ data: { asset_id: string; markets: MarketProfile[]; more: number }; meta: { as_of: string | null } }
data{ asset_id: string; markets: MarketProfile[]; more: number }GET /live/profile: perp markets' funding profiles.asset_idstringThe catalogue asset id.marketsMarketProfile[]One profile per matching perp market (at most a few).morenumberHow many more markets matched thanmarketsholds.
meta{ as_of: string | null }as_ofstring | nullWhen the data is current as of: its build or update time, else the answer’s.
Types 8
LiveStrategyState4 fields
/** What one strategy said in a `/live/opportunities` answer. */
export interface LiveStrategyState {
/** `ok`: rows below; `not_ready`: not published yet; `not_in_plan`: the plan does not include it. */
status: 'ok' | 'not_ready' | 'not_in_plan'
/** How many rows of this strategy the answer holds. */
rows: number
/** Free's locked rows (count and best), else null. */
locked: Locked | null
/** Pro's extended rows (count and best), else null. */
withheld: Withheld | null
}FundingRow23 fields
export interface FundingRow {
/** Symbol */
symbol: string
/** Key */
key: string
/** Asset */
asset_id: string
/** Source */
source: 'catalogue' | 'alias' | 'inferred' | 'rejected'
/** Long */
long: 'a' | 'b'
/** Current */
current: number | null
/** Avg 1D */
avg_1d: number | null
/** Avg 7D */
avg_7d: number | null
/** Avg 30D */
avg_30d: number | null
/** Stable 7D */
stable_7d: number | null
/** Stable 30D */
stable_30d: number | null
/** Seconds of history */
history_s: number
/** Carry */
carry: number | null
/** Carry Window */
carry_window: '7d' | '1d' | 'now' | null
/** Round Trip */
round_trip_bps: number | null
/** Fees Known */
fees_known: boolean
/** Top Size */
top_size: Decimal | null
/** Breakeven Days */
breakeven_s: number | null
a: FundingLeg
b: FundingLeg
/** Top-of-book size (USD) when long leg `a` / long leg `b`. … */
sizes?: {
a: Decimal | null
b: Decimal | null
}
/** The pair's place among its asset's pairs on the page. … */
hedge?: number | null
/** The edge of entering the side the pair's live row faces now (its `entry_bps`), with that side. … */
entry?: {
long: 'a' | 'b'
bps: number
} | null
}FundingLeg9 fields
export interface FundingLeg {
/** Exchange */
segment_id: string
/** Market */
market: string
/** Interval, seconds */
funding_interval_s: number | null
/** Current */
current: number | null
/** Avg 7D */
avg_7d: number | null
/** History */
history: 'ticks' | 'quotes' | null
unread?: boolean
partial?: boolean
/** No known interval (`interval_hours` null) but VM-live annualized the current funding over this estimate, hours. */
interval_guessed?: number
}ExchangeInfo13 fields
/** Such a row is kept so its id still resolves (a held position, a saved chart line. … */
export interface ExchangeInfo {
/** Id */
id: string
/** Kind */
kind: string
/** Venue */
venue_id: string
/** Venue Type */
venue_type: 'cex' | 'dex' | null
/** Icon */
icon_url: string | null
/** Slot */
slot: number | null
/** Badge */
badge: string | null
/** Listed */
listed: number
/** Tradable */
tradable: number
/** Paired */
paired: number
rank: number | null
delisted?: boolean
/** Label */
name: string
}MarketProfile10 fields
/** What one market's profile says. */
export interface MarketProfile {
segment_id: string
market: string
venue_id: string
/** Catalogue ids: what prices are in, and what the perp settles in. */
quote_asset_id: string
settlement_asset_id: string | null
quanto: boolean
live: {
index_price: Decimal | null
mark_price: Decimal | null
funding_rate: number | null
funding_apr: number | null
funding_interval_s: number | null
next_funding_at: string | null
open_interest: Decimal | null
premium: number | null
ctx_age_s: number | null
connected: boolean
impact_bid: Decimal | null
impact_ask: Decimal | null
funding_cap: number | null
funding_floor: number | null
funding_short: number | null
borrow: number | null
borrow_short: number | null
}
formula: VenueProfile | null
missing: {
field: string
why: string
}[]
history: ProfileHistory | null
}VenueProfile9 fields
export interface VenueProfile {
venue_id: string
name: string
funding: FundingFormula
/** How the index (or oracle) price is made, and from which sources. */
index: {
method: string | null
sources: string[] | null
}
/** How the mark price is made; null where the venue has no separate mark. */
mark: {
method: string | null
separate: boolean
}
docs_url: string | null
/** When the entry was read against `docs_url`, `YYYY-MM-DD`. */
checked_at: string
source: 'api' | 'docs'
/** What this venue cannot give, and why (beyond the null fields). */
notes: string[]
}FundingFormula7 fields
export interface FundingFormula {
/** The venue's default funding interval, seconds (a market's own is in its context). */
funding_interval_s: number | null
/** The longest a single interval's rate may be: `[floor, cap]`, or null. */
cap: [number, number] | null
/** The clamp on `interest - premium` (±), or null. */
clamp: number | null
/** The interest rate term per interval, or null. */
interest: number | null
/** The notional the impact bid and ask are taken at, in the quote, or a rule. */
impact_notional: string | Decimal | null
/** How the premium is sampled and averaged over an interval. */
premium_sampling: string | null
/** The formula, in words. */
formula: string | null
}ProfileHistory8 fields
export interface ProfileHistory {
window: string
/** Bucket width, seconds: `t` is each bucket's start, its values the bucket's last minute (null. … */
bucket_s: number
time: string[]
index_price: (Decimal | null)[]
mark_price: (Decimal | null)[]
funding_rate: (number | null)[]
open_interest: (Decimal | null)[]
source: string
}Socket reference#
WS/live/{topic}
#Upgrade: websocket; a plain GET is 426.tn terminal watch book:bitcoin --depth 10 # --json: one frame per linefrom tribulnation.terminal import Terminal
async with Terminal.new() as t:
async for frame in t.live.stream('book:bitcoin', depth=10):
if frame['t'] == 'view':
print(frame['books'])// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
for await (const frame of t.live.stream('book:bitcoin', { depth: 10 })) {
if (frame.t === 'view') console.log(frame.books)
}Frame viewrecorded 2026-11-25 · books cut to 3 of 115, levels cut to 3 a side
{
"type": "view",
"seq": 9555,
"v": 2,
"ts_ms": 1795619294902,
"topic": "book:bitcoin",
"plan": "ultra",
"delayed_s": 0,
"status": "ok",
"rows": [],
"truncated": false,
"locked": null,
"withheld": null,
"markets": null,
"rate": null,
"rates": null,
"books": [
{
"segment_id": "aster:perp",
"market": "BTCUSDT",
"kind": "perp",
"quote_asset_id": "tether",
"settlement_asset_id": "tether",
"tier": "core",
"source": "stream",
"note": null,
"error": null,
"bid": "58020",
"ask": "58020.1",
"received_at": "2026-11-25T15:08:14.861Z",
"depth_at": "2026-11-25T15:08:14.713Z",
"levels": 20,
"bids": [
["58020", "0.026"],
["58018.4", "0.002"],
["58015", "0.002"]
],
"asks": [
["58020.1", "3.415"],
["58020.5", "2.626"],
["58020.9", "0.025"]
]
},
{
"segment_id": "aster:spot",
"market": "BTCUSDT",
"kind": "spot",
"quote_asset_id": "tether",
"tier": "core",
"source": "stream",
"note": null,
"error": null,
"bid": "58049.71",
"ask": "58050.3",
"received_at": "2026-11-25T15:08:14.758Z",
"depth_at": "2026-11-25T15:08:14.758Z",
"levels": 20,
"bids": [
["58049.71", "0.08986"],
["58045.64", "0.01583"],
["58015.45", "0.00276"]
],
"asks": [
["58050.3", "0.79433"],
["58052.61", "0.29832"],
["58052.62", "0.07778"]
]
},
{
"segment_id": "binance:spot",
"market": "BTCUSDT",
"kind": "spot",
"quote_asset_id": "tether",
"tier": "core",
"source": "rest",
"note": null,
"error": null,
"bid": "58050",
"ask": "58050.01",
"received_at": "2026-11-25T15:08:14.898Z",
"depth_at": "2026-11-25T15:08:13.900Z",
"levels": 38,
"bids": [
["58050", "0.3566"],
["58045", "4.66259"],
["58040", "9.09131"]
],
"asks": [
["58050.01", "4.33235"],
["58053.29", "1.67685"],
["58053.91", "0.0002"]
]
}
],
"starting": []
}Parameters
topicrequiredpathbook:<asset>, asset:<asset>, rates, rates:<c> (a part of rates once it splits) or page:<strategy>[:<n>].depthFrames LiveFrame
type: "view"ViewFrametype'view'seqnumberThe topic’s publish counter, one higher per build.v2The frame format’s version.ts_msnumberWhen the view was built, epoch milliseconds: the one epoch number on the API (every other instant is ISO).topicstringThe topic this view is of (book:bitcoin).plan'free' | 'pro' | 'ultra'The plan the view is cut for.delayed_snumberHow much older than the view’s build time (a frame’sts_ms) the rows are: 0 for live plans and when not ready.status'ok' | 'not_ready'ok, ornot_readybefore the first build.rows(TakerRow | FundingCarryRow | CashCarryRow | EarnCarryRow | MakerRow)[]Rows the plan sees with every figure. An asset topic's rows of every strategy, in strategy order, each strategy's best first.truncatedbooleanThe plan sees more rows thanrowsholds (cut atlimit, or the snapshot holds only the best of them): the page reads the rest over HTTP.lockedLocked | nullFree's locked rows, as their count and best; null when none.withheldWithheld | nullPro's extended rows, replaced by their count and best; null when none.marketsMarket[] | nullAsset topics: the markets the plan sees; null for other topics.rateRate | nullAsset topics: the asset's rate (null also when it has none).rates{ [key: string]: CompactRate } | nullratestopics: every rate; null for other topics.booksBook[] | nullbooktopics: the books the plan sees (Pro: core venues' only); null for other topics.startingstring[] | nullbooktopics: the snapshot'sstarting, the exchange ids whose feed has not listed its markets yet (a chip's venue there is starting, not unlisted); null for other topics.
type: "control"ControlFrametype'control'state'reconnecting' | 'stale'reconnecting: the source went away;stale: no build for 30 s.
pongtextThe answer to yourping: bare text, not JSON.
Close codes
| Code | Meaning | Do |
|---|---|---|
4001 | The socket’s one-minute grant ended: every socket gets it about a minute after it opens; your key and plan are checked again on reconnect. | Reconnect at once |
4401 | The key was revoked. | Stop; the next open is 401 |
4003 | The topic is not in your plan. | Stop |
4004 | Unknown topic. | Stop |
1011 | The server could not build the topic’s view for this socket. | Reconnect with backoff |
Types 1
LiveFrametype
/** A JSON text frame: a topic’s view (`type. … */
export type LiveFrame = {
type: 'view'
seq: number
v: 2
ts_ms: number
topic: string
plan: 'free' | 'pro' | 'ultra'
delayed_s: number
status: 'ok' | 'not_ready'
rows: (TakerRow | FundingCarryRow | CashCarryRow | EarnCarryRow | MakerRow)[]
truncated: boolean
locked: Locked | null
withheld: Withheld | null
markets: Market[] | null
rate: Rate | null
rates: { [key: string]: CompactRate } | null
books: Book[] | null
starting: string[] | null
} | {
type: 'control'
state: 'reconnecting' | 'stale'
}Errors#
Errors are JSON, always the same shape. Branch on code, never on message:
{ "error": { "code": "forbidden", "message": "market data needs the Ultra plan" } }| Status | code | Meaning | Retry? |
|---|---|---|---|
400 | bad_request | A parameter is missing, unknown (/v2) or out of range: message says which. | No: fix the request |
401 | unauthorized | No key, or the key is unknown, expired or revoked. | No |
403 | forbidden | The key lacks the scope, or the owner’s plan does not include the data. | No |
404 | not_found | No such route, asset, id or pair. | No |
410 | gone | A retired route. | No |
429 | rate_limited | Over the fair-use limit or a socket limit. | Yes, after Retry-After |
503 | unavailable | An outage or a build on our side, never your request. | Yes, after Retry-After |
503 | warming | A live asset is being built for the first time. | Yes, after Retry-After |
426 | upgrade_required | A socket path asked without Upgrade: websocket. | No: open a WebSocket |
500 | internal | A bug on our side. | Yes, with backoff |
A 503 is an outage or a build on our side, never your key or request. Redirects are
never needed: do not follow one with your key.
User-Agent and plain-text 403#
Every API error is the JSON above. A 403 with a plain-text body, such as
error code: 1010, never reached the API: the network in front of it refused the
request, usually for a library's default User-Agent (Python's urllib sends
Python-urllib/3.x). Send a User-Agent naming your program. curl, requests,
httpx, aiohttp, Node and the Terminal clients send one already.
import json, os, urllib.request
req = urllib.request.Request(
"https://api.tribulnation.com/me",
headers={
"Authorization": f"Bearer {os.environ['TN_API_KEY']}",
"User-Agent": "my-script/1.0",
},
)
with urllib.request.urlopen(req) as res:
print(json.load(res))Clients & tools#
Python#
tribulnation-terminal is a typed
async client: every route has a method, answers are validated into typed models (money
as Decimal, times as datetime), and the live socket reconnects by itself.
pip install tribulnation-terminalfrom tribulnation.terminal import Terminal
async with Terminal.new() as t: # TN_API_KEY, or the key `tn terminal auth login` saved
portfolio = await t.me.portfolio.get(hours=24 * 7)
funding = await t.v1.market.perps.funding.latest(assets=['bitcoin'])The client reads TN_API_KEY, else the saved login, and sends a saved key only to the
host that issued it. A route without a method yet: await t.get('/v1/earn/historical', asset='bitcoin').
TypeScript#
Coming to npm @tribulnation/terminal is built and tested; it is published to npm soon. The samples on this page already use it.
@tribulnation/terminal has no dependencies and returns the wire JSON as typed, without
converting it: money stays a decimal string (Decimal = string), times stay as sent. It
runs on Node 18+ (REST), and on Node 22+, Deno, Bun and Cloudflare Workers with the
socket. Browsers are not supported: a key is a secret, and the API sends no CORS headers.
// Coming to npm: @tribulnation/terminal is not published yet.
import { Terminal, pages } from '@tribulnation/terminal'
const t = new Terminal() // reads TN_API_KEY
const prices = await t.v1.prices.latest({ assets: ['bitcoin', 'ethereum'] })
for await (const page of pages(t.v1.candles, { asset: 'bitcoin', start: '2026-11-01', end: '2026-11-15' }))
console.log(page.data.length)Command line#
One install gives tn terminal; every command takes --json.
uv tool install 'tribulnation-terminal[cli]'
tn terminal auth login # approve the code in your browser
tn terminal portfolio --window 7d
tn terminal positions --json
tn terminal funding bitcoin --venue binance,hyperliquid --since 3d
tn terminal watch book:bitcoin --depth 10MCP server#
https://api.tribulnation.com/mcp is a remote MCP server (Streamable HTTP, OAuth 2.1 sign-in). The client
signs you in on https://app.tribulnation.com and gets its own key, which you can revoke on /integrations.
- Claude Code:
claude mcp add --transport http tribulnation-terminal https://api.tribulnation.com/mcp, then run/mcpand choose Authenticate. - Claude (claude.ai, desktop): Settings › Connectors › Add custom connector, paste
https://api.tribulnation.com/mcp, then Connect. - ChatGPT: Settings › Apps › Advanced settings, turn on developer mode, then Create
app with
https://api.tribulnation.com/mcpand OAuth. - Any other MCP client: add
https://api.tribulnation.com/mcpas a remote (HTTP) server; it discovers the sign-in fromhttps://api.tribulnation.com/.well-known/oauth-protected-resource/mcp.
The tools a client sees follow its key's scopes. The server answers; it does not stream: a program that needs a stream opens the live socket.
| Tool | Scope | What it answers |
|---|---|---|
me |
any key | Key and plan: What this connection’s key is: its name, scopes (me:read: your own data; me:profiles: create and edit portfolio profiles; market:read: market data, Ultra only), when it expires, and the account’s plan. |
accounts |
me:read |
Connected accounts: The exchange and wallet accounts connected to the portfolio, with their venue and sync status. |
profiles |
me:read |
Portfolio profiles: The portfolio profiles (named groups of accounts) and which is the default. |
create_profile |
me:profiles |
Create a portfolio profile: Create a portfolio profile: a named set of rules choosing which accounts and markets the portfolio counts (as on the Portfolio page). |
update_profile |
me:profiles |
Change a portfolio profile: Change a portfolio profile: only the fields given, the rest kept (a rule list given replaces that list). |
portfolio |
me:read |
Portfolio P&L: Profit and loss over a trailing window for a profile: total P&L split into trading, funding and fees, volume, fills, equity, net delta and gross notional, the accounts’ margin, then one row per asset with its per-market legs. |
activity |
me:read |
Fills, funding and transfers: Every fill (or funding payment, or on-chain wallet transfer) of a profile over a trailing window, newest first, a page at a time: total says how many match, next is the cursor of the following page (null: the last). |
positions |
me:read |
Open positions: What is held now: one row per asset and market held (venue, market, quote: what its prices are in, settle: a perp’s settlement currency) with its size (negative is short), mark in the quote, the quote’s USD rate and value in USD, its funding now (APR), margin and liquidation where the venue reports them (liq_px in the quote, liq_distance_pct, margin_mode, margin in settle), the asset’s USD price, its net delta in base units summed over every market (net; null where one market’s size in base units is not known) and net value in USD, and when the positions were read. |
funding_pnl |
me:read |
Funding P&L per market: Who is bleeding: funding received (+) or paid (-) over a trailing window per asset and market (venue, market, quote, settle), with the size and USD value held now, the market’s funding now as an APR, what the position earns or pays per hour and per day at it, and the window’s funding as an APR on the notional. |
charts |
me:read |
Saved charts: The plots saved in Charts (Charts is part of Pro), or one of them with its full definition when id is given. |
search |
market:read |
Find assets: Find assets, venues (exchanges) and networks by name or symbol. |
assets |
market:read |
Asset ranking: The asset ranking by market capitalisation, with price, market cap and 24h and 7d changes. |
prices |
market:read |
Asset prices: The latest USD (or EUR) reference price of one or more assets across venues, not any venue’s mark. |
candles |
market:read |
Price candles: OHLCV candles of one asset aggregated across venues, by hour, 4 hours or day. |
funding |
market:read |
Funding rates: Settled perpetual funding rates per venue market for one or more assets: hourly or daily history over a range (default the last 7 days), or with latest the last settled rate per market. |
funding_spreads |
market:read |
Funding spreads (live): Live funding-carry opportunities, the Opportunities page’s funding rows: with view pairs (default) each perp/perp pair (long one leg, short the other) with current funding per leg, 1d/7d/30d average spread, stability, carry (the expected spread a year over carry_window), round trip cost (bps) and breakeven. |
market_profile |
market:read |
Perp market profile: How a perpetual market’s funding works and where it stands: per market of an asset (one venue, or one market) its live index and mark (in the market’s quote), funding per interval and annualized, interval, next funding, open interest and premium. |
order_book |
market:read |
Live order books: One asset’s live order books, fresh (at most 30 s old; the read starts the build when the asset is not watched and waits for it): each exchange id’s main market first (perp before spot), its top (bid, ask), bids and asks as [price, size] best first cut to depth levels a side, levels (what the source holds), source (stream, rest, or top only with note why), quote (prices are in it) and tier. |
series |
market:read |
Data series (v2): The v2 time series this API serves (funding settlements, candles, open interest and more), or one series’ rows when id is given, filtered by params (as the series lists them, e.g. {"asset": "bitcoin"}). |
snapshots |
market:read |
Data snapshots (v2): The v2 snapshots this API serves (tickers, order book depth and more), or one snapshot’s rows when id is given, filtered by params. |
get |
me:read |
Any API read: Any read this API serves to the key, by path: /me... |
Agent skills#
Skills teach an agent which command or route answers which question (portfolio, positions, opportunities, markets). For Claude Code, as a plugin:
claude plugin marketplace add https://api.tribulnation.com/skills/marketplace.json
claude plugin install terminal@tribulnationThey call tn terminal and the tn-api helper the plugin puts on the PATH. Other agents
that read SKILL.md folders can unpack them directly:
mkdir -p ~/.claude/skills
curl -fsSL https://api.tribulnation.com/skills/tribulnation-terminal-skills-0.5.5.tgz | tar -xz -C ~/.claude/skills --strip-components=2 package/skillsMore: https://api.tribulnation.com/skills/.
OpenAPI and llms.txt#
- OpenAPI 3.1: every route with its parameters, full response schemas and recorded examples, for code generators and tools.
- llms.txt: the index an agent reads first.
- llms-full.txt: this whole page as one Markdown file, with a TypeScript type and a curl sample per endpoint.
Rules for agents#
- Never print, log, commit or pass a key on a command line; send it only in the
Authorizationheader tohttps://api.tribulnation.com. - Everything is read-only by design. A
403for a write, a scope or a plan is the answer: say so, do not work around it. - Retry only
429and503, afterRetry-After.