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

queryCandles

Read historical candles for a pair at a given interval. Paginated cursor-style.

Signature

function queryCandles(
  client: Client,
  parameters: {
    baseDenom: string
    quoteDenom: string
    interval: CandleIntervals
    after?: string
    first?: number
    earlierThan?: DateTime
    laterThan?: DateTime
  },
): Promise<GraphqlQueryResult<Candle>>

Example

import { createPublicClient, createTransport, testnet } from "@left-curve/sdk"
 
const client = createPublicClient({ chain: testnet, transport: createTransport() })
const page = await client.queryCandles({
  baseDenom: "dango",
  quoteDenom: "bridge/usdc",
  interval: "ONE_MINUTE",
  first: 100,
})
for (const candle of page.nodes) {
  console.log(candle.timeStart, candle.close)
}

Parameters

baseDenomstring. Base asset.

quoteDenomstring. Quote asset.

intervalCandleIntervals. One of ONE_SECOND, ONE_MINUTE, FIVE_MINUTES, FIFTEEN_MINUTES, ONE_HOUR, FOUR_HOURS, ONE_DAY, ONE_WEEK.

afterstring, optional. Cursor for the next page.

firstnumber, optional. Page size.

earlierThanDateTime, optional. ISO 8601 upper bound.

laterThanDateTime, optional. ISO 8601 lower bound.

Returns

GraphqlQueryResult<Candle>{ pageInfo, nodes }. Each Candle has OHLC, volumes, and time fields.

See also