From 336170faa58bbd8046baede1364d265db6505d18 Mon Sep 17 00:00:00 2001 From: Tiago Date: Mon, 20 Apr 2020 13:10:02 +0100 Subject: [PATCH] Add missing getKline API. Fixes #8. (#9) Co-authored-by: tiagosiebler --- doc/rest-client.md | 3 +++ lib/rest-client.js | 9 +++++++++ 2 files changed, 12 insertions(+) diff --git a/doc/rest-client.md b/doc/rest-client.md index 2b7f72a..8a2828d 100644 --- a/doc/rest-client.md +++ b/doc/rest-client.md @@ -101,6 +101,9 @@ If you only use the [public endpoints](#public-endpoints) you can ommit key and #### async getOrderBook(params) [See bybit documentation](https://bybit-exchange.github.io/docs/inverse/#t-orderbook) +#### async getKline(params) +[See bybit documentation](https://bybit-exchange.github.io/docs/inverse/#t-querykline) + #### async getLatestInformation() [See bybit documentation](https://bybit-exchange.github.io/docs/inverse/#t-latestsymbolinfo) diff --git a/lib/rest-client.js b/lib/rest-client.js index 467d7b8..0378ab7 100644 --- a/lib/rest-client.js +++ b/lib/rest-client.js @@ -197,6 +197,15 @@ module.exports = class RestClient { return await this.request.get('/v2/public/orderBook/L2', params); } + async getKline(params) { + assert(params, 'No params passed'); + assert(params.symbol, 'Parameter symbol is required'); + assert(params.interval, 'Parameter interval is required'); + assert(params.from, 'Parameter from is required'); + + return await this.request.get('/v2/public/kline/list', params); + } + async getLatestInformation() { return await this.request.get('/v2/public/tickers'); }