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
symbol
The market symbol
The symbol expression is a combination of
base_ticker
, a colon (':'), andquote_ticker
.
startTime
The staring point of the data to be retrieved
endTime
The end point of the data to be retrieved
interval
The 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_ts
The staring point of the history item as a timestamp
end_ts
The staring point of the history item as a timestamp
opening_price
The price at the starting point
closing_price
The price at the end point
highest_price
The highest price in the term
lowest_price
The lowest price in the term
volume
Total trade volume in the term