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

perpsCandlesSubscription

Subscribe to live perps candles for a pair and interval. WebSocket only.

Signature

function perpsCandlesSubscription(
  client: Client,
  parameters: SubscriptionCallbacks<{
    perpsCandles: PerpsCandle[]
  }> & {
    pairId: string
    interval: CandleIntervals
  },
): () => void

Example

import { createPublicClient, createTransport, testnet } from "@left-curve/sdk"
 
const client = createPublicClient({ chain: testnet, transport: createTransport() })
const unsubscribe = client.perpsCandlesSubscription({
  pairId: "BTC-PERP",
  interval: "ONE_MINUTE",
  next: ({ perpsCandles }) => updateChart(perpsCandles),
})

Parameters

pairIdstring. Perps pair identifier.

intervalCandleIntervals. Candle interval.

next, error, complete — callbacks.

Returns

() => void — unsubscribe.

See also