@somnia-chain/markets-sdk / index / UnifiedTicker
Interface: UnifiedTicker
Defined in: packages/sdk/src/unified/structs.ts:368
A rolling 24h market snapshot (ccxt ticker shape), human units. Absent fields mean the window had no trades to derive them from.
Properties
symbol
symbol:
string
Defined in: packages/sdk/src/unified/structs.ts:370
The tradable symbol the ticker describes.
chainId
chainId:
number
Defined in: packages/sdk/src/unified/structs.ts:372
Numeric chain id the market lives on.
timestamp
timestamp:
number
Defined in: packages/sdk/src/unified/structs.ts:374
When this snapshot was computed (ms, local clock).
datetime
datetime:
string
Defined in: packages/sdk/src/unified/structs.ts:376
ISO-8601 of timestamp.
high?
optionalhigh?:number
Defined in: packages/sdk/src/unified/structs.ts:378
Highest fill price in the window.
low?
optionallow?:number
Defined in: packages/sdk/src/unified/structs.ts:380
Lowest fill price in the window.
open?
optionalopen?:number
Defined in: packages/sdk/src/unified/structs.ts:382
First fill price in the window.
last?
optionallast?:number
Defined in: packages/sdk/src/unified/structs.ts:384
Most recent fill price (may predate the window on quiet markets).
lastSource?
optionallastSource?:object
Defined in: packages/sdk/src/unified/structs.ts:396
When the trade behind last happened (ms).
ABSENCE IS MEANINGFUL. No lastSource means last came from neither the
candle window nor a stamped fill — it fell back to the market row's
lifetime last price, which is cached metadata and can be older than the
candle path. A consumer that needs a fresh print must treat that as stale.
Read it against statsAsOf, not against timestamp: timestamp is
when this snapshot was assembled and says nothing about either half's age.
timestamp
timestamp:
number
When the trade happened (ms).
statsAsOf?
optionalstatsAsOf?:number
Defined in: packages/sdk/src/unified/structs.ts:407
The end of the window the 24h statistics (open, high, low, change,
percentage, baseVolume, quoteVolume) were folded over (ms).
This is the statistics' own as-of, derived from the candle window — NOT the response time. Absent when the window held no candles to fold.
change?
optionalchange?:number
Defined in: packages/sdk/src/unified/structs.ts:409
last − open, when both are known.
percentage?
optionalpercentage?:number
Defined in: packages/sdk/src/unified/structs.ts:411
change / open as a plain fraction (0.05 = +5%), when derivable.
baseVolume
baseVolume:
number
Defined in: packages/sdk/src/unified/structs.ts:413
Σ base-asset volume over the window.
quoteVolume
quoteVolume:
number
Defined in: packages/sdk/src/unified/structs.ts:415
Σ quote-asset volume over the window.
markPrice?
optionalmarkPrice?:number
Defined in: packages/sdk/src/unified/structs.ts:424
PERP ONLY — mark price, human quote units.
Undefined on spot/binary, and undefined on a perp whose mark is unusable —
either the feed reported stale, or the price is zero. A zero mark is never
published: flattened to a number it reads as a real price, and downstream an
unguarded markPrice - entryPrice becomes a 100% loss on every open position.
indexPrice?
optionalindexPrice?:number
Defined in: packages/sdk/src/unified/structs.ts:426
PERP ONLY — oracle index price, human quote units. Undefined on spot/binary.
fundingRate?
optionalfundingRate?:number
Defined in: packages/sdk/src/unified/structs.ts:438
PERP ONLY — funding rate per 8 HOURS as a plain fraction (0.0001 = 0.01%).
The same axis UnifiedFundingRate.fundingRate and fetchFundingRateHistory
use, deliberately: a header reading one basis while the chart beside it reads
another is a wrong number that looks right. NOT the amount charged per settlement —
that is this divided by fundingWindowSec / fundingIntervalSec (8 on every live
pool; it has been 96 at a 300s cadence), and info.perp carries both figures. On a
historical catch-up row, multiply by that row's intervalsAccrued — one settlement
can charge more than one interval's worth.
fundingTimestamp?
optionalfundingTimestamp?:number
Defined in: packages/sdk/src/unified/structs.ts:443
PERP ONLY — when funding next settles (ms). Settlement is permissionless and lazy, so a past value means a settlement is DUE, not that anything is broken.
openInterest?
optionalopenInterest?:number
Defined in: packages/sdk/src/unified/structs.ts:450
PERP ONLY — total open interest in base units.
ONE counter, not a long/short pair: in a matched CLOB the short side is provably equal, so there is nothing to sum.
perpState
perpState:
"ok"|"not-applicable"|"degraded"
Defined in: packages/sdk/src/unified/structs.ts:466
Whether the perp chain fields above are present, and WHY when they are not.
Three states, always one of them:
"not-applicable"— spot or binary. No perp fields exist to report."ok"— a perp, and its chain state was read. The perp fields are present."degraded"— a perp whose chain state read FAILED. The perp fields are absent and the 24h half below is still valid.
Without this, a missing markPrice is ambiguous: it reads the same on a
spot market as on a perp whose oracle reverted. The degrade is deliberate —
losing candle statistics to an oracle outage would be worse — but it must be
visible, so branch on this rather than on the absence of a field.
info
info:
unknown
Defined in: packages/sdk/src/unified/structs.ts:472
The raw fold this snapshot came from (raw-unit bigints). On a perp it also carries
perp, the full on-chain state — including fundingWindowSec /
fundingIntervalSec for re-basing the funding rate.