@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / index / UnifiedPosition

Interface: UnifiedPosition

Defined in: packages/sdk/src/unified/structs.ts:581

An open perp position, human units.

Properties

symbol

symbol: string

Defined in: packages/sdk/src/unified/structs.ts:583

The perp's tradable symbol.


chainId

chainId: number

Defined in: packages/sdk/src/unified/structs.ts:585

Numeric chain id the market lives on.


side

side: "short" | "long"

Defined in: packages/sdk/src/unified/structs.ts:587

Position direction (from the sign of the on-chain size).


contracts

contracts: number

Defined in: packages/sdk/src/unified/structs.ts:589

Absolute position size in base units.


entryPrice

entryPrice: number

Defined in: packages/sdk/src/unified/structs.ts:591

Average entry price, human quote units.


markPrice?

optional markPrice?: number

Defined in: packages/sdk/src/unified/structs.ts:593

Current EMA mark price, human quote units. Absent when perpState is "degraded".


unrealizedPnl?

optional unrealizedPnl?: number

Defined in: packages/sdk/src/unified/structs.ts:598

(mark − entry) × signed size, human quote units. Excludes pending funding. Absent when perpState is "degraded".


liquidationPrice?

optional liquidationPrice?: number

Defined in: packages/sdk/src/unified/structs.ts:609

Estimated liquidation price, human quote units — the price at which THIS market's move alone would trip the account's cross-margin maintenance requirement. undefined when it can't be derived (a stale mark anywhere in the account reverts the health read this needs).

Solved with both sides of equity == mmReq moving against the mark; see perpLiquidationPrice for the identity and what is held constant. For the price a proposed order would move this to, use client.previewPerpLiquidationPrice.


timestamp?

optional timestamp?: number

Defined in: packages/sdk/src/unified/structs.ts:611

When the position last changed on-chain (ms).


datetime?

optional datetime?: string

Defined in: packages/sdk/src/unified/structs.ts:613

ISO-8601 of timestamp.


perpState

perpState: "ok" | "degraded"

Defined in: packages/sdk/src/unified/structs.ts:625

Whether the pool state behind markPrice and unrealizedPnl was read.

The same flag as UnifiedTicker.perpState, without "not-applicable", because a position is always a perp.

  • "ok" — the pool state was read. markPrice and unrealizedPnl are present.
  • "degraded" — the pool state read failed, for example because the pool's oracle reverts. The position is real; only markPrice and unrealizedPnl are absent. The other positions in the same read are not affected.

info

info: unknown

Defined in: packages/sdk/src/unified/structs.ts:630

The native reads: { position, state, markFromIndex } (raw bigints), or { position } alone when perpState is "degraded".