getMarketHistory
Provides the trading history for the designated market through this method:
import { Nectar, KLineInterval } from "@wasd3rplay/nectar-sdk";
const nectar = new Nectar();
const now = new Date();
const minAgo = new Date(now.getTime() - 60 * 1000);
const histories = await nectar.getMarketHistory({
symbol: "ETH_ETH:USDT_ETH",
startTime: minAgo,
endTime: now,
interval: KLineInterval.SECOND_1
});Properties
symbolThe market symbol
The symbol expression is a combination of
base_ticker, a colon (':'), andquote_ticker.
startTimeThe staring point of the data to be retrieved
endTimeThe end point of the data to be retrieved
intervalThe time interval for summarizing trading history item in the data to be retrieved
Interval Choices
TICK_1 = "1T",
SECOND_1 = "1S",
SECOND_5 = "5S",
MINUTE_1 = "1",
MINUTE_60 = "60",
MINUTE_360 = "360",
MINUTE_720 = "720",
DAY_1 = "1D",
WEEK_1 = "1W",
MONTH_1 = "1M",
MONTH_12 = "12M"Result
The result of this method is a list of trade histories:
e.g.
[
{
start_ts: 1695169493,
end_ts: 1695169494,
opening_price: '2108000000', // 2108 USDT
closing_price: '2000000000', // 2000 USDT
highest_price: '2200000000', // 2200 USDT
lowest_price: '1990000000', // 1990 USDT
volume: '1000000000000000000' // 1 ETH
},
...
]start_tsThe staring point of the history item as a timestamp
end_tsThe staring point of the history item as a timestamp
opening_priceThe price at the starting point
closing_priceThe price at the end point
highest_priceThe highest price in the term
lowest_priceThe lowest price in the term
volumeTotal trade volume in the term