ccxt 4.3.66 → 4.3.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +6 -4
- package/dist/cjs/src/base/functions/type.js +2 -2
- package/dist/cjs/src/bingx.js +478 -159
- package/dist/cjs/src/bitget.js +4 -2
- package/dist/cjs/src/bithumb.js +61 -17
- package/dist/cjs/src/pro/krakenfutures.js +7 -6
- package/dist/cjs/src/pro/okx.js +17 -4
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bingx.d.ts +7 -0
- package/js/src/base/Exchange.d.ts +14 -13
- package/js/src/base/Exchange.js +6 -4
- package/js/src/base/functions/type.js +2 -2
- package/js/src/bingx.d.ts +2 -0
- package/js/src/bingx.js +478 -159
- package/js/src/bitget.js +4 -2
- package/js/src/bithumb.js +61 -17
- package/js/src/pro/bitget.d.ts +1 -1
- package/js/src/pro/bybit.d.ts +1 -1
- package/js/src/pro/coinone.d.ts +1 -1
- package/js/src/pro/currencycom.d.ts +1 -1
- package/js/src/pro/hollaex.d.ts +1 -1
- package/js/src/pro/hyperliquid.d.ts +1 -1
- package/js/src/pro/krakenfutures.js +7 -6
- package/js/src/pro/kucoin.d.ts +1 -1
- package/js/src/pro/kucoinfutures.d.ts +1 -1
- package/js/src/pro/mexc.d.ts +1 -1
- package/js/src/pro/okcoin.d.ts +1 -1
- package/js/src/pro/okx.d.ts +2 -2
- package/js/src/pro/okx.js +18 -5
- package/js/src/pro/oxfun.d.ts +1 -1
- package/js/src/pro/p2b.d.ts +1 -1
- package/js/src/pro/poloniex.d.ts +1 -1
- package/js/src/pro/whitebit.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/src/abstract/bittrex.js +0 -9
- package/dist/cjs/src/bittrex.js +0 -2308
- package/dist/cjs/src/pro/bittrex.js +0 -959
- package/js/src/bittrex.d.ts +0 -97
- package/js/src/bittrex.js +0 -2309
- package/js/src/coinbaseprime.d.ts +0 -4
- package/js/src/coinbaseprime.js +0 -32
- package/js/src/pro/bittrex.d.ts +0 -69
- package/js/src/pro/bittrex.js +0 -960
- package/js/src/pro/coinbaseprime.d.ts +0 -4
- package/js/src/pro/coinbaseprime.js +0 -33
- package/js/src/pro/huobipro.d.ts +0 -4
- package/js/src/pro/huobipro.js +0 -17
- package/js/src/pro/mexc3.d.ts +0 -4
- package/js/src/pro/mexc3.js +0 -17
- package/js/src/pro/okex.d.ts +0 -4
- package/js/src/pro/okex.js +0 -17
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -48,6 +48,7 @@ class bingx extends bingx$1 {
|
|
|
48
48
|
'createTrailingPercentOrder': true,
|
|
49
49
|
'createTriggerOrder': true,
|
|
50
50
|
'fetchBalance': true,
|
|
51
|
+
'fetchCanceledOrders': true,
|
|
51
52
|
'fetchClosedOrders': true,
|
|
52
53
|
'fetchCurrencies': true,
|
|
53
54
|
'fetchDepositAddress': true,
|
|
@@ -283,6 +284,10 @@ class bingx extends bingx$1 {
|
|
|
283
284
|
'trade/leverage': 2,
|
|
284
285
|
'trade/forceOrders': 2,
|
|
285
286
|
'trade/allFillOrders': 2,
|
|
287
|
+
'trade/openOrders': 2,
|
|
288
|
+
'trade/orderDetail': 2,
|
|
289
|
+
'trade/orderHistory': 2,
|
|
290
|
+
'trade/marginType': 2,
|
|
286
291
|
'user/commissionRate': 2,
|
|
287
292
|
'user/positions': 2,
|
|
288
293
|
'user/balance': 2,
|
|
@@ -291,9 +296,12 @@ class bingx extends bingx$1 {
|
|
|
291
296
|
'trade/order': 2,
|
|
292
297
|
'trade/leverage': 2,
|
|
293
298
|
'trade/closeAllPositions': 2,
|
|
299
|
+
'trade/marginType': 2,
|
|
300
|
+
'trade/positionMargin': 2,
|
|
294
301
|
},
|
|
295
302
|
'delete': {
|
|
296
303
|
'trade/allOpenOrders': 2,
|
|
304
|
+
'trade/cancelOrder': 2,
|
|
297
305
|
},
|
|
298
306
|
},
|
|
299
307
|
},
|
|
@@ -3004,7 +3012,7 @@ class bingx extends bingx$1 {
|
|
|
3004
3012
|
// "clientOrderID": ""
|
|
3005
3013
|
// }
|
|
3006
3014
|
//
|
|
3007
|
-
// inverse swap cancelAllOrders
|
|
3015
|
+
// inverse swap cancelAllOrders, cancelOrder, fetchOrder, fetchOpenOrders, fetchClosedOrders, fetchCanceledOrders
|
|
3008
3016
|
//
|
|
3009
3017
|
// {
|
|
3010
3018
|
// "symbol": "SOL-USD",
|
|
@@ -3064,7 +3072,7 @@ class bingx extends bingx$1 {
|
|
|
3064
3072
|
const side = this.safeStringLower2(order, 'side', 'S');
|
|
3065
3073
|
const timestamp = this.safeIntegerN(order, ['time', 'transactTime', 'E']);
|
|
3066
3074
|
const lastTradeTimestamp = this.safeInteger2(order, 'updateTime', 'T');
|
|
3067
|
-
const statusId = this.
|
|
3075
|
+
const statusId = this.safeStringUpper2(order, 'status', 'X');
|
|
3068
3076
|
let feeCurrencyCode = this.safeString2(order, 'feeAsset', 'N');
|
|
3069
3077
|
const feeCost = this.safeStringN(order, ['fee', 'commission', 'n']);
|
|
3070
3078
|
if ((feeCurrencyCode === undefined)) {
|
|
@@ -3166,13 +3174,14 @@ class bingx extends bingx$1 {
|
|
|
3166
3174
|
* @method
|
|
3167
3175
|
* @name bingx#cancelOrder
|
|
3168
3176
|
* @description cancels an open order
|
|
3169
|
-
* @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Cancel%
|
|
3170
|
-
* @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Cancel%
|
|
3177
|
+
* @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20Order
|
|
3178
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20Order
|
|
3179
|
+
* @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Cancel%20an%20Order
|
|
3171
3180
|
* @param {string} id order id
|
|
3172
3181
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
3173
3182
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3174
3183
|
* @param {string} [params.clientOrderId] a unique id for the order
|
|
3175
|
-
* @returns {object}
|
|
3184
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3176
3185
|
*/
|
|
3177
3186
|
if (symbol === undefined) {
|
|
3178
3187
|
throw new errors.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
|
|
@@ -3191,12 +3200,20 @@ class bingx extends bingx$1 {
|
|
|
3191
3200
|
request['orderId'] = id;
|
|
3192
3201
|
}
|
|
3193
3202
|
let response = undefined;
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3203
|
+
let type = undefined;
|
|
3204
|
+
let subType = undefined;
|
|
3205
|
+
[type, params] = this.handleMarketTypeAndParams('cancelOrder', market, params);
|
|
3206
|
+
[subType, params] = this.handleSubTypeAndParams('cancelOrder', market, params);
|
|
3207
|
+
if (type === 'spot') {
|
|
3208
|
+
response = await this.spotV1PrivatePostTradeCancel(this.extend(request, params));
|
|
3197
3209
|
}
|
|
3198
3210
|
else {
|
|
3199
|
-
|
|
3211
|
+
if (subType === 'inverse') {
|
|
3212
|
+
response = await this.cswapV1PrivateDeleteTradeCancelOrder(this.extend(request, params));
|
|
3213
|
+
}
|
|
3214
|
+
else {
|
|
3215
|
+
response = await this.swapV2PrivateDeleteTradeOrder(this.extend(request, params));
|
|
3216
|
+
}
|
|
3200
3217
|
}
|
|
3201
3218
|
//
|
|
3202
3219
|
// spot
|
|
@@ -3217,7 +3234,59 @@ class bingx extends bingx$1 {
|
|
|
3217
3234
|
// }
|
|
3218
3235
|
// }
|
|
3219
3236
|
//
|
|
3220
|
-
// swap
|
|
3237
|
+
// inverse swap
|
|
3238
|
+
//
|
|
3239
|
+
// {
|
|
3240
|
+
// "code": 0,
|
|
3241
|
+
// "msg": "",
|
|
3242
|
+
// "data": {
|
|
3243
|
+
// "order": {
|
|
3244
|
+
// "symbol": "SOL-USD",
|
|
3245
|
+
// "orderId": "1816002957423951872",
|
|
3246
|
+
// "side": "BUY",
|
|
3247
|
+
// "positionSide": "Long",
|
|
3248
|
+
// "type": "Pending",
|
|
3249
|
+
// "quantity": 0,
|
|
3250
|
+
// "origQty": "0",
|
|
3251
|
+
// "price": "150",
|
|
3252
|
+
// "executedQty": "0",
|
|
3253
|
+
// "avgPrice": "0",
|
|
3254
|
+
// "cumQuote": "0",
|
|
3255
|
+
// "stopPrice": "",
|
|
3256
|
+
// "profit": "0.0000",
|
|
3257
|
+
// "commission": "0.000000",
|
|
3258
|
+
// "status": "CANCELLED",
|
|
3259
|
+
// "time": 1721803819410,
|
|
3260
|
+
// "updateTime": 1721803819427,
|
|
3261
|
+
// "clientOrderId": "",
|
|
3262
|
+
// "leverage": "",
|
|
3263
|
+
// "takeProfit": {
|
|
3264
|
+
// "type": "",
|
|
3265
|
+
// "quantity": 0,
|
|
3266
|
+
// "stopPrice": 0,
|
|
3267
|
+
// "price": 0,
|
|
3268
|
+
// "workingType": "",
|
|
3269
|
+
// "stopGuaranteed": ""
|
|
3270
|
+
// },
|
|
3271
|
+
// "stopLoss": {
|
|
3272
|
+
// "type": "",
|
|
3273
|
+
// "quantity": 0,
|
|
3274
|
+
// "stopPrice": 0,
|
|
3275
|
+
// "price": 0,
|
|
3276
|
+
// "workingType": "",
|
|
3277
|
+
// "stopGuaranteed": ""
|
|
3278
|
+
// },
|
|
3279
|
+
// "advanceAttr": 0,
|
|
3280
|
+
// "positionID": 0,
|
|
3281
|
+
// "takeProfitEntrustPrice": 0,
|
|
3282
|
+
// "stopLossEntrustPrice": 0,
|
|
3283
|
+
// "orderType": "",
|
|
3284
|
+
// "workingType": ""
|
|
3285
|
+
// }
|
|
3286
|
+
// }
|
|
3287
|
+
// }
|
|
3288
|
+
//
|
|
3289
|
+
// linear swap
|
|
3221
3290
|
//
|
|
3222
3291
|
// {
|
|
3223
3292
|
// "code": 0,
|
|
@@ -3244,9 +3313,9 @@ class bingx extends bingx$1 {
|
|
|
3244
3313
|
// }
|
|
3245
3314
|
// }
|
|
3246
3315
|
//
|
|
3247
|
-
const data = this.
|
|
3248
|
-
const
|
|
3249
|
-
return this.parseOrder(
|
|
3316
|
+
const data = this.safeDict(response, 'data', {});
|
|
3317
|
+
const order = this.safeDict(data, 'order', data);
|
|
3318
|
+
return this.parseOrder(order, market);
|
|
3250
3319
|
}
|
|
3251
3320
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
3252
3321
|
/**
|
|
@@ -3549,11 +3618,12 @@ class bingx extends bingx$1 {
|
|
|
3549
3618
|
* @method
|
|
3550
3619
|
* @name bingx#fetchOrder
|
|
3551
3620
|
* @description fetches information on an order made by the user
|
|
3552
|
-
* @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Query%
|
|
3553
|
-
* @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Query%20Order
|
|
3621
|
+
* @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20details
|
|
3622
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20details
|
|
3623
|
+
* @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Order
|
|
3554
3624
|
* @param {string} symbol unified symbol of the market the order was made in
|
|
3555
3625
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3556
|
-
* @returns {object}
|
|
3626
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3557
3627
|
*/
|
|
3558
3628
|
if (symbol === undefined) {
|
|
3559
3629
|
throw new errors.ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
@@ -3564,68 +3634,124 @@ class bingx extends bingx$1 {
|
|
|
3564
3634
|
'symbol': market['id'],
|
|
3565
3635
|
'orderId': id,
|
|
3566
3636
|
};
|
|
3637
|
+
let type = undefined;
|
|
3638
|
+
let subType = undefined;
|
|
3567
3639
|
let response = undefined;
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3640
|
+
[type, params] = this.handleMarketTypeAndParams('fetchOrder', market, params);
|
|
3641
|
+
[subType, params] = this.handleSubTypeAndParams('fetchOrder', market, params);
|
|
3642
|
+
if (type === 'spot') {
|
|
3643
|
+
response = await this.spotV1PrivateGetTradeQuery(this.extend(request, params));
|
|
3644
|
+
//
|
|
3645
|
+
// {
|
|
3646
|
+
// "code": 0,
|
|
3647
|
+
// "msg": "",
|
|
3648
|
+
// "data": {
|
|
3649
|
+
// "symbol": "XRP-USDT",
|
|
3650
|
+
// "orderId": 1514087361158316032,
|
|
3651
|
+
// "price": "0.5",
|
|
3652
|
+
// "origQty": "10",
|
|
3653
|
+
// "executedQty": "0",
|
|
3654
|
+
// "cummulativeQuoteQty": "0",
|
|
3655
|
+
// "status": "CANCELED",
|
|
3656
|
+
// "type": "LIMIT",
|
|
3657
|
+
// "side": "BUY",
|
|
3658
|
+
// "time": 1649821532000,
|
|
3659
|
+
// "updateTime": 1649821543000,
|
|
3660
|
+
// "origQuoteOrderQty": "0",
|
|
3661
|
+
// "fee": "0",
|
|
3662
|
+
// "feeAsset": "XRP"
|
|
3663
|
+
// }
|
|
3664
|
+
// }
|
|
3665
|
+
//
|
|
3571
3666
|
}
|
|
3572
3667
|
else {
|
|
3573
|
-
|
|
3668
|
+
if (subType === 'inverse') {
|
|
3669
|
+
response = await this.cswapV1PrivateGetTradeOrderDetail(this.extend(request, params));
|
|
3670
|
+
//
|
|
3671
|
+
// {
|
|
3672
|
+
// "code": 0,
|
|
3673
|
+
// "msg": "",
|
|
3674
|
+
// "data": {
|
|
3675
|
+
// "order": {
|
|
3676
|
+
// "symbol": "SOL-USD",
|
|
3677
|
+
// "orderId": "1816342420721254400",
|
|
3678
|
+
// "side": "BUY",
|
|
3679
|
+
// "positionSide": "Long",
|
|
3680
|
+
// "type": "LIMIT",
|
|
3681
|
+
// "quantity": 1,
|
|
3682
|
+
// "origQty": "",
|
|
3683
|
+
// "price": "150",
|
|
3684
|
+
// "executedQty": "0",
|
|
3685
|
+
// "avgPrice": "0.000",
|
|
3686
|
+
// "cumQuote": "",
|
|
3687
|
+
// "stopPrice": "",
|
|
3688
|
+
// "profit": "0.0000",
|
|
3689
|
+
// "commission": "0.0000",
|
|
3690
|
+
// "status": "Pending",
|
|
3691
|
+
// "time": 1721884753767,
|
|
3692
|
+
// "updateTime": 1721884753786,
|
|
3693
|
+
// "clientOrderId": "",
|
|
3694
|
+
// "leverage": "",
|
|
3695
|
+
// "takeProfit": {
|
|
3696
|
+
// "type": "TAKE_PROFIT",
|
|
3697
|
+
// "quantity": 0,
|
|
3698
|
+
// "stopPrice": 0,
|
|
3699
|
+
// "price": 0,
|
|
3700
|
+
// "workingType": "MARK_PRICE",
|
|
3701
|
+
// "stopGuaranteed": ""
|
|
3702
|
+
// },
|
|
3703
|
+
// "stopLoss": {
|
|
3704
|
+
// "type": "STOP",
|
|
3705
|
+
// "quantity": 0,
|
|
3706
|
+
// "stopPrice": 0,
|
|
3707
|
+
// "price": 0,
|
|
3708
|
+
// "workingType": "MARK_PRICE",
|
|
3709
|
+
// "stopGuaranteed": ""
|
|
3710
|
+
// },
|
|
3711
|
+
// "advanceAttr": 0,
|
|
3712
|
+
// "positionID": 0,
|
|
3713
|
+
// "takeProfitEntrustPrice": 0,
|
|
3714
|
+
// "stopLossEntrustPrice": 0,
|
|
3715
|
+
// "orderType": "",
|
|
3716
|
+
// "workingType": "MARK_PRICE"
|
|
3717
|
+
// }
|
|
3718
|
+
// }
|
|
3719
|
+
// }
|
|
3720
|
+
//
|
|
3721
|
+
}
|
|
3722
|
+
else {
|
|
3723
|
+
response = await this.swapV2PrivateGetTradeOrder(this.extend(request, params));
|
|
3724
|
+
//
|
|
3725
|
+
// {
|
|
3726
|
+
// "code": 0,
|
|
3727
|
+
// "msg": "",
|
|
3728
|
+
// "data": {
|
|
3729
|
+
// "order": {
|
|
3730
|
+
// "symbol": "BTC-USDT",
|
|
3731
|
+
// "orderId": 1597597642269917184,
|
|
3732
|
+
// "side": "SELL",
|
|
3733
|
+
// "positionSide": "LONG",
|
|
3734
|
+
// "type": "TAKE_PROFIT_MARKET",
|
|
3735
|
+
// "origQty": "1.0000",
|
|
3736
|
+
// "price": "0.0",
|
|
3737
|
+
// "executedQty": "0.0000",
|
|
3738
|
+
// "avgPrice": "0.0",
|
|
3739
|
+
// "cumQuote": "",
|
|
3740
|
+
// "stopPrice": "16494.0",
|
|
3741
|
+
// "profit": "",
|
|
3742
|
+
// "commission": "",
|
|
3743
|
+
// "status": "FILLED",
|
|
3744
|
+
// "time": 1669731935000,
|
|
3745
|
+
// "updateTime": 1669752524000
|
|
3746
|
+
// }
|
|
3747
|
+
// }
|
|
3748
|
+
// }
|
|
3749
|
+
//
|
|
3750
|
+
}
|
|
3574
3751
|
}
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
// {
|
|
3579
|
-
// "code": 0,
|
|
3580
|
-
// "msg": "",
|
|
3581
|
-
// "data": {
|
|
3582
|
-
// "symbol": "XRP-USDT",
|
|
3583
|
-
// "orderId": 1514087361158316032,
|
|
3584
|
-
// "price": "0.5",
|
|
3585
|
-
// "origQty": "10",
|
|
3586
|
-
// "executedQty": "0",
|
|
3587
|
-
// "cummulativeQuoteQty": "0",
|
|
3588
|
-
// "status": "CANCELED",
|
|
3589
|
-
// "type": "LIMIT",
|
|
3590
|
-
// "side": "BUY",
|
|
3591
|
-
// "time": 1649821532000,
|
|
3592
|
-
// "updateTime": 1649821543000,
|
|
3593
|
-
// "origQuoteOrderQty": "0",
|
|
3594
|
-
// "fee": "0",
|
|
3595
|
-
// "feeAsset": "XRP"
|
|
3596
|
-
// }
|
|
3597
|
-
// }
|
|
3598
|
-
//
|
|
3599
|
-
// swap
|
|
3600
|
-
//
|
|
3601
|
-
// {
|
|
3602
|
-
// "code": 0,
|
|
3603
|
-
// "msg": "",
|
|
3604
|
-
// "data": {
|
|
3605
|
-
// "order": {
|
|
3606
|
-
// "symbol": "BTC-USDT",
|
|
3607
|
-
// "orderId": 1597597642269917184,
|
|
3608
|
-
// "side": "SELL",
|
|
3609
|
-
// "positionSide": "LONG",
|
|
3610
|
-
// "type": "TAKE_PROFIT_MARKET",
|
|
3611
|
-
// "origQty": "1.0000",
|
|
3612
|
-
// "price": "0.0",
|
|
3613
|
-
// "executedQty": "0.0000",
|
|
3614
|
-
// "avgPrice": "0.0",
|
|
3615
|
-
// "cumQuote": "",
|
|
3616
|
-
// "stopPrice": "16494.0",
|
|
3617
|
-
// "profit": "",
|
|
3618
|
-
// "commission": "",
|
|
3619
|
-
// "status": "FILLED",
|
|
3620
|
-
// "time": 1669731935000,
|
|
3621
|
-
// "updateTime": 1669752524000
|
|
3622
|
-
// }
|
|
3623
|
-
// }
|
|
3624
|
-
// }
|
|
3625
|
-
//
|
|
3626
|
-
const data = this.safeValue(response, 'data');
|
|
3627
|
-
const first = this.safeDict(data, 'order', data);
|
|
3628
|
-
return this.parseOrder(first, market);
|
|
3752
|
+
const data = this.safeDict(response, 'data', {});
|
|
3753
|
+
const order = this.safeDict(data, 'order', data);
|
|
3754
|
+
return this.parseOrder(order, market);
|
|
3629
3755
|
}
|
|
3630
3756
|
async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
3631
3757
|
/**
|
|
@@ -3726,9 +3852,10 @@ class bingx extends bingx$1 {
|
|
|
3726
3852
|
/**
|
|
3727
3853
|
* @method
|
|
3728
3854
|
* @name bingx#fetchOpenOrders
|
|
3729
|
-
* @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Query%20Open%20Orders
|
|
3730
|
-
* @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Query%20all%20current%20pending%20orders
|
|
3731
3855
|
* @description fetch all unfilled currently open orders
|
|
3856
|
+
* @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Current%20Open%20Orders
|
|
3857
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Current%20All%20Open%20Orders
|
|
3858
|
+
* @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20all%20current%20pending%20orders
|
|
3732
3859
|
* @param {string} symbol unified market symbol
|
|
3733
3860
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
3734
3861
|
* @param {int} [limit] the maximum number of open order structures to retrieve
|
|
@@ -3742,13 +3869,21 @@ class bingx extends bingx$1 {
|
|
|
3742
3869
|
market = this.market(symbol);
|
|
3743
3870
|
request['symbol'] = market['id'];
|
|
3744
3871
|
}
|
|
3872
|
+
let type = undefined;
|
|
3873
|
+
let subType = undefined;
|
|
3745
3874
|
let response = undefined;
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3875
|
+
[type, params] = this.handleMarketTypeAndParams('fetchOpenOrders', market, params);
|
|
3876
|
+
[subType, params] = this.handleSubTypeAndParams('fetchOpenOrders', market, params);
|
|
3877
|
+
if (type === 'spot') {
|
|
3878
|
+
response = await this.spotV1PrivateGetTradeOpenOrders(this.extend(request, params));
|
|
3749
3879
|
}
|
|
3750
3880
|
else {
|
|
3751
|
-
|
|
3881
|
+
if (subType === 'inverse') {
|
|
3882
|
+
response = await this.cswapV1PrivateGetTradeOpenOrders(this.extend(request, params));
|
|
3883
|
+
}
|
|
3884
|
+
else {
|
|
3885
|
+
response = await this.swapV2PrivateGetTradeOpenOrders(this.extend(request, params));
|
|
3886
|
+
}
|
|
3752
3887
|
}
|
|
3753
3888
|
//
|
|
3754
3889
|
// spot
|
|
@@ -3776,7 +3911,61 @@ class bingx extends bingx$1 {
|
|
|
3776
3911
|
// }
|
|
3777
3912
|
// }
|
|
3778
3913
|
//
|
|
3779
|
-
// swap
|
|
3914
|
+
// inverse swap
|
|
3915
|
+
//
|
|
3916
|
+
// {
|
|
3917
|
+
// "code": 0,
|
|
3918
|
+
// "msg": "",
|
|
3919
|
+
// "data": {
|
|
3920
|
+
// "orders": [
|
|
3921
|
+
// {
|
|
3922
|
+
// "symbol": "SOL-USD",
|
|
3923
|
+
// "orderId": "1816013900044320768",
|
|
3924
|
+
// "side": "BUY",
|
|
3925
|
+
// "positionSide": "Long",
|
|
3926
|
+
// "type": "LIMIT",
|
|
3927
|
+
// "quantity": 1,
|
|
3928
|
+
// "origQty": "",
|
|
3929
|
+
// "price": "150",
|
|
3930
|
+
// "executedQty": "0",
|
|
3931
|
+
// "avgPrice": "0.000",
|
|
3932
|
+
// "cumQuote": "",
|
|
3933
|
+
// "stopPrice": "",
|
|
3934
|
+
// "profit": "0.0000",
|
|
3935
|
+
// "commission": "0.0000",
|
|
3936
|
+
// "status": "Pending",
|
|
3937
|
+
// "time": 1721806428334,
|
|
3938
|
+
// "updateTime": 1721806428352,
|
|
3939
|
+
// "clientOrderId": "",
|
|
3940
|
+
// "leverage": "",
|
|
3941
|
+
// "takeProfit": {
|
|
3942
|
+
// "type": "TAKE_PROFIT",
|
|
3943
|
+
// "quantity": 0,
|
|
3944
|
+
// "stopPrice": 0,
|
|
3945
|
+
// "price": 0,
|
|
3946
|
+
// "workingType": "MARK_PRICE",
|
|
3947
|
+
// "stopGuaranteed": ""
|
|
3948
|
+
// },
|
|
3949
|
+
// "stopLoss": {
|
|
3950
|
+
// "type": "STOP",
|
|
3951
|
+
// "quantity": 0,
|
|
3952
|
+
// "stopPrice": 0,
|
|
3953
|
+
// "price": 0,
|
|
3954
|
+
// "workingType": "MARK_PRICE",
|
|
3955
|
+
// "stopGuaranteed": ""
|
|
3956
|
+
// },
|
|
3957
|
+
// "advanceAttr": 0,
|
|
3958
|
+
// "positionID": 0,
|
|
3959
|
+
// "takeProfitEntrustPrice": 0,
|
|
3960
|
+
// "stopLossEntrustPrice": 0,
|
|
3961
|
+
// "orderType": "",
|
|
3962
|
+
// "workingType": "MARK_PRICE"
|
|
3963
|
+
// }
|
|
3964
|
+
// ]
|
|
3965
|
+
// }
|
|
3966
|
+
// }
|
|
3967
|
+
//
|
|
3968
|
+
// linear swap
|
|
3780
3969
|
//
|
|
3781
3970
|
// {
|
|
3782
3971
|
// "code": 0,
|
|
@@ -3814,8 +4003,51 @@ class bingx extends bingx$1 {
|
|
|
3814
4003
|
* @method
|
|
3815
4004
|
* @name bingx#fetchClosedOrders
|
|
3816
4005
|
* @description fetches information on multiple closed orders made by the user
|
|
3817
|
-
* @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Query%20Order%
|
|
3818
|
-
* @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#
|
|
4006
|
+
* @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history
|
|
4007
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history
|
|
4008
|
+
* @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders
|
|
4009
|
+
* @see https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
|
|
4010
|
+
* @param {string} symbol unified market symbol of the closed orders
|
|
4011
|
+
* @param {int} [since] timestamp in ms of the earliest order
|
|
4012
|
+
* @param {int} [limit] the max number of closed orders to return
|
|
4013
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4014
|
+
* @param {int} [params.until] the latest time in ms to fetch orders for
|
|
4015
|
+
* @param {boolean} [params.standard] whether to fetch standard contract orders
|
|
4016
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4017
|
+
*/
|
|
4018
|
+
await this.loadMarkets();
|
|
4019
|
+
const orders = await this.fetchCanceledAndClosedOrders(symbol, since, limit, params);
|
|
4020
|
+
return this.filterBy(orders, 'status', 'closed');
|
|
4021
|
+
}
|
|
4022
|
+
async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4023
|
+
/**
|
|
4024
|
+
* @method
|
|
4025
|
+
* @name bingx#fetchCanceledOrders
|
|
4026
|
+
* @description fetches information on multiple canceled orders made by the user
|
|
4027
|
+
* @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history
|
|
4028
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history
|
|
4029
|
+
* @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders
|
|
4030
|
+
* @see https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
|
|
4031
|
+
* @param {string} symbol unified market symbol of the canceled orders
|
|
4032
|
+
* @param {int} [since] timestamp in ms of the earliest order
|
|
4033
|
+
* @param {int} [limit] the max number of canceled orders to return
|
|
4034
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4035
|
+
* @param {int} [params.until] the latest time in ms to fetch orders for
|
|
4036
|
+
* @param {boolean} [params.standard] whether to fetch standard contract orders
|
|
4037
|
+
* @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4038
|
+
*/
|
|
4039
|
+
await this.loadMarkets();
|
|
4040
|
+
const orders = await this.fetchCanceledAndClosedOrders(symbol, since, limit, params);
|
|
4041
|
+
return this.filterBy(orders, 'status', 'canceled');
|
|
4042
|
+
}
|
|
4043
|
+
async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4044
|
+
/**
|
|
4045
|
+
* @method
|
|
4046
|
+
* @name bingx#fetchCanceledAndClosedOrders
|
|
4047
|
+
* @description fetches information on multiple closed orders made by the user
|
|
4048
|
+
* @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history
|
|
4049
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history
|
|
4050
|
+
* @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders
|
|
3819
4051
|
* @see https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
|
|
3820
4052
|
* @param {string} [symbol] unified market symbol of the market orders were made in
|
|
3821
4053
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
@@ -3833,75 +4065,133 @@ class bingx extends bingx$1 {
|
|
|
3833
4065
|
const request = {
|
|
3834
4066
|
'symbol': market['id'],
|
|
3835
4067
|
};
|
|
3836
|
-
let
|
|
4068
|
+
let type = undefined;
|
|
4069
|
+
let subType = undefined;
|
|
3837
4070
|
let standard = undefined;
|
|
4071
|
+
let response = undefined;
|
|
4072
|
+
[type, params] = this.handleMarketTypeAndParams('fetchClosedOrders', market, params);
|
|
4073
|
+
[subType, params] = this.handleSubTypeAndParams('fetchClosedOrders', market, params);
|
|
3838
4074
|
[standard, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'standard', false);
|
|
3839
|
-
const [marketType, query] = this.handleMarketTypeAndParams('fetchClosedOrders', market, params);
|
|
3840
4075
|
if (standard) {
|
|
3841
|
-
response = await this.contractV1PrivateGetAllOrders(this.extend(request,
|
|
4076
|
+
response = await this.contractV1PrivateGetAllOrders(this.extend(request, params));
|
|
3842
4077
|
}
|
|
3843
|
-
else if (
|
|
3844
|
-
response = await this.spotV1PrivateGetTradeHistoryOrders(this.extend(request,
|
|
4078
|
+
else if (type === 'spot') {
|
|
4079
|
+
response = await this.spotV1PrivateGetTradeHistoryOrders(this.extend(request, params));
|
|
4080
|
+
//
|
|
4081
|
+
// {
|
|
4082
|
+
// "code": 0,
|
|
4083
|
+
// "msg": "",
|
|
4084
|
+
// "data": {
|
|
4085
|
+
// "orders": [
|
|
4086
|
+
// {
|
|
4087
|
+
// "symbol": "XRP-USDT",
|
|
4088
|
+
// "orderId": 1514073325788200960,
|
|
4089
|
+
// "price": "0.5",
|
|
4090
|
+
// "origQty": "20",
|
|
4091
|
+
// "executedQty": "0",
|
|
4092
|
+
// "cummulativeQuoteQty": "0",
|
|
4093
|
+
// "status": "PENDING",
|
|
4094
|
+
// "type": "LIMIT",
|
|
4095
|
+
// "side": "BUY",
|
|
4096
|
+
// "time": 1649818185647,
|
|
4097
|
+
// "updateTime": 1649818185647,
|
|
4098
|
+
// "origQuoteOrderQty": "0"
|
|
4099
|
+
// }
|
|
4100
|
+
// ]
|
|
4101
|
+
// }
|
|
4102
|
+
// }
|
|
4103
|
+
//
|
|
3845
4104
|
}
|
|
3846
4105
|
else {
|
|
3847
|
-
|
|
4106
|
+
if (subType === 'inverse') {
|
|
4107
|
+
response = await this.cswapV1PrivateGetTradeOrderHistory(this.extend(request, params));
|
|
4108
|
+
//
|
|
4109
|
+
// {
|
|
4110
|
+
// "code": 0,
|
|
4111
|
+
// "msg": "",
|
|
4112
|
+
// "data": {
|
|
4113
|
+
// "orders": [
|
|
4114
|
+
// {
|
|
4115
|
+
// "symbol": "SOL-USD",
|
|
4116
|
+
// "orderId": "1816002957423951872",
|
|
4117
|
+
// "side": "BUY",
|
|
4118
|
+
// "positionSide": "LONG",
|
|
4119
|
+
// "type": "LIMIT",
|
|
4120
|
+
// "quantity": 1,
|
|
4121
|
+
// "origQty": "10.00000000",
|
|
4122
|
+
// "price": "150.000",
|
|
4123
|
+
// "executedQty": "0.00000000",
|
|
4124
|
+
// "avgPrice": "0.000",
|
|
4125
|
+
// "cumQuote": "",
|
|
4126
|
+
// "stopPrice": "0.000",
|
|
4127
|
+
// "profit": "0.0000",
|
|
4128
|
+
// "commission": "0.000000",
|
|
4129
|
+
// "status": "Filled",
|
|
4130
|
+
// "time": 1721803819000,
|
|
4131
|
+
// "updateTime": 1721803856000,
|
|
4132
|
+
// "clientOrderId": "",
|
|
4133
|
+
// "leverage": "",
|
|
4134
|
+
// "takeProfit": {
|
|
4135
|
+
// "type": "",
|
|
4136
|
+
// "quantity": 0,
|
|
4137
|
+
// "stopPrice": 0,
|
|
4138
|
+
// "price": 0,
|
|
4139
|
+
// "workingType": "",
|
|
4140
|
+
// "stopGuaranteed": ""
|
|
4141
|
+
// },
|
|
4142
|
+
// "stopLoss": {
|
|
4143
|
+
// "type": "",
|
|
4144
|
+
// "quantity": 0,
|
|
4145
|
+
// "stopPrice": 0,
|
|
4146
|
+
// "price": 0,
|
|
4147
|
+
// "workingType": "",
|
|
4148
|
+
// "stopGuaranteed": ""
|
|
4149
|
+
// },
|
|
4150
|
+
// "advanceAttr": 0,
|
|
4151
|
+
// "positionID": 0,
|
|
4152
|
+
// "takeProfitEntrustPrice": 0,
|
|
4153
|
+
// "stopLossEntrustPrice": 0,
|
|
4154
|
+
// "orderType": "",
|
|
4155
|
+
// "workingType": "MARK_PRICE"
|
|
4156
|
+
// },
|
|
4157
|
+
// ]
|
|
4158
|
+
// }
|
|
4159
|
+
// }
|
|
4160
|
+
//
|
|
4161
|
+
}
|
|
4162
|
+
else {
|
|
4163
|
+
response = await this.swapV2PrivateGetTradeAllOrders(this.extend(request, params));
|
|
4164
|
+
//
|
|
4165
|
+
// {
|
|
4166
|
+
// "code": 0,
|
|
4167
|
+
// "msg": "",
|
|
4168
|
+
// "data": {
|
|
4169
|
+
// "orders": [
|
|
4170
|
+
// {
|
|
4171
|
+
// "symbol": "LINK-USDT",
|
|
4172
|
+
// "orderId": 1585839271162413056,
|
|
4173
|
+
// "side": "BUY",
|
|
4174
|
+
// "positionSide": "LONG",
|
|
4175
|
+
// "type": "TRIGGER_MARKET",
|
|
4176
|
+
// "origQty": "5.0",
|
|
4177
|
+
// "price": "9",
|
|
4178
|
+
// "executedQty": "0.0",
|
|
4179
|
+
// "avgPrice": "0",
|
|
4180
|
+
// "cumQuote": "0",
|
|
4181
|
+
// "stopPrice": "5",
|
|
4182
|
+
// "profit": "0.0000",
|
|
4183
|
+
// "commission": "0.000000",
|
|
4184
|
+
// "status": "CANCELLED",
|
|
4185
|
+
// "time": 1667631605000,
|
|
4186
|
+
// "updateTime": 1667631605000
|
|
4187
|
+
// },
|
|
4188
|
+
// ]
|
|
4189
|
+
// }
|
|
4190
|
+
// }
|
|
4191
|
+
//
|
|
4192
|
+
}
|
|
3848
4193
|
}
|
|
3849
|
-
|
|
3850
|
-
// spot
|
|
3851
|
-
//
|
|
3852
|
-
// {
|
|
3853
|
-
// "code": 0,
|
|
3854
|
-
// "msg": "",
|
|
3855
|
-
// "data": {
|
|
3856
|
-
// "orders": [
|
|
3857
|
-
// {
|
|
3858
|
-
// "symbol": "XRP-USDT",
|
|
3859
|
-
// "orderId": 1514073325788200960,
|
|
3860
|
-
// "price": "0.5",
|
|
3861
|
-
// "origQty": "20",
|
|
3862
|
-
// "executedQty": "0",
|
|
3863
|
-
// "cummulativeQuoteQty": "0",
|
|
3864
|
-
// "status": "PENDING",
|
|
3865
|
-
// "type": "LIMIT",
|
|
3866
|
-
// "side": "BUY",
|
|
3867
|
-
// "time": 1649818185647,
|
|
3868
|
-
// "updateTime": 1649818185647,
|
|
3869
|
-
// "origQuoteOrderQty": "0"
|
|
3870
|
-
// }
|
|
3871
|
-
// ]
|
|
3872
|
-
// }
|
|
3873
|
-
// }
|
|
3874
|
-
//
|
|
3875
|
-
// swap
|
|
3876
|
-
//
|
|
3877
|
-
// {
|
|
3878
|
-
// "code": 0,
|
|
3879
|
-
// "msg": "",
|
|
3880
|
-
// "data": {
|
|
3881
|
-
// "orders": [
|
|
3882
|
-
// {
|
|
3883
|
-
// "symbol": "LINK-USDT",
|
|
3884
|
-
// "orderId": 1585839271162413056,
|
|
3885
|
-
// "side": "BUY",
|
|
3886
|
-
// "positionSide": "LONG",
|
|
3887
|
-
// "type": "TRIGGER_MARKET",
|
|
3888
|
-
// "origQty": "5.0",
|
|
3889
|
-
// "price": "9",
|
|
3890
|
-
// "executedQty": "0.0",
|
|
3891
|
-
// "avgPrice": "0",
|
|
3892
|
-
// "cumQuote": "0",
|
|
3893
|
-
// "stopPrice": "5",
|
|
3894
|
-
// "profit": "0.0000",
|
|
3895
|
-
// "commission": "0.000000",
|
|
3896
|
-
// "status": "CANCELLED",
|
|
3897
|
-
// "time": 1667631605000,
|
|
3898
|
-
// "updateTime": 1667631605000
|
|
3899
|
-
// },
|
|
3900
|
-
// ]
|
|
3901
|
-
// }
|
|
3902
|
-
// }
|
|
3903
|
-
//
|
|
3904
|
-
const data = this.safeValue(response, 'data', []);
|
|
4194
|
+
const data = this.safeDict(response, 'data', {});
|
|
3905
4195
|
const orders = this.safeList(data, 'orders', []);
|
|
3906
4196
|
return this.parseOrders(orders, market, since, limit);
|
|
3907
4197
|
}
|
|
@@ -4333,7 +4623,8 @@ class bingx extends bingx$1 {
|
|
|
4333
4623
|
* @method
|
|
4334
4624
|
* @name bingx#setMarginMode
|
|
4335
4625
|
* @description set margin mode to 'cross' or 'isolated'
|
|
4336
|
-
* @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#
|
|
4626
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Change%20Margin%20Type
|
|
4627
|
+
* @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Set%20Margin%20Type
|
|
4337
4628
|
* @param {string} marginMode 'cross' or 'isolated'
|
|
4338
4629
|
* @param {string} symbol unified market symbol
|
|
4339
4630
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -4358,7 +4649,14 @@ class bingx extends bingx$1 {
|
|
|
4358
4649
|
'symbol': market['id'],
|
|
4359
4650
|
'marginType': marginMode,
|
|
4360
4651
|
};
|
|
4361
|
-
|
|
4652
|
+
let subType = undefined;
|
|
4653
|
+
[subType, params] = this.handleSubTypeAndParams('setMarginMode', market, params);
|
|
4654
|
+
if (subType === 'inverse') {
|
|
4655
|
+
return await this.cswapV1PrivatePostTradeMarginType(this.extend(request, params));
|
|
4656
|
+
}
|
|
4657
|
+
else {
|
|
4658
|
+
return await this.swapV2PrivatePostTradeMarginType(this.extend(request, params));
|
|
4659
|
+
}
|
|
4362
4660
|
}
|
|
4363
4661
|
async addMargin(symbol, amount, params = {}) {
|
|
4364
4662
|
const request = {
|
|
@@ -5317,7 +5615,8 @@ class bingx extends bingx$1 {
|
|
|
5317
5615
|
* @method
|
|
5318
5616
|
* @name bingx#fetchMarginMode
|
|
5319
5617
|
* @description fetches the margin mode of the trading pair
|
|
5320
|
-
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Margin%
|
|
5618
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Margin%20Type
|
|
5619
|
+
* @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Margin%20Type
|
|
5321
5620
|
* @param {string} symbol unified symbol of the market to fetch the margin mode for
|
|
5322
5621
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5323
5622
|
* @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
|
|
@@ -5327,25 +5626,45 @@ class bingx extends bingx$1 {
|
|
|
5327
5626
|
const request = {
|
|
5328
5627
|
'symbol': market['id'],
|
|
5329
5628
|
};
|
|
5330
|
-
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5339
|
-
|
|
5629
|
+
let subType = undefined;
|
|
5630
|
+
let response = undefined;
|
|
5631
|
+
[subType, params] = this.handleSubTypeAndParams('fetchMarginMode', market, params);
|
|
5632
|
+
if (subType === 'inverse') {
|
|
5633
|
+
response = await this.cswapV1PrivateGetTradeMarginType(this.extend(request, params));
|
|
5634
|
+
//
|
|
5635
|
+
// {
|
|
5636
|
+
// "code": 0,
|
|
5637
|
+
// "msg": "",
|
|
5638
|
+
// "timestamp": 1721966069132,
|
|
5639
|
+
// "data": {
|
|
5640
|
+
// "symbol": "SOL-USD",
|
|
5641
|
+
// "marginType": "CROSSED"
|
|
5642
|
+
// }
|
|
5643
|
+
// }
|
|
5644
|
+
//
|
|
5645
|
+
}
|
|
5646
|
+
else {
|
|
5647
|
+
response = await this.swapV2PrivateGetTradeMarginType(this.extend(request, params));
|
|
5648
|
+
//
|
|
5649
|
+
// {
|
|
5650
|
+
// "code": 0,
|
|
5651
|
+
// "msg": "",
|
|
5652
|
+
// "data": {
|
|
5653
|
+
// "marginType": "CROSSED"
|
|
5654
|
+
// }
|
|
5655
|
+
// }
|
|
5656
|
+
//
|
|
5657
|
+
}
|
|
5340
5658
|
const data = this.safeDict(response, 'data', {});
|
|
5341
5659
|
return this.parseMarginMode(data, market);
|
|
5342
5660
|
}
|
|
5343
5661
|
parseMarginMode(marginMode, market = undefined) {
|
|
5662
|
+
const marketId = this.safeString(marginMode, 'symbol');
|
|
5344
5663
|
let marginType = this.safeStringLower(marginMode, 'marginType');
|
|
5345
5664
|
marginType = (marginType === 'crossed') ? 'cross' : marginType;
|
|
5346
5665
|
return {
|
|
5347
5666
|
'info': marginMode,
|
|
5348
|
-
'symbol': market
|
|
5667
|
+
'symbol': this.safeSymbol(marketId, market, '-', 'swap'),
|
|
5349
5668
|
'marginMode': marginType,
|
|
5350
5669
|
};
|
|
5351
5670
|
}
|