ccxt 4.2.38 → 4.2.40

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.
Files changed (127) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +1340 -407
  3. package/dist/ccxt.browser.min.js +3 -3
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/ascendex.js +28 -24
  6. package/dist/cjs/src/base/Exchange.js +28 -16
  7. package/dist/cjs/src/binance.js +528 -181
  8. package/dist/cjs/src/bingx.js +250 -23
  9. package/dist/cjs/src/bitget.js +14 -3
  10. package/dist/cjs/src/bitso.js +18 -2
  11. package/dist/cjs/src/bitstamp.js +24 -2
  12. package/dist/cjs/src/bl3p.js +6 -0
  13. package/dist/cjs/src/blockchaincom.js +21 -0
  14. package/dist/cjs/src/btcalpha.js +9 -0
  15. package/dist/cjs/src/btcbox.js +9 -0
  16. package/dist/cjs/src/btcmarkets.js +19 -0
  17. package/dist/cjs/src/bybit.js +3 -1
  18. package/dist/cjs/src/coinbase.js +21 -8
  19. package/dist/cjs/src/coinbasepro.js +1 -0
  20. package/dist/cjs/src/coinlist.js +9 -7
  21. package/dist/cjs/src/coinmetro.js +2 -1
  22. package/dist/cjs/src/krakenfutures.js +133 -16
  23. package/dist/cjs/src/luno.js +1 -1
  24. package/dist/cjs/src/mexc.js +43 -43
  25. package/dist/cjs/src/okx.js +11 -17
  26. package/dist/cjs/src/phemex.js +1 -0
  27. package/dist/cjs/src/poloniexfutures.js +11 -5
  28. package/dist/cjs/src/pro/bitmart.js +141 -48
  29. package/dist/cjs/src/pro/bybit.js +5 -5
  30. package/dist/cjs/src/pro/mexc.js +1 -1
  31. package/dist/cjs/src/wavesexchange.js +1 -1
  32. package/dist/cjs/src/woo.js +1 -1
  33. package/js/ccxt.d.ts +1 -1
  34. package/js/ccxt.js +1 -1
  35. package/js/src/abstract/bingx.d.ts +4 -0
  36. package/js/src/abstract/coinbase.d.ts +1 -0
  37. package/js/src/abstract/coinbasepro.d.ts +1 -0
  38. package/js/src/abstract/okx.d.ts +1 -0
  39. package/js/src/ascendex.d.ts +2 -2
  40. package/js/src/ascendex.js +28 -24
  41. package/js/src/base/Exchange.d.ts +12 -8
  42. package/js/src/base/Exchange.js +28 -16
  43. package/js/src/base/types.d.ts +2 -0
  44. package/js/src/bigone.d.ts +2 -2
  45. package/js/src/binance.d.ts +9 -9
  46. package/js/src/binance.js +528 -181
  47. package/js/src/bingx.d.ts +6 -5
  48. package/js/src/bingx.js +250 -23
  49. package/js/src/bitfinex.d.ts +3 -3
  50. package/js/src/bitfinex2.d.ts +2 -2
  51. package/js/src/bitget.d.ts +5 -5
  52. package/js/src/bitget.js +14 -3
  53. package/js/src/bitmart.d.ts +2 -2
  54. package/js/src/bitmex.d.ts +2 -2
  55. package/js/src/bitrue.d.ts +2 -2
  56. package/js/src/bitso.d.ts +1 -1
  57. package/js/src/bitso.js +18 -2
  58. package/js/src/bitstamp.d.ts +1 -1
  59. package/js/src/bitstamp.js +24 -2
  60. package/js/src/bitvavo.d.ts +1 -1
  61. package/js/src/bl3p.js +6 -0
  62. package/js/src/blockchaincom.js +21 -0
  63. package/js/src/blofin.d.ts +2 -2
  64. package/js/src/btcalpha.js +9 -0
  65. package/js/src/btcbox.js +9 -0
  66. package/js/src/btcmarkets.js +19 -0
  67. package/js/src/bybit.d.ts +7 -7
  68. package/js/src/bybit.js +3 -1
  69. package/js/src/cex.d.ts +1 -1
  70. package/js/src/coinbase.d.ts +2 -2
  71. package/js/src/coinbase.js +21 -8
  72. package/js/src/coinbasepro.js +1 -0
  73. package/js/src/coinex.d.ts +4 -4
  74. package/js/src/coinlist.d.ts +2 -2
  75. package/js/src/coinlist.js +9 -7
  76. package/js/src/coinmetro.js +2 -1
  77. package/js/src/coinone.d.ts +1 -1
  78. package/js/src/delta.d.ts +2 -2
  79. package/js/src/deribit.d.ts +3 -3
  80. package/js/src/digifinex.d.ts +3 -3
  81. package/js/src/exmo.d.ts +2 -2
  82. package/js/src/gate.d.ts +6 -6
  83. package/js/src/hitbtc.d.ts +2 -2
  84. package/js/src/hollaex.d.ts +1 -1
  85. package/js/src/htx.d.ts +3 -3
  86. package/js/src/huobijp.d.ts +1 -1
  87. package/js/src/kraken.d.ts +2 -2
  88. package/js/src/krakenfutures.d.ts +4 -2
  89. package/js/src/krakenfutures.js +133 -16
  90. package/js/src/kucoin.d.ts +5 -5
  91. package/js/src/kucoinfutures.d.ts +2 -2
  92. package/js/src/latoken.d.ts +1 -1
  93. package/js/src/lbank.d.ts +2 -2
  94. package/js/src/luno.d.ts +1 -1
  95. package/js/src/luno.js +1 -1
  96. package/js/src/mexc.d.ts +4 -4
  97. package/js/src/mexc.js +43 -43
  98. package/js/src/ndax.d.ts +1 -1
  99. package/js/src/novadax.d.ts +1 -1
  100. package/js/src/okcoin.d.ts +2 -2
  101. package/js/src/okx.d.ts +7 -7
  102. package/js/src/okx.js +11 -17
  103. package/js/src/paymium.d.ts +2 -2
  104. package/js/src/phemex.d.ts +4 -4
  105. package/js/src/phemex.js +1 -0
  106. package/js/src/poloniex.d.ts +2 -2
  107. package/js/src/poloniexfutures.d.ts +2 -2
  108. package/js/src/poloniexfutures.js +11 -5
  109. package/js/src/pro/bitmart.d.ts +4 -0
  110. package/js/src/pro/bitmart.js +141 -48
  111. package/js/src/pro/bitvavo.d.ts +1 -1
  112. package/js/src/pro/bybit.d.ts +1 -1
  113. package/js/src/pro/bybit.js +5 -5
  114. package/js/src/pro/cex.d.ts +2 -2
  115. package/js/src/pro/coinbase.d.ts +2 -2
  116. package/js/src/pro/coinex.d.ts +1 -1
  117. package/js/src/pro/lbank.d.ts +1 -1
  118. package/js/src/pro/mexc.js +1 -1
  119. package/js/src/probit.d.ts +1 -1
  120. package/js/src/timex.d.ts +1 -1
  121. package/js/src/upbit.d.ts +1 -1
  122. package/js/src/wavesexchange.js +1 -1
  123. package/js/src/whitebit.d.ts +2 -2
  124. package/js/src/woo.d.ts +3 -3
  125. package/js/src/woo.js +1 -1
  126. package/js/src/zonda.d.ts +3 -3
  127. package/package.json +2 -2
