ccxt 4.3.67 → 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/js/src/bingx.js CHANGED
@@ -51,6 +51,7 @@ export default class bingx extends Exchange {
51
51
  'createTrailingPercentOrder': true,
52
52
  'createTriggerOrder': true,
53
53
  'fetchBalance': true,
54
+ 'fetchCanceledOrders': true,
54
55
  'fetchClosedOrders': true,
55
56
  'fetchCurrencies': true,
56
57
  'fetchDepositAddress': true,
@@ -3014,8 +3015,7 @@ export default class bingx extends Exchange {
3014
3015
  // "clientOrderID": ""
3015
3016
  // }
3016
3017
  //
3017
- // inverse swap cancelAllOrders, cancelOrder
3018
- // inverse swap cancelAllOrders, cancelOrder, fetchOpenOrders
3018
+ // inverse swap cancelAllOrders, cancelOrder, fetchOrder, fetchOpenOrders, fetchClosedOrders, fetchCanceledOrders
3019
3019
  //
3020
3020
  // {
3021
3021
  // "symbol": "SOL-USD",
@@ -3075,7 +3075,7 @@ export default class bingx extends Exchange {
3075
3075
  const side = this.safeStringLower2(order, 'side', 'S');
3076
3076
  const timestamp = this.safeIntegerN(order, ['time', 'transactTime', 'E']);
3077
3077
  const lastTradeTimestamp = this.safeInteger2(order, 'updateTime', 'T');
3078
- const statusId = this.safeString2(order, 'status', 'X');
3078
+ const statusId = this.safeStringUpper2(order, 'status', 'X');
3079
3079
  let feeCurrencyCode = this.safeString2(order, 'feeAsset', 'N');
3080
3080
  const feeCost = this.safeStringN(order, ['fee', 'commission', 'n']);
3081
3081
  if ((feeCurrencyCode === undefined)) {
@@ -3621,11 +3621,12 @@ export default class bingx extends Exchange {
3621
3621
  * @method
3622
3622
  * @name bingx#fetchOrder
3623
3623
  * @description fetches information on an order made by the user
3624
- * @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Query%20Orders
3625
- * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Query%20Order
3624
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20details
3625
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20details
3626
+ * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Order
3626
3627
  * @param {string} symbol unified symbol of the market the order was made in
3627
3628
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3628
- * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3629
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3629
3630
  */
3630
3631
  if (symbol === undefined) {
3631
3632
  throw new ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
@@ -3636,68 +3637,124 @@ export default class bingx extends Exchange {
3636
3637
  'symbol': market['id'],
3637
3638
  'orderId': id,
3638
3639
  };
3640
+ let type = undefined;
3641
+ let subType = undefined;
3639
3642
  let response = undefined;
3640
- const [marketType, query] = this.handleMarketTypeAndParams('fetchOrder', market, params);
3641
- if (marketType === 'spot') {
3642
- response = await this.spotV1PrivateGetTradeQuery(this.extend(request, query));
3643
+ [type, params] = this.handleMarketTypeAndParams('fetchOrder', market, params);
3644
+ [subType, params] = this.handleSubTypeAndParams('fetchOrder', market, params);
3645
+ if (type === 'spot') {
3646
+ response = await this.spotV1PrivateGetTradeQuery(this.extend(request, params));
3647
+ //
3648
+ // {
3649
+ // "code": 0,
3650
+ // "msg": "",
3651
+ // "data": {
3652
+ // "symbol": "XRP-USDT",
3653
+ // "orderId": 1514087361158316032,
3654
+ // "price": "0.5",
3655
+ // "origQty": "10",
3656
+ // "executedQty": "0",
3657
+ // "cummulativeQuoteQty": "0",
3658
+ // "status": "CANCELED",
3659
+ // "type": "LIMIT",
3660
+ // "side": "BUY",
3661
+ // "time": 1649821532000,
3662
+ // "updateTime": 1649821543000,
3663
+ // "origQuoteOrderQty": "0",
3664
+ // "fee": "0",
3665
+ // "feeAsset": "XRP"
3666
+ // }
3667
+ // }
3668
+ //
3643
3669
  }
3644
3670
  else {
3645
- response = await this.swapV2PrivateGetTradeOrder(this.extend(request, query));
3671
+ if (subType === 'inverse') {
3672
+ response = await this.cswapV1PrivateGetTradeOrderDetail(this.extend(request, params));
3673
+ //
3674
+ // {
3675
+ // "code": 0,
3676
+ // "msg": "",
3677
+ // "data": {
3678
+ // "order": {
3679
+ // "symbol": "SOL-USD",
3680
+ // "orderId": "1816342420721254400",
3681
+ // "side": "BUY",
3682
+ // "positionSide": "Long",
3683
+ // "type": "LIMIT",
3684
+ // "quantity": 1,
3685
+ // "origQty": "",
3686
+ // "price": "150",
3687
+ // "executedQty": "0",
3688
+ // "avgPrice": "0.000",
3689
+ // "cumQuote": "",
3690
+ // "stopPrice": "",
3691
+ // "profit": "0.0000",
3692
+ // "commission": "0.0000",
3693
+ // "status": "Pending",
3694
+ // "time": 1721884753767,
3695
+ // "updateTime": 1721884753786,
3696
+ // "clientOrderId": "",
3697
+ // "leverage": "",
3698
+ // "takeProfit": {
3699
+ // "type": "TAKE_PROFIT",
3700
+ // "quantity": 0,
3701
+ // "stopPrice": 0,
3702
+ // "price": 0,
3703
+ // "workingType": "MARK_PRICE",
3704
+ // "stopGuaranteed": ""
3705
+ // },
3706
+ // "stopLoss": {
3707
+ // "type": "STOP",
3708
+ // "quantity": 0,
3709
+ // "stopPrice": 0,
3710
+ // "price": 0,
3711
+ // "workingType": "MARK_PRICE",
3712
+ // "stopGuaranteed": ""
3713
+ // },
3714
+ // "advanceAttr": 0,
3715
+ // "positionID": 0,
3716
+ // "takeProfitEntrustPrice": 0,
3717
+ // "stopLossEntrustPrice": 0,
3718
+ // "orderType": "",
3719
+ // "workingType": "MARK_PRICE"
3720
+ // }
3721
+ // }
3722
+ // }
3723
+ //
3724
+ }
3725
+ else {
3726
+ response = await this.swapV2PrivateGetTradeOrder(this.extend(request, params));
3727
+ //
3728
+ // {
3729
+ // "code": 0,
3730
+ // "msg": "",
3731
+ // "data": {
3732
+ // "order": {
3733
+ // "symbol": "BTC-USDT",
3734
+ // "orderId": 1597597642269917184,
3735
+ // "side": "SELL",
3736
+ // "positionSide": "LONG",
3737
+ // "type": "TAKE_PROFIT_MARKET",
3738
+ // "origQty": "1.0000",
3739
+ // "price": "0.0",
3740
+ // "executedQty": "0.0000",
3741
+ // "avgPrice": "0.0",
3742
+ // "cumQuote": "",
3743
+ // "stopPrice": "16494.0",
3744
+ // "profit": "",
3745
+ // "commission": "",
3746
+ // "status": "FILLED",
3747
+ // "time": 1669731935000,
3748
+ // "updateTime": 1669752524000
3749
+ // }
3750
+ // }
3751
+ // }
3752
+ //
3753
+ }
3646
3754
  }
3647
- //
3648
- // spot
3649
- //
3650
- // {
3651
- // "code": 0,
3652
- // "msg": "",
3653
- // "data": {
3654
- // "symbol": "XRP-USDT",
3655
- // "orderId": 1514087361158316032,
3656
- // "price": "0.5",
3657
- // "origQty": "10",
3658
- // "executedQty": "0",
3659
- // "cummulativeQuoteQty": "0",
3660
- // "status": "CANCELED",
3661
- // "type": "LIMIT",
3662
- // "side": "BUY",
3663
- // "time": 1649821532000,
3664
- // "updateTime": 1649821543000,
3665
- // "origQuoteOrderQty": "0",
3666
- // "fee": "0",
3667
- // "feeAsset": "XRP"
3668
- // }
3669
- // }
3670
- //
3671
- // swap
3672
- //
3673
- // {
3674
- // "code": 0,
3675
- // "msg": "",
3676
- // "data": {
3677
- // "order": {
3678
- // "symbol": "BTC-USDT",
3679
- // "orderId": 1597597642269917184,
3680
- // "side": "SELL",
3681
- // "positionSide": "LONG",
3682
- // "type": "TAKE_PROFIT_MARKET",
3683
- // "origQty": "1.0000",
3684
- // "price": "0.0",
3685
- // "executedQty": "0.0000",
3686
- // "avgPrice": "0.0",
3687
- // "cumQuote": "",
3688
- // "stopPrice": "16494.0",
3689
- // "profit": "",
3690
- // "commission": "",
3691
- // "status": "FILLED",
3692
- // "time": 1669731935000,
3693
- // "updateTime": 1669752524000
3694
- // }
3695
- // }
3696
- // }
3697
- //
3698
- const data = this.safeValue(response, 'data');
3699
- const first = this.safeDict(data, 'order', data);
3700
- return this.parseOrder(first, market);
3755
+ const data = this.safeDict(response, 'data', {});
3756
+ const order = this.safeDict(data, 'order', data);
3757
+ return this.parseOrder(order, market);
3701
3758
  }
3702
3759
  async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
3703
3760
  /**
@@ -3949,8 +4006,51 @@ export default class bingx extends Exchange {
3949
4006
  * @method
3950
4007
  * @name bingx#fetchClosedOrders
3951
4008
  * @description fetches information on multiple closed orders made by the user
3952
- * @see https://bingx-api.github.io/docs/#/spot/trade-api.html#Query%20Order%20History
3953
- * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#User's%20Force%20Orders
4009
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history
4010
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history
4011
+ * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders
4012
+ * @see https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
4013
+ * @param {string} symbol unified market symbol of the closed orders
4014
+ * @param {int} [since] timestamp in ms of the earliest order
4015
+ * @param {int} [limit] the max number of closed orders to return
4016
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4017
+ * @param {int} [params.until] the latest time in ms to fetch orders for
4018
+ * @param {boolean} [params.standard] whether to fetch standard contract orders
4019
+ * @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
4020
+ */
4021
+ await this.loadMarkets();
4022
+ const orders = await this.fetchCanceledAndClosedOrders(symbol, since, limit, params);
4023
+ return this.filterBy(orders, 'status', 'closed');
4024
+ }
4025
+ async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
4026
+ /**
4027
+ * @method
4028
+ * @name bingx#fetchCanceledOrders
4029
+ * @description fetches information on multiple canceled orders made by the user
4030
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history
4031
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history
4032
+ * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders
4033
+ * @see https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
4034
+ * @param {string} symbol unified market symbol of the canceled orders
4035
+ * @param {int} [since] timestamp in ms of the earliest order
4036
+ * @param {int} [limit] the max number of canceled orders to return
4037
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
4038
+ * @param {int} [params.until] the latest time in ms to fetch orders for
4039
+ * @param {boolean} [params.standard] whether to fetch standard contract orders
4040
+ * @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
4041
+ */
4042
+ await this.loadMarkets();
4043
+ const orders = await this.fetchCanceledAndClosedOrders(symbol, since, limit, params);
4044
+ return this.filterBy(orders, 'status', 'canceled');
4045
+ }
4046
+ async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
4047
+ /**
4048
+ * @method
4049
+ * @name bingx#fetchCanceledAndClosedOrders
4050
+ * @description fetches information on multiple closed orders made by the user
4051
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history
4052
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history
4053
+ * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders
3954
4054
  * @see https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
3955
4055
  * @param {string} [symbol] unified market symbol of the market orders were made in
3956
4056
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -3968,75 +4068,133 @@ export default class bingx extends Exchange {
3968
4068
  const request = {
3969
4069
  'symbol': market['id'],
3970
4070
  };
3971
- let response = undefined;
4071
+ let type = undefined;
4072
+ let subType = undefined;
3972
4073
  let standard = undefined;
4074
+ let response = undefined;
4075
+ [type, params] = this.handleMarketTypeAndParams('fetchClosedOrders', market, params);
4076
+ [subType, params] = this.handleSubTypeAndParams('fetchClosedOrders', market, params);
3973
4077
  [standard, params] = this.handleOptionAndParams(params, 'fetchClosedOrders', 'standard', false);
3974
- const [marketType, query] = this.handleMarketTypeAndParams('fetchClosedOrders', market, params);
3975
4078
  if (standard) {
3976
- response = await this.contractV1PrivateGetAllOrders(this.extend(request, query));
4079
+ response = await this.contractV1PrivateGetAllOrders(this.extend(request, params));
3977
4080
  }
3978
- else if (marketType === 'spot') {
3979
- response = await this.spotV1PrivateGetTradeHistoryOrders(this.extend(request, query));
4081
+ else if (type === 'spot') {
4082
+ response = await this.spotV1PrivateGetTradeHistoryOrders(this.extend(request, params));
4083
+ //
4084
+ // {
4085
+ // "code": 0,
4086
+ // "msg": "",
4087
+ // "data": {
4088
+ // "orders": [
4089
+ // {
4090
+ // "symbol": "XRP-USDT",
4091
+ // "orderId": 1514073325788200960,
4092
+ // "price": "0.5",
4093
+ // "origQty": "20",
4094
+ // "executedQty": "0",
4095
+ // "cummulativeQuoteQty": "0",
4096
+ // "status": "PENDING",
4097
+ // "type": "LIMIT",
4098
+ // "side": "BUY",
4099
+ // "time": 1649818185647,
4100
+ // "updateTime": 1649818185647,
4101
+ // "origQuoteOrderQty": "0"
4102
+ // }
4103
+ // ]
4104
+ // }
4105
+ // }
4106
+ //
3980
4107
  }
3981
4108
  else {
3982
- response = await this.swapV2PrivateGetTradeAllOrders(this.extend(request, query));
4109
+ if (subType === 'inverse') {
4110
+ response = await this.cswapV1PrivateGetTradeOrderHistory(this.extend(request, params));
4111
+ //
4112
+ // {
4113
+ // "code": 0,
4114
+ // "msg": "",
4115
+ // "data": {
4116
+ // "orders": [
4117
+ // {
4118
+ // "symbol": "SOL-USD",
4119
+ // "orderId": "1816002957423951872",
4120
+ // "side": "BUY",
4121
+ // "positionSide": "LONG",
4122
+ // "type": "LIMIT",
4123
+ // "quantity": 1,
4124
+ // "origQty": "10.00000000",
4125
+ // "price": "150.000",
4126
+ // "executedQty": "0.00000000",
4127
+ // "avgPrice": "0.000",
4128
+ // "cumQuote": "",
4129
+ // "stopPrice": "0.000",
4130
+ // "profit": "0.0000",
4131
+ // "commission": "0.000000",
4132
+ // "status": "Filled",
4133
+ // "time": 1721803819000,
4134
+ // "updateTime": 1721803856000,
4135
+ // "clientOrderId": "",
4136
+ // "leverage": "",
4137
+ // "takeProfit": {
4138
+ // "type": "",
4139
+ // "quantity": 0,
4140
+ // "stopPrice": 0,
4141
+ // "price": 0,
4142
+ // "workingType": "",
4143
+ // "stopGuaranteed": ""
4144
+ // },
4145
+ // "stopLoss": {
4146
+ // "type": "",
4147
+ // "quantity": 0,
4148
+ // "stopPrice": 0,
4149
+ // "price": 0,
4150
+ // "workingType": "",
4151
+ // "stopGuaranteed": ""
4152
+ // },
4153
+ // "advanceAttr": 0,
4154
+ // "positionID": 0,
4155
+ // "takeProfitEntrustPrice": 0,
4156
+ // "stopLossEntrustPrice": 0,
4157
+ // "orderType": "",
4158
+ // "workingType": "MARK_PRICE"
4159
+ // },
4160
+ // ]
4161
+ // }
4162
+ // }
4163
+ //
4164
+ }
4165
+ else {
4166
+ response = await this.swapV2PrivateGetTradeAllOrders(this.extend(request, params));
4167
+ //
4168
+ // {
4169
+ // "code": 0,
4170
+ // "msg": "",
4171
+ // "data": {
4172
+ // "orders": [
4173
+ // {
4174
+ // "symbol": "LINK-USDT",
4175
+ // "orderId": 1585839271162413056,
4176
+ // "side": "BUY",
4177
+ // "positionSide": "LONG",
4178
+ // "type": "TRIGGER_MARKET",
4179
+ // "origQty": "5.0",
4180
+ // "price": "9",
4181
+ // "executedQty": "0.0",
4182
+ // "avgPrice": "0",
4183
+ // "cumQuote": "0",
4184
+ // "stopPrice": "5",
4185
+ // "profit": "0.0000",
4186
+ // "commission": "0.000000",
4187
+ // "status": "CANCELLED",
4188
+ // "time": 1667631605000,
4189
+ // "updateTime": 1667631605000
4190
+ // },
4191
+ // ]
4192
+ // }
4193
+ // }
4194
+ //
4195
+ }
3983
4196
  }
3984
- //
3985
- // spot
3986
- //
3987
- // {
3988
- // "code": 0,
3989
- // "msg": "",
3990
- // "data": {
3991
- // "orders": [
3992
- // {
3993
- // "symbol": "XRP-USDT",
3994
- // "orderId": 1514073325788200960,
3995
- // "price": "0.5",
3996
- // "origQty": "20",
3997
- // "executedQty": "0",
3998
- // "cummulativeQuoteQty": "0",
3999
- // "status": "PENDING",
4000
- // "type": "LIMIT",
4001
- // "side": "BUY",
4002
- // "time": 1649818185647,
4003
- // "updateTime": 1649818185647,
4004
- // "origQuoteOrderQty": "0"
4005
- // }
4006
- // ]
4007
- // }
4008
- // }
4009
- //
4010
- // swap
4011
- //
4012
- // {
4013
- // "code": 0,
4014
- // "msg": "",
4015
- // "data": {
4016
- // "orders": [
4017
- // {
4018
- // "symbol": "LINK-USDT",
4019
- // "orderId": 1585839271162413056,
4020
- // "side": "BUY",
4021
- // "positionSide": "LONG",
4022
- // "type": "TRIGGER_MARKET",
4023
- // "origQty": "5.0",
4024
- // "price": "9",
4025
- // "executedQty": "0.0",
4026
- // "avgPrice": "0",
4027
- // "cumQuote": "0",
4028
- // "stopPrice": "5",
4029
- // "profit": "0.0000",
4030
- // "commission": "0.000000",
4031
- // "status": "CANCELLED",
4032
- // "time": 1667631605000,
4033
- // "updateTime": 1667631605000
4034
- // },
4035
- // ]
4036
- // }
4037
- // }
4038
- //
4039
- const data = this.safeValue(response, 'data', []);
4197
+ const data = this.safeDict(response, 'data', {});
4040
4198
  const orders = this.safeList(data, 'orders', []);
4041
4199
  return this.parseOrders(orders, market, since, limit);
4042
4200
  }
@@ -4468,7 +4626,8 @@ export default class bingx extends Exchange {
4468
4626
  * @method
4469
4627
  * @name bingx#setMarginMode
4470
4628
  * @description set margin mode to 'cross' or 'isolated'
4471
- * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Switch%20Margin%20Mode
4629
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Change%20Margin%20Type
4630
+ * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Set%20Margin%20Type
4472
4631
  * @param {string} marginMode 'cross' or 'isolated'
4473
4632
  * @param {string} symbol unified market symbol
4474
4633
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -4493,7 +4652,14 @@ export default class bingx extends Exchange {
4493
4652
  'symbol': market['id'],
4494
4653
  'marginType': marginMode,
4495
4654
  };
4496
- return await this.swapV2PrivatePostTradeMarginType(this.extend(request, params));
4655
+ let subType = undefined;
4656
+ [subType, params] = this.handleSubTypeAndParams('setMarginMode', market, params);
4657
+ if (subType === 'inverse') {
4658
+ return await this.cswapV1PrivatePostTradeMarginType(this.extend(request, params));
4659
+ }
4660
+ else {
4661
+ return await this.swapV2PrivatePostTradeMarginType(this.extend(request, params));
4662
+ }
4497
4663
  }
4498
4664
  async addMargin(symbol, amount, params = {}) {
4499
4665
  const request = {
@@ -5452,7 +5618,8 @@ export default class bingx extends Exchange {
5452
5618
  * @method
5453
5619
  * @name bingx#fetchMarginMode
5454
5620
  * @description fetches the margin mode of the trading pair
5455
- * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Margin%20Mode
5621
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Margin%20Type
5622
+ * @see https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Margin%20Type
5456
5623
  * @param {string} symbol unified symbol of the market to fetch the margin mode for
5457
5624
  * @param {object} [params] extra parameters specific to the exchange API endpoint
5458
5625
  * @returns {object} a [margin mode structure]{@link https://docs.ccxt.com/#/?id=margin-mode-structure}
@@ -5462,25 +5629,45 @@ export default class bingx extends Exchange {
5462
5629
  const request = {
5463
5630
  'symbol': market['id'],
5464
5631
  };
5465
- const response = await this.swapV2PrivateGetTradeMarginType(this.extend(request, params));
5466
- //
5467
- // {
5468
- // "code": 0,
5469
- // "msg": "",
5470
- // "data": {
5471
- // "marginType": "CROSSED"
5472
- // }
5473
- // }
5474
- //
5632
+ let subType = undefined;
5633
+ let response = undefined;
5634
+ [subType, params] = this.handleSubTypeAndParams('fetchMarginMode', market, params);
5635
+ if (subType === 'inverse') {
5636
+ response = await this.cswapV1PrivateGetTradeMarginType(this.extend(request, params));
5637
+ //
5638
+ // {
5639
+ // "code": 0,
5640
+ // "msg": "",
5641
+ // "timestamp": 1721966069132,
5642
+ // "data": {
5643
+ // "symbol": "SOL-USD",
5644
+ // "marginType": "CROSSED"
5645
+ // }
5646
+ // }
5647
+ //
5648
+ }
5649
+ else {
5650
+ response = await this.swapV2PrivateGetTradeMarginType(this.extend(request, params));
5651
+ //
5652
+ // {
5653
+ // "code": 0,
5654
+ // "msg": "",
5655
+ // "data": {
5656
+ // "marginType": "CROSSED"
5657
+ // }
5658
+ // }
5659
+ //
5660
+ }
5475
5661
  const data = this.safeDict(response, 'data', {});
5476
5662
  return this.parseMarginMode(data, market);
5477
5663
  }
5478
5664
  parseMarginMode(marginMode, market = undefined) {
5665
+ const marketId = this.safeString(marginMode, 'symbol');
5479
5666
  let marginType = this.safeStringLower(marginMode, 'marginType');
5480
5667
  marginType = (marginType === 'crossed') ? 'cross' : marginType;
5481
5668
  return {
5482
5669
  'info': marginMode,
5483
- 'symbol': market['symbol'],
5670
+ 'symbol': this.safeSymbol(marketId, market, '-', 'swap'),
5484
5671
  'marginMode': marginType,
5485
5672
  };
5486
5673
  }
package/js/src/bitget.js CHANGED
@@ -5208,8 +5208,10 @@ export default class bitget extends Exchange {
5208
5208
  response = JSON.parse(response);
5209
5209
  }
5210
5210
  const data = this.safeDict(response, 'data');
5211
- if ((data !== undefined) && !Array.isArray(data)) {
5212
- return this.parseOrder(data, market);
5211
+ if ((data !== undefined)) {
5212
+ if (!Array.isArray(data)) {
5213
+ return this.parseOrder(data, market);
5214
+ }
5213
5215
  }
5214
5216
  const dataList = this.safeList(response, 'data', []);
5215
5217
  const first = this.safeDict(dataList, 0, {});
@@ -79,17 +79,17 @@ export default class krakenfutures extends krakenfuturesRest {
79
79
  const url = this.urls['api']['ws'];
80
80
  const messageHash = 'challenge';
81
81
  const client = this.client(url);
82
- let future = this.safeValue(client.subscriptions, messageHash);
83
- if (future === undefined) {
82
+ const future = client.future(messageHash);
83
+ const authenticated = this.safeValue(client.subscriptions, messageHash);
84
+ if (authenticated === undefined) {
84
85
  const request = {
85
86
  'event': 'challenge',
86
87
  'api_key': this.apiKey,
87
88
  };
88
89
  const message = this.extend(request, params);
89
- future = await this.watch(url, messageHash, message, messageHash);
90
- client.subscriptions[messageHash] = future;
90
+ this.watch(url, messageHash, message, messageHash);
91
91
  }
92
- return future;
92
+ return await future;
93
93
  }
94
94
  async watchOrderBookForSymbols(symbols, limit = undefined, params = {}) {
95
95
  /**
@@ -1575,7 +1575,8 @@ export default class krakenfutures extends krakenfuturesRest {
1575
1575
  const signature = this.hmac(hashedChallenge, base64Secret, sha512, 'base64');
1576
1576
  this.options['challenge'] = challenge;
1577
1577
  this.options['signedChallenge'] = signature;
1578
- client.resolve(message, messageHash);
1578
+ const future = this.safeValue(client.futures, messageHash);
1579
+ future.resolve(true);
1579
1580
  }
1580
1581
  else {
1581
1582
  const error = new AuthenticationError(this.id + ' ' + this.json(message));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.3.67",
3
+ "version": "4.3.68",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.min.js",
6
6
  "type": "module",
@@ -1,4 +0,0 @@
1
- import coinbasepro from './coinbasepro.js';
2
- export default class coinbaseprime extends coinbasepro {
3
- describe(): any;
4
- }