Skip to main content
These rules hold on every route, so you learn them once. Read this page before you parse your first response.

Times are epoch seconds

Timestamps are epoch seconds, not milliseconds, unless a field is marked date-time. If a timestamp looks a thousand times too small, this is why.

Null means unknown

A money field is a number or null, and null means the provider hasn’t reported it. trdrs never turns an unknown value into 0, and your screens shouldn’t either: a trader who sees a $0 balance during a hiccup at the provider acts on it. On the paper book (provider value paper), the buying-power fields are what the account’s risk decisions last valued it at: marginBalance is the account’s equity, usedBuyingPower the initial margin of its open positions plus what its working orders and owed charges hold back, and availableBuyingPower the free collateral that leaves, so usedBuyingPower and availableBuyingPower add up to marginBalance. A new account shows its whole balance as available. They’re null for a moment after each change, until the paper book has valued it, and while a price the account needs is missing or stale. They aren’t an order’s verdict: the paper book judges each order at its own prices, and its margin preview gives you that verdict beforehand, with sufficient saying whether the account’s free collateral covers the order.

Quantities are signed

A long position is positive and a short one negative. There’s no separate side field to check against.

Timeframes follow a pattern

A timeframe is a count and a unit, written <N><unit>, with the units s, m, h, d, w, mo and t: 1m, 4h, 1d or 100t. Any count within the published limits works, including ones no preset offers, such as 45s or 250t. Call /api/market/config once to get the exact limits trdrs checks against. A malformed timeframe is refused with 400.

Choose an account the same way everywhere

Every route that acts on one account takes provider and account query parameters. provider is the provider’s id, for example paper for the paper book. Providers lists every id, and GET /api/connect/providers returns them. A value that doesn’t match one of your own accounts is refused with 400, so a typo can never trade the wrong account.