Implement replaceConditionalOrder

This lets unexecuted stop orders be edited.
https://bybit-exchange.github.io/docs/inverse/#t-replacecond
This commit is contained in:
John BEPPU
2020-08-12 12:21:48 -07:00
parent c659423108
commit ce301bd4c9
2 changed files with 11 additions and 0 deletions

View File

@@ -43,6 +43,9 @@ If you only use the [public endpoints](#public-endpoints) you can omit key and s
#### async cancelAllConditionalOrders(params) #### async cancelAllConditionalOrders(params)
[See bybit documentation](https://bybit-exchange.github.io/docs/inverse/#t-cancelallcond) [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) #### async queryConditionalOrder(params)
[See bybit documentation](https://bybit-exchange.github.io/docs/inverse/#t-querycond) [See bybit documentation](https://bybit-exchange.github.io/docs/inverse/#t-querycond)

View File

@@ -90,6 +90,14 @@ module.exports = class RestClient {
return await this.request.post('v2/private/stop-order/cancelAll', params); 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) { async queryConditionalOrder(params) {
assert(params, 'No params passed'); assert(params, 'No params passed');
assert(params.stop_order_id || params.order_link_id, 'Parameter order_id OR order_link_id is required'); assert(params.stop_order_id || params.order_link_id, 'Parameter order_id OR order_link_id is required');