Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

getPerpsPairState

Read on-chain pair state — long/short OI, funding per unit, and current funding rate.

fundingPerUnit is the pair-level running accumulator; per-position accrued funding is size × (fundingPerUnit − entryFundingPerUnit) and settles lazily whenever a position is touched. fundingRate is the clamped per-day rate finalised at the most recent funding collection. See protocol book: perps/3-funding §3–§4.

Signature

function getPerpsPairState(
  client: Client,
  parameters: {
    pairId: string
    height?: number
  },
): Promise<PerpsPairState | null>

Example

import { createPublicClient, createTransport, testnet } from "@left-curve/sdk"
 
const client = createPublicClient({ chain: testnet, transport: createTransport() })
const state = await client.getPerpsPairState({ pairId: "BTC-PERP" })

Parameters

pairIdstring. Perps pair identifier.

heightnumber, optional. Block height. Default 0 (latest).

Returns

PerpsPairState | null{ longOi, shortOi, fundingPerUnit, fundingRate }, or null if the pair has no state yet.

See also