@somnia-chain/markets-sdk / index / UnifiedMarket
Interface: UnifiedMarket
Defined in: packages/sdk/src/unified/structs.ts:31
A unified market object. info is the native Market union row.
Properties
id
id:
string
Defined in: packages/sdk/src/unified/structs.ts:33
Venue-internal id (the native market id: bytes32 for binary, pool for spot).
symbol
symbol:
string
Defined in: packages/sdk/src/unified/structs.ts:38
Canonical MARKET symbol (no outcome suffix), e.g. "SOMI/USDC" or
"BTC-95000-31DEC26/USDC". Key into exchange.markets.
type
type:
UnifiedMarketType
Defined in: packages/sdk/src/unified/structs.ts:40
Market kind — see UnifiedMarketType.
base
base:
string
Defined in: packages/sdk/src/unified/structs.ts:45
Base currency code — for outcome markets, the market's asset-strike-expiry stem (everything before the slash).
quote
quote:
string
Defined in: packages/sdk/src/unified/structs.ts:47
Quote currency code (outcome markets: the collateral token's code).
settle?
optionalsettle?:string
Defined in: packages/sdk/src/unified/structs.ts:52
Settlement currency code. Set on swap (== quote for a linear perp) and outcome markets; absent on spot.
active
active:
boolean
Defined in: packages/sdk/src/unified/structs.ts:54
Derived from live/indexed lifecycle — false once trading is impossible.
contract
contract:
boolean
Defined in: packages/sdk/src/unified/structs.ts:56
ccxt's derivative flag: true only for swap (perp) markets.
precision
precision:
object
Defined in: packages/sdk/src/unified/structs.ts:61
Decimal places implied by the market's tick (price) and lot (amount) grids — what SomniaMarkets.priceToPrecision snaps to.
price
price:
number
Price decimal places (from the tick grid).
amount
amount:
number
Amount decimal places (from the lot grid).
limits
limits:
object
Defined in: packages/sdk/src/unified/structs.ts:68
Order-size floors, human units; min is absent when the pool sets none.
amount
amount:
object
Amount (order size) bounds.
amount.min?
optionalmin?:number
Minimum order size, human base units.
outcomes?
optionaloutcomes?:object[]
Defined in: packages/sdk/src/unified/structs.ts:76
Outcome tradables (binary/categorical). Absent on spot/swap.
symbol
symbol:
string
The outcome's tradable symbol, e.g. "BTC-95000-31DEC26/USDC#YES".
label
label:
string
Outcome label ("YES" / "NO").
index
index:
number
Outcome index on the ERC-6909 singleton (0 = YES, 1 = NO).
indexed
indexed:
boolean
Defined in: packages/sdk/src/unified/structs.ts:115
Whether the indexer has a row for this market.
True for every spot and outcome market — those are discovered through the
indexer, so a row is the only way they appear at all. It can be false only
on a perp, which loadMarkets() also discovers from the PerpPoolFactory:
a market deployed after the indexer's perp manifest was written is present
on the chain and absent from the indexer.
Branch on this before reading anything history-derived. On a market with
indexed: false, info.cumulativeBaseVolume, info.cumulativeQuoteVolume,
info.tradeCount, info.createdAtTimestamp and info.createdAtBlock are
"0" placeholders meaning UNKNOWN — not "never traded" — and every funding,
mark-price and open-interest field is null.
info.lastPrice and info.lastTradeAt need care of their own. They are null
here for the same reason, but on an INDEXED market null carries the narrower
meaning "no fill yet". So null on a market with indexed: false says nothing
about whether it has traded, and rendering it as "no trades" is wrong.
The chain-backed reads work in full — positions, collateral, the order book —
and the indexer-backed ones (candles, fills, order history, portfolio) return
empty. TP/SL depends on info.stopRegistry, which comes from the factory and is
null when it records none.
Placement is a separate question from indexed. Discovery reports every
factory pool, including restricted and unregistered ones, so a market being
present here does not mean an order will be accepted: check
UnifiedMarket.active or UnifiedMarket.perpStatus. A restricted
market takes closes and cancels but reverts anything position-increasing.
perpStatus?
optionalperpStatus?:Pick<PerpPoolStatus,"restricted"|"registered"|"tradeable">
Defined in: packages/sdk/src/unified/structs.ts:130
Live tradeability gates, perp markets only.
Absent on spot and outcome markets; on every market when no PerpPoolFactory could
be reached (see SomniaMarkets.perpDiscoveryError); and per-market on an indexed
perp the reachable factory does not list — which happens after a factory rotation,
and leaves that market's active falling back to true.
Read from the chain on each loadMarkets(), because "deployed" is not
"tradeable" and the two gates fail for unrelated reasons — see
PerpPoolStatus. UnifiedMarket.active folds them together;
these are here for a consumer that must tell a wound-down market from one
that was never activated.
info
info:
Market
Defined in: packages/sdk/src/unified/structs.ts:132
The native Market union row (raw strings/bigint-scale fields).