@somnia-chain/markets-sdk


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

Function: perpPositionAnalytics()

perpPositionAnalytics(p): PerpPositionMetrics

Defined in: packages/sdk/src/perp/margin.ts:899

Split one position into PnL, funding, notional and its three margin requirements — pure, no client, no block.

A direct port of MarginBank._computePositionMetrics and _marketHealthFromSnapshot. Exported so a caller can re-run it against a live store, a hypothetical mark, or a position it is about to open, without a round-trip — and so a table and a detail view cannot disagree on identical inputs.

Parameters

p

PerpPositionAnalyticsInputs

Returns

PerpPositionMetrics