From ce301bd4c9615a79ad958c99723a301b775af230 Mon Sep 17 00:00:00 2001 From: John BEPPU Date: Wed, 12 Aug 2020 12:21:48 -0700 Subject: [PATCH] Implement replaceConditionalOrder This lets unexecuted stop orders be edited. https://bybit-exchange.github.io/docs/inverse/#t-replacecond --- doc/rest-client.md | 3 +++ lib/rest-client.js | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/doc/rest-client.md b/doc/rest-client.md index 19e2255..b3537a1 100644 --- a/doc/rest-client.md +++ b/doc/rest-client.md @@ -43,6 +43,9 @@ If you only use the [public endpoints](#public-endpoints) you can omit key and s #### async cancelAllConditionalOrders(params) [See bybit documentation](https://bybit-exchange.github.io/docs/inverse/#t-cancelallcond) +#### async replaceConditionalOrder(params) +[See bybit documentation](https://bybit-exchange.github.io/docs/inverse/#t-replacecond) + #### async queryConditionalOrder(params) [See bybit documentation](https://bybit-exchange.github.io/docs/inverse/#t-querycond) diff --git a/lib/rest-client.js b/lib/rest-client.js index 8902687..84f81db 100644 --- a/lib/rest-client.js +++ b/lib/rest-client.js @@ -90,6 +90,14 @@ module.exports = class RestClient { return await this.request.post('v2/private/stop-order/cancelAll', params); } + async replaceConditionalOrder(params) { + assert(params, 'No params passed'); + assert(params.stop_order_id, 'Parameter stop_order_id is required'); + assert(params.symbol, 'Parameter symbol is required'); + + return await this.request.post('open-api/stop-order/replace', params); + } + async queryConditionalOrder(params) { assert(params, 'No params passed'); assert(params.stop_order_id || params.order_link_id, 'Parameter order_id OR order_link_id is required');