@@ -140,6 +140,7 @@ class bingx extends bingx$1 {
140
140
  'trade/order': 3,
141
141
  'trade/cancel': 3,
142
142
  'trade/batchOrders': 3,
143
+ 'trade/order/cancelReplace': 3,
143
144
  'trade/cancelOrders': 3,
144
145
  'trade/cancelOpenOrders': 3,
145
146
  },
@@ -161,12 +162,19 @@ class bingx extends bingx$1 {
161
162
  },
162
163
  'swap': {
163
164
  'v1': {
165
+ 'public': {
166
+ 'get': {
167
+ 'ticker/price': 1,
168
+ },
169
+ },
164
170
  'private': {
165
171
  'get': {
166
172
  'positionSide/dual': 1,
167
173
  'market/markPriceKlines': 1,
174
+ 'trade/batchCancelReplace': 1,
168
175
  },
169
176
  'post': {
177
+ 'trade/cancelReplace': 1,
170
178
  'positionSide/dual': 1,
171
179
  },
172
180
  },
@@ -2241,22 +2249,104 @@ class bingx extends bingx$1 {
2241
2249
  // reduceOnly: false
2242
2250
  // }
2243
2251
  //
2252
+ // editOrder (swap)
2253
+ //
2254
+ // {
2255
+ // cancelResult: 'true',
2256
+ // cancelMsg: '',
2257
+ // cancelResponse: {
2258
+ // cancelClientOrderId: '',
2259
+ // cancelOrderId: '1755336244265705472',
2260
+ // symbol: 'SOL-USDT',
2261
+ // orderId: '1755336244265705472',
2262
+ // side: 'SELL',
2263
+ // positionSide: 'SHORT',
2264
+ // type: 'LIMIT',
2265
+ // origQty: '1',
2266
+ // price: '100.000',
2267
+ // executedQty: '0',
2268
+ // avgPrice: '0.000',
2269
+ // cumQuote: '0',
2270
+ // stopPrice: '',
2271
+ // profit: '0.0000',
2272
+ // commission: '0.000000',
2273
+ // status: 'PENDING',
2274
+ // time: '1707339747860',
2275
+ // updateTime: '1707339747860',
2276
+ // clientOrderId: '',
2277
+ // leverage: '20X',
2278
+ // workingType: 'MARK_PRICE',
2279
+ // onlyOnePosition: false,
2280
+ // reduceOnly: false
2281
+ // },
2282
+ // replaceResult: 'true',
2283
+ // replaceMsg: '',
2284
+ // newOrderResponse: {
2285
+ // orderId: '1755338440612995072',
2286
+ // symbol: 'SOL-USDT',
2287
+ // positionSide: 'SHORT',
2288
+ // side: 'SELL',
2289
+ // type: 'LIMIT',
2290
+ // price: '99',
2291
+ // quantity: '2',
2292
+ // stopPrice: '0',
2293
+ // workingType: 'MARK_PRICE',
2294
+ // clientOrderID: '',
2295
+ // timeInForce: 'GTC',
2296
+ // priceRate: '0',
2297
+ // stopLoss: '',
2298
+ // takeProfit: '',
2299
+ // reduceOnly: false
2300
+ // }
2301
+ // }
2302
+ //
2303
+ // editOrder (spot)
2304
+ //
2305
+ // {
2306
+ // cancelResult: { code: '0', msg: '', result: true },
2307
+ // openResult: { code: '0', msg: '', result: true },
2308
+ // orderOpenResponse: {
2309
+ // symbol: 'SOL-USDT',
2310
+ // orderId: '1755334007697866752',
2311
+ // transactTime: '1707339214620',
2312
+ // price: '99',
2313
+ // stopPrice: '0',
2314
+ // origQty: '0.2',
2315
+ // executedQty: '0',
2316
+ // cummulativeQuoteQty: '0',
2317
+ // status: 'PENDING',
2318
+ // type: 'LIMIT',
2319
+ // side: 'SELL',
2320
+ // clientOrderID: ''
2321
+ // },
2322
+ // orderCancelResponse: {
2323
+ // symbol: 'SOL-USDT',
2324
+ // orderId: '1755117055251480576',
2325
+ // price: '100',
2326
+ // stopPrice: '0',
2327
+ // origQty: '0.2',
2328
+ // executedQty: '0',
2329
+ // cummulativeQuoteQty: '0',
2330
+ // status: 'CANCELED',
2331
+ // type: 'LIMIT',
2332
+ // side: 'SELL'
2333
+ // }
2334
+ // }
2335
+ //
2336
+ const info = order;
2337
+ const newOrder = this.safeDict2(order, 'newOrderResponse', 'orderOpenResponse');
2338
+ if (newOrder !== undefined) {
2339
+ order = newOrder;
2340
+ }
2244
2341
  const positionSide = this.safeString2(order, 'positionSide', 'ps');
2245
2342
  const marketType = (positionSide === undefined) ? 'spot' : 'swap';
2246
2343
  const marketId = this.safeString2(order, 'symbol', 's');
2247
2344
  if (market === undefined) {
2248
2345
  market = this.safeMarket(marketId, undefined, undefined, marketType);
2249
2346
  }
2250
- const symbol = this.safeSymbol(marketId, market, '-', marketType);
2251
- const orderId = this.safeString2(order, 'orderId', 'i');
2252
2347
  const side = this.safeStringLower2(order, 'side', 'S');
2253
- const type = this.safeStringLower2(order, 'type', 'o');
2254
2348
  const timestamp = this.safeIntegerN(order, ['time', 'transactTime', 'E']);
2255
2349
  const lastTradeTimestamp = this.safeInteger2(order, 'updateTime', 'T');
2256
- const price = this.safeString2(order, 'price', 'p');
2257
- const average = this.safeString2(order, 'avgPrice', 'ap');
2258
- const amount = this.safeString2(order, 'origQty', 'q');
2259
- const filled = this.safeString2(order, 'executedQty', 'z');
2260
2350
  const statusId = this.safeString2(order, 'status', 'X');
2261
2351
  let feeCurrencyCode = this.safeString2(order, 'feeAsset', 'N');
2262
2352
  const feeCost = this.safeStringN(order, ['fee', 'commission', 'n']);
@@ -2273,11 +2363,6 @@ class bingx extends bingx$1 {
2273
2363
  feeCurrencyCode = market['quote'];
2274
2364
  }
2275
2365
  }
2276
- const fee = {
2277
- 'currency': feeCurrencyCode,
2278
- 'cost': Precise["default"].stringAbs(feeCost),
2279
- };
2280
- const clientOrderId = this.safeStringN(order, ['clientOrderID', 'origClientOrderId', 'c']);
2281
2366
  let stopLoss = this.safeValue(order, 'stopLoss');
2282
2367
  let stopLossPrice = undefined;
2283
2368
  if ((stopLoss !== undefined) && (stopLoss !== '')) {
@@ -2303,31 +2388,35 @@ class bingx extends bingx$1 {
2303
2388
  takeProfitPrice = this.safeNumber(takeProfit, 'stopPrice');
2304
2389
  }
2305
2390
  return this.safeOrder({
2306
- 'info': order,
2307
- 'id': orderId,
2308
- 'clientOrderId': clientOrderId,
2391
+ 'info': info,
2392
+ 'id': this.safeString2(order, 'orderId', 'i'),
2393
+ 'clientOrderId': this.safeStringN(order, ['clientOrderID', 'origClientOrderId', 'c']),
2394
+ 'symbol': this.safeSymbol(marketId, market, '-', marketType),
2309
2395
  'timestamp': timestamp,
2310
2396
  'datetime': this.iso8601(timestamp),
2311
2397
  'lastTradeTimestamp': lastTradeTimestamp,
2312
2398
  'lastUpdateTimestamp': this.safeInteger(order, 'updateTime'),
2313
- 'symbol': symbol,
2314
- 'type': type,
2315
- 'timeInForce': undefined,
2399
+ 'type': this.safeStringLower2(order, 'type', 'o'),
2400
+ 'timeInForce': this.safeString(order, 'timeInForce'),
2316
2401
  'postOnly': undefined,
2317
2402
  'side': this.parseOrderSide(side),
2318
- 'price': price,
2403
+ 'price': this.safeString2(order, 'price', 'p'),
2319
2404
  'stopPrice': this.safeNumber(order, 'stopPrice'),
2320
2405
  'triggerPrice': this.safeNumber(order, 'stopPrice'),
2321
2406
  'stopLossPrice': stopLossPrice,
2322
2407
  'takeProfitPrice': takeProfitPrice,
2323
- 'average': average,
2408
+ 'average': this.safeString2(order, 'avgPrice', 'ap'),
2324
2409
  'cost': undefined,
2325
- 'amount': amount,
2326
- 'filled': filled,
2410
+ 'amount': this.safeStringN(order, ['origQty', 'q', 'quantity']),
2411
+ 'filled': this.safeString2(order, 'executedQty', 'z'),
2327
2412
  'remaining': undefined,
2328
2413
  'status': this.parseOrderStatus(statusId),
2329
- 'fee': fee,
2414
+ 'fee': {
2415
+ 'currency': feeCurrencyCode,
2416
+ 'cost': Precise["default"].stringAbs(feeCost),
2417
+ },
2330
2418
  'trades': undefined,
2419
+ 'reduceOnly': this.safeBool(order, 'reduceOnly'),
2331
2420
  }, market);
2332
2421
  }
2333
2422
  parseOrderStatus(status) {
@@ -3836,6 +3925,144 @@ class bingx extends bingx$1 {
3836
3925
  //
3837
3926
  return await this.swapV1PrivatePostPositionSideDual(this.extend(request, params));
3838
3927
  }
3928
+ async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
3929
+ /**
3930
+ * @method
3931
+ * @name bingx#editOrder
3932
+ * @description cancels an order and places a new order
3933
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Cancel%20order%20and%20place%20a%20new%20order // spot
3934
+ * @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Cancel%20an%20order%20and%20then%20Place%20a%20new%20order // swap
3935
+ * @param {string} id order id
3936
+ * @param {string} symbol unified symbol of the market to create an order in
3937
+ * @param {string} type 'market' or 'limit'
3938
+ * @param {string} side 'buy' or 'sell'
3939
+ * @param {float} amount how much of the currency you want to trade in units of the base currency
3940
+ * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
3941
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3942
+ * @param {string} [params.stopPrice] Trigger price used for TAKE_STOP_LIMIT, TAKE_STOP_MARKET, TRIGGER_LIMIT, TRIGGER_MARKET order types.
3943
+ * @param {object} [params.takeProfit] *takeProfit object in params* containing the triggerPrice at which the attached take profit order will be triggered
3944
+ * @param {float} [params.takeProfit.triggerPrice] take profit trigger price
3945
+ * @param {object} [params.stopLoss] *stopLoss object in params* containing the triggerPrice at which the attached stop loss order will be triggered
3946
+ * @param {float} [params.stopLoss.triggerPrice] stop loss trigger price
3947
+ *
3948
+ * EXCHANGE SPECIFIC PARAMETERS
3949
+ * @param {string} [params.cancelClientOrderID] the user-defined id of the order to be canceled, 1-40 characters, different orders cannot use the same clientOrderID, only supports a query range of 2 hours
3950
+ * @param {string} [params.cancelRestrictions] cancel orders with specified status, NEW: New order, PENDING: Pending order, PARTIALLY_FILLED: Partially filled
3951
+ * @param {string} [params.cancelReplaceMode] STOP_ON_FAILURE - if the cancel order fails, it will not continue to place a new order, ALLOW_FAILURE - regardless of whether the cancel order succeeds or fails, it will continue to place a new order
3952
+ * @param {float} [params.quoteOrderQty] order amount
3953
+ * @param {string} [params.newClientOrderId] custom order id consisting of letters, numbers, and _, 1-40 characters, different orders cannot use the same newClientOrderId.
3954
+ * @param {string} [params.positionSide] *contract only* position direction, required for single position as BOTH, for both long and short positions only LONG or SHORT can be chosen, defaults to LONG if empty
3955
+ * @param {string} [params.reduceOnly] *contract only* true or false, default=false for single position mode. this parameter is not accepted for both long and short positions mode
3956
+ * @param {float} [params.priceRate] *contract only* for type TRAILING_STOP_Market, Max = 1
3957
+ * @param {string} [params.workingType] *contract only* StopPrice trigger price types, MARK_PRICE (default), CONTRACT_PRICE, or INDEX_PRICE
3958
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
3959
+ */
3960
+ await this.loadMarkets();
3961
+ const market = this.market(symbol);
3962
+ const request = this.createOrderRequest(symbol, type, side, amount, price, params);
3963
+ request['cancelOrderId'] = id;
3964
+ request['cancelReplaceMode'] = 'STOP_ON_FAILURE';
3965
+ let response = undefined;
3966
+ if (market['swap']) {
3967
+ response = await this.swapV1PrivatePostTradeCancelReplace(this.extend(request, params));
3968
+ //
3969
+ // {
3970
+ // code: '0',
3971
+ // msg: '',
3972
+ // data: {
3973
+ // cancelResult: 'true',
3974
+ // cancelMsg: '',
3975
+ // cancelResponse: {
3976
+ // cancelClientOrderId: '',
3977
+ // cancelOrderId: '1755336244265705472',
3978
+ // symbol: 'SOL-USDT',
3979
+ // orderId: '1755336244265705472',
3980
+ // side: 'SELL',
3981
+ // positionSide: 'SHORT',
3982
+ // type: 'LIMIT',
3983
+ // origQty: '1',
3984
+ // price: '100.000',
3985
+ // executedQty: '0',
3986
+ // avgPrice: '0.000',
3987
+ // cumQuote: '0',
3988
+ // stopPrice: '',
3989
+ // profit: '0.0000',
3990
+ // commission: '0.000000',
3991
+ // status: 'PENDING',
3992
+ // time: '1707339747860',
3993
+ // updateTime: '1707339747860',
3994
+ // clientOrderId: '',
3995
+ // leverage: '20X',
3996
+ // workingType: 'MARK_PRICE',
3997
+ // onlyOnePosition: false,
3998
+ // reduceOnly: false
3999
+ // },
4000
+ // replaceResult: 'true',
4001
+ // replaceMsg: '',
4002
+ // newOrderResponse: {
4003
+ // orderId: '1755338440612995072',
4004
+ // symbol: 'SOL-USDT',
4005
+ // positionSide: 'SHORT',
4006
+ // side: 'SELL',
4007
+ // type: 'LIMIT',
4008
+ // price: '99',
4009
+ // quantity: '2',
4010
+ // stopPrice: '0',
4011
+ // workingType: 'MARK_PRICE',
4012
+ // clientOrderID: '',
4013
+ // timeInForce: 'GTC',
4014
+ // priceRate: '0',
4015
+ // stopLoss: '',
4016
+ // takeProfit: '',
4017
+ // reduceOnly: false
4018
+ // }
4019
+ // }
4020
+ // }
4021
+ //
4022
+ }
4023
+ else {
4024
+ response = await this.spotV1PrivatePostTradeOrderCancelReplace(this.extend(request, params));
4025
+ //
4026
+ // {
4027
+ // code: '0',
4028
+ // msg: '',
4029
+ // debugMsg: '',
4030
+ // data: {
4031
+ // cancelResult: { code: '0', msg: '', result: true },
4032
+ // openResult: { code: '0', msg: '', result: true },
4033
+ // orderOpenResponse: {
4034
+ // symbol: 'SOL-USDT',
4035
+ // orderId: '1755334007697866752',
4036
+ // transactTime: '1707339214620',
4037
+ // price: '99',
4038
+ // stopPrice: '0',
4039
+ // origQty: '0.2',
4040
+ // executedQty: '0',
4041
+ // cummulativeQuoteQty: '0',
4042
+ // status: 'PENDING',
4043
+ // type: 'LIMIT',
4044
+ // side: 'SELL',
4045
+ // clientOrderID: ''
4046
+ // },
4047
+ // orderCancelResponse: {
4048
+ // symbol: 'SOL-USDT',
4049
+ // orderId: '1755117055251480576',
4050
+ // price: '100',
4051
+ // stopPrice: '0',
4052
+ // origQty: '0.2',
4053
+ // executedQty: '0',
4054
+ // cummulativeQuoteQty: '0',
4055
+ // status: 'CANCELED',
4056
+ // type: 'LIMIT',
4057
+ // side: 'SELL'
4058
+ // }
4059
+ // }
4060
+ // }
4061
+ //
4062
+ }
4063
+ const data = this.safeDict(response, 'data');
4064
+ return this.parseOrder(data, market);
4065
+ }
3839
4066
  sign(path, section = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
3840
4067
  const type = section[0];
3841
4068
  const version = section[1];
@@ -3949,6 +3949,13 @@ class bitget extends bitget$1 {
3949
3949
  size = this.safeString(order, 'size');
3950
3950
  filled = this.safeString(order, 'baseVolume');
3951
3951
  }
3952
+ let side = this.safeString(order, 'side');
3953
+ const posMode = this.safeString(order, 'posMode');
3954
+ if (posMode === 'hedge_mode' && reduceOnly) {
3955
+ side = (side === 'buy') ? 'sell' : 'buy';
3956
+ // on bitget hedge mode if the position is long the side is always buy, and if the position is short the side is always sell
3957
+ // so the side of the reduceOnly order is inversed
3958
+ }
3952
3959
  return this.safeOrder({
3953
3960
  'info': order,
3954
3961
  'id': this.safeString2(order, 'orderId', 'data'),
@@ -3959,7 +3966,7 @@ class bitget extends bitget$1 {
3959
3966
  'lastUpdateTimestamp': updateTimestamp,
3960
3967
  'symbol': market['symbol'],
3961
3968
  'type': this.safeString(order, 'orderType'),
3962
- 'side': this.safeString(order, 'side'),
3969
+ 'side': side,
3963
3970
  'price': price,
3964
3971
  'amount': size,
3965
3972
  'cost': this.safeString2(order, 'quoteVolume', 'quoteSize'),
@@ -4485,7 +4492,7 @@ class bitget extends bitget$1 {
4485
4492
  const takeProfit = this.safeValue(params, 'takeProfit');
4486
4493
  const isStopLoss = stopLoss !== undefined;
4487
4494
  const isTakeProfit = takeProfit !== undefined;
4488
- const trailingTriggerPrice = this.safeString(params, 'trailingTriggerPrice', price);
4495
+ const trailingTriggerPrice = this.safeString(params, 'trailingTriggerPrice', this.numberToString(price));
4489
4496
  const trailingPercent = this.safeString2(params, 'trailingPercent', 'newCallbackRatio');
4490
4497
  const isTrailingPercentOrder = trailingPercent !== undefined;
4491
4498
  if (this.sum(isTriggerOrder, isStopLossOrder, isTakeProfitOrder, isTrailingPercentOrder) > 1) {
@@ -8286,7 +8293,11 @@ class bitget extends bitget$1 {
8286
8293
  }
8287
8294
  else {
8288
8295
  if (Object.keys(params).length) {
8289
- const queryInner = '?' + this.urlencode(this.keysort(params));
8296
+ let queryInner = '?' + this.urlencode(this.keysort(params));
8297
+ // check #21169 pr
8298
+ if (queryInner.indexOf('%24') > -1) {
8299
+ queryInner = queryInner.replace('%24', '$');
8300
+ }
8290
8301
  url += queryInner;
8291
8302
  auth += queryInner;
8292
8303
  }
@@ -343,6 +343,7 @@ class bitso extends bitso$1 {
343
343
  * @method
344
344
  * @name bitso#fetchMarkets
345
345
  * @description retrieves data on all markets for bitso
346
+ * @see https://docs.bitso.com/bitso-api/docs/list-available-books
346
347
  * @param {object} [params] extra parameters specific to the exchange API endpoint
347
348
  * @returns {object[]} an array of objects representing market data
348
349
  */
@@ -502,6 +503,7 @@ class bitso extends bitso$1 {
502
503
  * @method
503
504
  * @name bitso#fetchBalance
504
505
  * @description query for balance and get the amount of funds available for trading or funds locked in orders
506
+ * @see https://docs.bitso.com/bitso-api/docs/get-account-balance
505
507
  * @param {object} [params] extra parameters specific to the exchange API endpoint
506
508
  * @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
507
509
  */
@@ -539,6 +541,7 @@ class bitso extends bitso$1 {
539
541
  * @method
540
542
  * @name bitso#fetchOrderBook
541
543
  * @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
544
+ * @see https://docs.bitso.com/bitso-api/docs/list-order-book
542
545
  * @param {string} symbol unified symbol of the market to fetch the order book for
543
546
  * @param {int} [limit] the maximum amount of order book entries to return
544
547
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -603,6 +606,7 @@ class bitso extends bitso$1 {
603
606
  * @method
604
607
  * @name bitso#fetchTicker
605
608
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
609
+ * @see https://docs.bitso.com/bitso-api/docs/ticker
606
610
  * @param {string} symbol unified symbol of the market to fetch the ticker for
607
611
  * @param {object} [params] extra parameters specific to the exchange API endpoint
608
612
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -823,6 +827,7 @@ class bitso extends bitso$1 {
823
827
  * @method
824
828
  * @name bitso#fetchTrades
825
829
  * @description get the list of most recent trades for a particular symbol
830
+ * @see https://docs.bitso.com/bitso-api/docs/list-trades
826
831
  * @param {string} symbol unified symbol of the market to fetch trades for
827
832
  * @param {int} [since] timestamp in ms of the earliest trade to fetch
828
833
  * @param {int} [limit] the maximum amount of trades to fetch
@@ -842,6 +847,7 @@ class bitso extends bitso$1 {
842
847
  * @method
843
848
  * @name bitso#fetchTradingFees
844
849
  * @description fetch the trading fees for multiple markets
850
+ * @see https://docs.bitso.com/bitso-api/docs/list-fees
845
851
  * @param {object} [params] extra parameters specific to the exchange API endpoint
846
852
  * @returns {object} a dictionary of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure} indexed by market symbols
847
853
  */
@@ -913,6 +919,7 @@ class bitso extends bitso$1 {
913
919
  * @method
914
920
  * @name bitso#fetchMyTrades
915
921
  * @description fetch all trades made by the user
922
+ * @see https://docs.bitso.com/bitso-api/docs/user-trades
916
923
  * @param {string} symbol unified market symbol
917
924
  * @param {int} [since] the earliest time in ms to fetch trades for
918
925
  * @param {int} [limit] the maximum number of trades structures to retrieve
@@ -950,6 +957,7 @@ class bitso extends bitso$1 {
950
957
  * @method
951
958
  * @name bitso#createOrder
952
959
  * @description create a trade order
960
+ * @see https://docs.bitso.com/bitso-api/docs/place-an-order
953
961
  * @param {string} symbol unified symbol of the market to create an order in
954
962
  * @param {string} type 'market' or 'limit'
955
963
  * @param {string} side 'buy' or 'sell'
@@ -981,6 +989,7 @@ class bitso extends bitso$1 {
981
989
  * @method
982
990
  * @name bitso#cancelOrder
983
991
  * @description cancels an open order
992
+ * @see https://docs.bitso.com/bitso-api/docs/cancel-an-order
984
993
  * @param {string} id order id
985
994
  * @param {string} symbol not used by bitso cancelOrder ()
986
995
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -997,6 +1006,7 @@ class bitso extends bitso$1 {
997
1006
  * @method
998
1007
  * @name bitso#cancelOrders
999
1008
  * @description cancel multiple orders
1009
+ * @see https://docs.bitso.com/bitso-api/docs/cancel-an-order
1000
1010
  * @param {string[]} ids order ids
1001
1011
  * @param {string} symbol unified market symbol
1002
1012
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1033,6 +1043,7 @@ class bitso extends bitso$1 {
1033
1043
  * @method
1034
1044
  * @name bitso#cancelAllOrders
1035
1045
  * @description cancel all open orders
1046
+ * @see https://docs.bitso.com/bitso-api/docs/cancel-an-order
1036
1047
  * @param {undefined} symbol bitso does not support canceling orders for only a specific market
1037
1048
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1038
1049
  * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -1117,6 +1128,7 @@ class bitso extends bitso$1 {
1117
1128
  * @method
1118
1129
  * @name bitso#fetchOpenOrders
1119
1130
  * @description fetch all unfilled currently open orders
1131
+ * @see https://docs.bitso.com/bitso-api/docs/list-open-orders
1120
1132
  * @param {string} symbol unified market symbol
1121
1133
  * @param {int} [since] the earliest time in ms to fetch open orders for
1122
1134
  * @param {int} [limit] the maximum number of open orders structures to retrieve
@@ -1155,6 +1167,7 @@ class bitso extends bitso$1 {
1155
1167
  * @method
1156
1168
  * @name bitso#fetchOrder
1157
1169
  * @description fetches information on an order made by the user
1170
+ * @see https://docs.bitso.com/bitso-api/docs/look-up-orders
1158
1171
  * @param {string} symbol not used by bitso fetchOrder
1159
1172
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1160
1173
  * @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
@@ -1177,6 +1190,7 @@ class bitso extends bitso$1 {
1177
1190
  * @method
1178
1191
  * @name bitso#fetchOrderTrades
1179
1192
  * @description fetch all the trades made from a single order
1193
+ * @see https://docs.bitso.com/bitso-api/docs/list-user-trades
1180
1194
  * @param {string} id order id
1181
1195
  * @param {string} symbol unified market symbol
1182
1196
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -1197,6 +1211,7 @@ class bitso extends bitso$1 {
1197
1211
  * @method
1198
1212
  * @name bitso#fetchDeposit
1199
1213
  * @description fetch information on a deposit
1214
+ * @see https://docs.bitso.com/bitso-payouts-funding/docs/fundings
1200
1215
  * @param {string} id deposit id
1201
1216
  * @param {string} code bitso does not support filtering by currency code and will ignore this argument
1202
1217
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -1239,6 +1254,7 @@ class bitso extends bitso$1 {
1239
1254
  * @method
1240
1255
  * @name bitso#fetchDeposits
1241
1256
  * @description fetch all deposits made to an account
1257
+ * @see https://docs.bitso.com/bitso-payouts-funding/docs/fundings
1242
1258
  * @param {string} code unified currency code
1243
1259
  * @param {int} [since] the earliest time in ms to fetch deposits for
1244
1260
  * @param {int} [limit] the maximum number of deposits structures to retrieve
@@ -1314,7 +1330,7 @@ class bitso extends bitso$1 {
1314
1330
  * @name bitso#fetchTransactionFees
1315
1331
  * @deprecated
1316
1332
  * @description please use fetchDepositWithdrawFees instead
1317
- * @see https://bitso.com/api_info#fees
1333
+ * @see https://docs.bitso.com/bitso-api/docs/list-fees
1318
1334
  * @param {string[]|undefined} codes list of unified currency codes
1319
1335
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1320
1336
  * @returns {object[]} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}
@@ -1407,7 +1423,7 @@ class bitso extends bitso$1 {
1407
1423
  * @method
1408
1424
  * @name bitso#fetchDepositWithdrawFees
1409
1425
  * @description fetch deposit and withdraw fees
1410
- * @see https://bitso.com/api_info#fees
1426
+ * @see https://docs.bitso.com/bitso-api/docs/list-fees
1411
1427
  * @param {string[]|undefined} codes list of unified currency codes
1412
1428
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1413
1429
  * @returns {object[]} a list of [fee structures]{@link https://docs.ccxt.com/#/?id=fee-structure}