Skip to content

Data Structures & Constants

The Blink API represents all prices and sizes as integers, never decimals, so values are exact. To display human-readable numbers, convert using the per-market metadata returned by the Markets endpoints (tick_size, base_decimals, quote_decimals).

JSON encoding

Small, bounded values (ids, decimals, fee basis points, leverage) are JSON numbers. Values that can exceed 2^53 (prices, sizes, atom balances, funding indices, and share counts) are serialized as decimal strings to avoid precision loss in JSON. For example, a price is "100050", not 100050.

Units

UnitUsed forMeaning
TicksPricesPrice in whole ticks. One tick is the market's minimum price increment.
Base lotsOrder and position sizesQuantity of the base asset, in lots.
Quote lotsNotional, PnL, fees paidQuantity of the quote asset, in lots.
Token atomsBalances, margin, transfersSmallest indivisible unit of a token, analogous to satoshis or wei.
100th bpsFees, funding ratesHundredths of a basis point. 50 = 0.5 bps = 0.005%. Signed fees allow rebates.

Converting to human units

Each market provides the constants needed to convert:

  • Token amount → human: atoms / 10^token_decimals.
  • Base size → base units: base_lots × base_lot_size / 10^base_decimals, where base_lot_size is the market's base atoms per lot.
  • Price: one tick equals tick_size quote-atoms per base unit; a tick price P is P × tick_size quote atoms per base unit, then divide by 10^quote_decimals for a human quote price.

Always read these constants from the market metadata rather than hard-coding them; they differ per market.

Scalar types

These are the domain types used across the transaction and REST references.

TypeUnderlyingNotes
MarketIdu32Market identifier.
ClientOrderIdu64Client-assigned order id; unique per active order in a subaccount.
SubAccountIdu16Subaccount index. The per-owner maximum is configuration-defined (max_subaccounts_per_owner).
OrderIdencoded u128On-chain order id (encodes market, side, price, variant, sequence).
Leverageu8Integer multiplier, 1–100 (e.g. 25 = 25×).
Ticksu64Price in ticks.
BaseLotsu64Size in base lots.
QuoteLotsu64Size in quote lots.
TokenAtomsu64Token amount in atoms.
BPS100thFeeu16 (signed variant)Fee/rate in 100ths of a bp; SignedBPS100thFee may be negative (rebate).
TokenId32 bytesToken identifier (0x-hex).
Address20 bytesEthereum-style address (0x-hex).

Enums

EnumValues
SideBid, Ask
OrderTypeMarket, Limit, StopLimit, StopMarket, OraclePeg, DiscretionaryPeg, StopOraclePeg, StopDiscretionaryPeg
TimeInForceFok, Ioc, PostOnly, Gtc
MarginModeCross, Isolated

Constants

ConstantValue
chain_id4321

See Signing Transactions for how chain_id and the build-time CHAIN_HASH are used in the signed payload.