Appearance
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
| Unit | Used for | Meaning |
|---|---|---|
| Ticks | Prices | Price in whole ticks. One tick is the market's minimum price increment. |
| Base lots | Order and position sizes | Quantity of the base asset, in lots. |
| Quote lots | Notional, PnL, fees paid | Quantity of the quote asset, in lots. |
| Token atoms | Balances, margin, transfers | Smallest indivisible unit of a token, analogous to satoshis or wei. |
| 100th bps | Fees, funding rates | Hundredths 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, wherebase_lot_sizeis the market's base atoms per lot. - Price: one tick equals
tick_sizequote-atoms per base unit; a tick pricePisP × tick_sizequote atoms per base unit, then divide by10^quote_decimalsfor 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.
| Type | Underlying | Notes |
|---|---|---|
MarketId | u32 | Market identifier. |
ClientOrderId | u64 | Client-assigned order id; unique per active order in a subaccount. |
SubAccountId | u16 | Subaccount index. The per-owner maximum is configuration-defined (max_subaccounts_per_owner). |
OrderId | encoded u128 | On-chain order id (encodes market, side, price, variant, sequence). |
Leverage | u8 | Integer multiplier, 1–100 (e.g. 25 = 25×). |
Ticks | u64 | Price in ticks. |
BaseLots | u64 | Size in base lots. |
QuoteLots | u64 | Size in quote lots. |
TokenAtoms | u64 | Token amount in atoms. |
BPS100thFee | u16 (signed variant) | Fee/rate in 100ths of a bp; SignedBPS100thFee may be negative (rebate). |
TokenId | 32 bytes | Token identifier (0x-hex). |
Address | 20 bytes | Ethereum-style address (0x-hex). |
Enums
| Enum | Values |
|---|---|
Side | Bid, Ask |
OrderType | Market, Limit, StopLimit, StopMarket, OraclePeg, DiscretionaryPeg, StopOraclePeg, StopDiscretionaryPeg |
TimeInForce | Fok, Ioc, PostOnly, Gtc |
MarginMode | Cross, Isolated |
Constants
| Constant | Value |
|---|---|
chain_id | 4321 |
See Signing Transactions for how chain_id and the build-time CHAIN_HASH are used in the signed payload.