Skip to content

Commit

Permalink
fix(bybit): setMarginMode leverage type
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosmiei committed Mar 3, 2023
1 parent 5cfdcdd commit 1aa9502
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions js/bybit.js
Original file line number Diff line number Diff line change
Expand Up @@ -7278,11 +7278,17 @@ module.exports = class bybit extends Exchange {
let sellLeverage = undefined;
let buyLeverage = undefined;
if (leverage === undefined) {
sellLeverage = this.safeNumber2 (params, 'sell_leverage', 'sellLeverage');
buyLeverage = this.safeNumber2 (params, 'buy_leverage', 'buyLeverage');
sellLeverage = this.safeString2 (params, 'sell_leverage', 'sellLeverage');
buyLeverage = this.safeString2 (params, 'buy_leverage', 'buyLeverage');
if (sellLeverage === undefined && buyLeverage === undefined) {
throw new ArgumentsRequired (this.id + ' setMarginMode() requires a leverage parameter or sell_leverage and buy_leverage parameters');
}
if (buyLeverage === undefined) {
buyLeverage = sellLeverage;
}
if (sellLeverage === undefined) {
sellLeverage = buyLeverage;
}
params = this.omit (params, [ 'buy_leverage', 'sell_leverage', 'sellLeverage', 'buyLeverage' ]);
} else {
params = this.omit (params, 'leverage');
Expand Down

0 comments on commit 1aa9502

Please sign in to comment.