From c57583fe6d47ce790b0cae774b8cc6a063f814c5 Mon Sep 17 00:00:00 2001 From: tiagosiebler Date: Sat, 12 Jun 2021 22:54:47 +0100 Subject: [PATCH] 2.0.5: add missing inverse position mode endpoints --- package.json | 2 +- src/inverse-client.ts | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 03ab6fd..1389804 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bybit-api", - "version": "2.0.4", + "version": "2.0.5", "description": "Node.js connector for Bybit's Inverse & Linear REST APIs and WebSockets", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/src/inverse-client.ts b/src/inverse-client.ts index 80520bd..69dfa2d 100644 --- a/src/inverse-client.ts +++ b/src/inverse-client.ts @@ -326,6 +326,29 @@ export class InverseClient extends SharedEndpoints { return this.requestWrapper.get('v2/private/trade/closed-pnl/list', params); } + setPositionMode(params: { + symbol: string; + mode: 0 | 3; + }): GenericAPIResponse { + return this.requestWrapper.post('v2/private/position/switch-mode', params); + } + + setSlTpPositionMode(params: { + symbol: string; + tp_sl_mode: 'Full' | 'Partial'; + }): GenericAPIResponse { + return this.requestWrapper.post('v2/private/tpsl/switch-mode', params); + } + + setMarginType(params: { + symbol: string; + is_isolated: boolean; + buy_leverage: number; + sell_leverage: number; + }): GenericAPIResponse { + return this.requestWrapper.post('v2/private/position/switch-isolated', params); + } + /** * Risk Limit */