{s}omniamarkets

@somnia-chain/markets-sdk


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

Interface: BinaryPositionPnL

Defined in: derivedReads.ts:186

An account's position + cost basis + PnL in one binary market, RAW units. ACCOUNTING ASSUMPTION: weighted-average cost. Cost basis is reconstructed from the account's order-book fills on the market (buys add cost at the fill's outcome price; sells realize against the running average) folded with mint/merge router actions (a complete-set mint adds one YES + one NO at the split cost oneCollateral total; a merge removes a pair at avg cost). markValue/unrealizedPnl mark the CURRENT balances to the market's lastPrice while trading, or to the settlement payout once resolved.

Properties

balanceYes

balanceYes: bigint

Defined in: derivedReads.ts:188

Current YES outcome-token balance (raw).


balanceNo

balanceNo: bigint

Defined in: derivedReads.ts:190

Current NO outcome-token balance (raw).


costBasis

costBasis: bigint

Defined in: derivedReads.ts:192

Total remaining cost basis across both outcomes (raw collateral).


avgCost

avgCost: bigint

Defined in: derivedReads.ts:195

Blended average cost per whole outcome token held (raw collateral per token). 0n when nothing is held.


markValue

markValue: bigint

Defined in: derivedReads.ts:197

Mark value of the current balances (raw collateral).


unrealizedPnl

unrealizedPnl: bigint

Defined in: derivedReads.ts:199

markValue − costBasis (raw, signed).


realizedPnl

realizedPnl: bigint

Defined in: derivedReads.ts:202

Realized PnL from sells (proceeds − avg cost of tokens sold), raw signed. Best-effort over indexed order-book sell fills (see accounting note).