getChart
The getChart()
method of Nectar
instances returns a open-high-low-close chart of a market of the given symbol.
Usage
import { KLineInterval, Nectar } from "@wasd3rplay/nectar-sdk";
const nectar = new Nectar();
const symbol = "WETH_ETHSEPOLIA:USDT_ETHSEPOLIA";
const now = Date.now() / 1000;
const chart = await nectar.getChart(symbol, KLineInterval.DAY_1, {
startTime: now - 60 * 60 * 24 * 7, // 1 week ago
endTime: now,
});
Parameters
symbol: string
A market symbol.
It is a combination of a base ticker, a colon, and a quote ticker.
E.g.,
ETH_ETHSEPOLIA:USDT_ETHSEPOLIA
interval: KLineInterval
A time period of a single bar.
Options
startTime?: number
Optional
Defaults to
0
The start timestamp of a chart, expressed in seconds.
endTime?: number
Optional
Defaults to
Date.now()
The end timestamp of a chart, expressed in seconds.
Returns
Kline[]
A candlestick chart.
Last updated