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

candlesSubscription

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

Signature

function candlesSubscription(
  client: Client,
  parameters: SubscriptionCallbacks<{
    candles: Candle[]
  }> & {
    baseDenom: Denom
    quoteDenom: Denom
    interval: CandleIntervals
  },
): () => void

Example

import { createPublicClient, createTransport, testnet } from "@left-curve/sdk"
 
const client = createPublicClient({ chain: testnet, transport: createTransport() })
const unsubscribe = client.candlesSubscription({
  baseDenom: "dango",
  quoteDenom: "bridge/usdc",
  interval: "ONE_MINUTE",
  next: ({ candles }) => updateChart(candles),
})

Parameters

baseDenomDenom. Base asset.

quoteDenomDenom. Quote asset.

intervalCandleIntervals. Candle interval.

next, error, complete — callbacks.

Returns

() => void — unsubscribe.

See also