ccxt 4.2.12 → 4.2.14

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 (81) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.js +1338 -366
  3. package/dist/ccxt.browser.min.js +7 -7
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/js/ccxt.js +1 -1
  6. package/dist/cjs/js/src/base/Exchange.js +148 -1
  7. package/dist/cjs/js/src/bigone.js +125 -54
  8. package/dist/cjs/js/src/binance.js +142 -27
  9. package/dist/cjs/js/src/binanceus.js +8 -0
  10. package/dist/cjs/js/src/bingx.js +110 -36
  11. package/dist/cjs/js/src/bitget.js +17 -6
  12. package/dist/cjs/js/src/bitmart.js +3 -3
  13. package/dist/cjs/js/src/bybit.js +5 -1
  14. package/dist/cjs/js/src/coinbase.js +176 -26
  15. package/dist/cjs/js/src/coinex.js +3 -0
  16. package/dist/cjs/js/src/coinlist.js +1 -1
  17. package/dist/cjs/js/src/coinone.js +1 -1
  18. package/dist/cjs/js/src/delta.js +7 -1
  19. package/dist/cjs/js/src/deribit.js +1 -1
  20. package/dist/cjs/js/src/gate.js +79 -56
  21. package/dist/cjs/js/src/gemini.js +1 -1
  22. package/dist/cjs/js/src/htx.js +151 -1
  23. package/dist/cjs/js/src/independentreserve.js +7 -5
  24. package/dist/cjs/js/src/kraken.js +22 -14
  25. package/dist/cjs/js/src/kucoin.js +5 -0
  26. package/dist/cjs/js/src/kucoinfutures.js +131 -77
  27. package/dist/cjs/js/src/lbank.js +59 -33
  28. package/dist/cjs/js/src/oceanex.js +1 -1
  29. package/dist/cjs/js/src/okx.js +11 -9
  30. package/dist/cjs/js/src/phemex.js +9 -2
  31. package/dist/cjs/js/src/pro/kraken.js +1 -1
  32. package/dist/cjs/js/src/pro/okx.js +52 -2
  33. package/dist/cjs/js/src/probit.js +4 -2
  34. package/dist/cjs/js/src/wavesexchange.js +1 -1
  35. package/dist/cjs/js/src/woo.js +56 -2
  36. package/js/ccxt.d.ts +1 -1
  37. package/js/ccxt.js +1 -1
  38. package/js/src/abstract/bigone.d.ts +1 -0
  39. package/js/src/abstract/bingx.d.ts +2 -0
  40. package/js/src/abstract/kucoin.d.ts +4 -0
  41. package/js/src/abstract/kucoinfutures.d.ts +4 -0
  42. package/js/src/abstract/okx.d.ts +1 -0
  43. package/js/src/base/Exchange.d.ts +8 -0
  44. package/js/src/base/Exchange.js +148 -1
  45. package/js/src/bigone.d.ts +2 -0
  46. package/js/src/bigone.js +125 -54
  47. package/js/src/binance.d.ts +9 -0
  48. package/js/src/binance.js +142 -27
  49. package/js/src/binanceus.js +8 -0
  50. package/js/src/bingx.js +110 -36
  51. package/js/src/bitget.js +17 -6
  52. package/js/src/bitmart.js +3 -3
  53. package/js/src/bybit.js +5 -1
  54. package/js/src/coinbase.d.ts +26 -3
  55. package/js/src/coinbase.js +176 -26
  56. package/js/src/coinex.js +3 -0
  57. package/js/src/coinlist.js +1 -1
  58. package/js/src/coinone.js +1 -1
  59. package/js/src/delta.js +7 -1
  60. package/js/src/deribit.js +1 -1
  61. package/js/src/gate.js +79 -56
  62. package/js/src/gemini.js +1 -1
  63. package/js/src/htx.d.ts +10 -0
  64. package/js/src/htx.js +151 -1
  65. package/js/src/independentreserve.js +7 -5
  66. package/js/src/kraken.js +22 -14
  67. package/js/src/kucoin.js +5 -0
  68. package/js/src/kucoinfutures.d.ts +4 -2
  69. package/js/src/kucoinfutures.js +131 -77
  70. package/js/src/lbank.js +59 -33
  71. package/js/src/oceanex.js +1 -1
  72. package/js/src/okx.js +11 -9
  73. package/js/src/phemex.js +9 -2
  74. package/js/src/pro/kraken.js +1 -1
  75. package/js/src/pro/okx.d.ts +1 -0
  76. package/js/src/pro/okx.js +52 -2
  77. package/js/src/probit.js +4 -2
  78. package/js/src/wavesexchange.js +1 -1
  79. package/js/src/woo.d.ts +2 -0
  80. package/js/src/woo.js +56 -2
  81. package/package.json +1 -1
@@ -44,7 +44,6 @@ class binance extends binance$1 {
44
44
  'createMarketBuyOrderWithCost': true,
45
45
  'createMarketOrderWithCost': true,
46
46
  'createMarketSellOrderWithCost': true,
47
- 'createTrailingPercentOrder': true,
48
47
  'createOrder': true,
49
48
  'createOrders': true,
50
49
  'createPostOnlyOrder': true,
@@ -52,6 +51,10 @@ class binance extends binance$1 {
52
51
  'createStopLimitOrder': true,
53
52
  'createStopMarketOrder': false,
54
53
  'createStopOrder': true,
54
+ 'createTrailingPercentOrder': true,
55
+ 'createTriggerOrder': true,
56
+ 'createTakeProfitOrder': true,
57
+ 'createStopLossOrder': true,
55
58
  'editOrder': true,
56
59
  'fetchAccounts': undefined,
57
60
  'fetchBalance': true,
@@ -82,6 +85,7 @@ class binance extends binance$1 {
82
85
  'fetchIsolatedBorrowRate': false,
83
86
  'fetchIsolatedBorrowRates': false,
84
87
  'fetchL3OrderBook': false,
88
+ 'fetchLastPrices': true,
85
89
  'fetchLedger': true,
86
90
  'fetchLeverage': false,
87
91
  'fetchLeverageTiers': true,
@@ -3157,6 +3161,110 @@ class binance extends binance$1 {
3157
3161
  }
3158
3162
  return this.parseTickers(response, symbols);
3159
3163
  }
3164
+ async fetchLastPrices(symbols = undefined, params = {}) {
3165
+ /**
3166
+ * @method
3167
+ * @name binance#fetchLastPrices
3168
+ * @description fetches the last price for multiple markets
3169
+ * @see https://binance-docs.github.io/apidocs/spot/en/#symbol-price-ticker // spot
3170
+ * @see https://binance-docs.github.io/apidocs/future/en/#symbol-price-ticker // swap
3171
+ * @see https://binance-docs.github.io/apidocs/delivery/en/#symbol-price-ticker // future
3172
+ * @param {string[]|undefined} symbols unified symbols of the markets to fetch the last prices
3173
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
3174
+ * @returns {object} a dictionary of lastprices structures
3175
+ */
3176
+ await this.loadMarkets();
3177
+ symbols = this.marketSymbols(symbols);
3178
+ const market = this.getMarketFromSymbols(symbols);
3179
+ let type = undefined;
3180
+ let subType = undefined;
3181
+ [subType, params] = this.handleSubTypeAndParams('fetchLastPrices', market, params);
3182
+ [type, params] = this.handleMarketTypeAndParams('fetchLastPrices', market, params);
3183
+ let response = undefined;
3184
+ if (this.isLinear(type, subType)) {
3185
+ response = await this.fapiPublicV2GetTickerPrice(params);
3186
+ //
3187
+ // [
3188
+ // {
3189
+ // "symbol": "LTCBTC",
3190
+ // "price": "4.00000200"
3191
+ // "time": 1589437530011
3192
+ // },
3193
+ // ...
3194
+ // ]
3195
+ //
3196
+ }
3197
+ else if (this.isInverse(type, subType)) {
3198
+ response = await this.dapiPublicGetTickerPrice(params);
3199
+ //
3200
+ // [
3201
+ // {
3202
+ // "symbol": "BTCUSD_200626",
3203
+ // "ps": "9647.8",
3204
+ // "price": "9647.8",
3205
+ // "time": 1591257246176
3206
+ // }
3207
+ // ]
3208
+ //
3209
+ }
3210
+ else if (type === 'spot') {
3211
+ response = await this.publicGetTickerPrice(params);
3212
+ //
3213
+ // [
3214
+ // {
3215
+ // "symbol": "LTCBTC",
3216
+ // "price": "4.00000200"
3217
+ // },
3218
+ // ...
3219
+ // ]
3220
+ //
3221
+ }
3222
+ else {
3223
+ throw new errors.NotSupported(this.id + ' fetchLastPrices() does not support ' + type + ' markets yet');
3224
+ }
3225
+ return this.parseLastPrices(response, symbols);
3226
+ }
3227
+ parseLastPrice(entry, market = undefined) {
3228
+ //
3229
+ // spot
3230
+ //
3231
+ // {
3232
+ // "symbol": "LTCBTC",
3233
+ // "price": "4.00000200"
3234
+ // }
3235
+ //
3236
+ // usdm (swap/future)
3237
+ //
3238
+ // {
3239
+ // "symbol": "BTCUSDT",
3240
+ // "price": "6000.01",
3241
+ // "time": 1589437530011 // Transaction time
3242
+ // }
3243
+ //
3244
+ //
3245
+ // coinm (swap/future)
3246
+ //
3247
+ // {
3248
+ // "symbol": "BTCUSD_200626", // symbol ("BTCUSD_200626", "BTCUSD_PERP", etc..)
3249
+ // "ps": "BTCUSD", // pair
3250
+ // "price": "9647.8",
3251
+ // "time": 1591257246176
3252
+ // }
3253
+ //
3254
+ const timestamp = this.safeInteger(entry, 'time');
3255
+ const type = (timestamp === undefined) ? 'spot' : 'swap';
3256
+ const marketId = this.safeString(entry, 'symbol');
3257
+ market = this.safeMarket(marketId, market, undefined, type);
3258
+ const price = this.safeNumber(entry, 'price');
3259
+ return {
3260
+ 'symbol': market['symbol'],
3261
+ 'timestamp': timestamp,
3262
+ 'datetime': this.iso8601(timestamp),
3263
+ 'price': price,
3264
+ 'side': undefined,
3265
+ 'info': entry,
3266
+ };
3267
+ }
3160
3268
  async fetchTickers(symbols = undefined, params = {}) {
3161
3269
  /**
3162
3270
  * @method
@@ -6105,12 +6213,13 @@ class binance extends binance$1 {
6105
6213
  * @name binance#transfer
6106
6214
  * @description transfer currency internally between wallets on the same account
6107
6215
  * @see https://binance-docs.github.io/apidocs/spot/en/#user-universal-transfer-user_data
6108
- * @see https://binance-docs.github.io/apidocs/spot/en/#isolated-margin-account-transfer-margin
6109
6216
  * @param {string} code unified currency code
6110
6217
  * @param {float} amount amount to transfer
6111
6218
  * @param {string} fromAccount account to transfer from
6112
6219
  * @param {string} toAccount account to transfer to
6113
6220
  * @param {object} [params] extra parameters specific to the exchange API endpoint
6221
+ * @param {string} [params.type] exchange specific transfer type
6222
+ * @param {string} [params.symbol] the unified symbol, required for isolated margin transfers
6114
6223
  * @returns {object} a [transfer structure]{@link https://docs.ccxt.com/#/?id=transfer-structure}
6115
6224
  */
6116
6225
  await this.loadMarkets();
@@ -6121,76 +6230,82 @@ class binance extends binance$1 {
6121
6230
  };
6122
6231
  request['type'] = this.safeString(params, 'type');
6123
6232
  params = this.omit(params, 'type');
6124
- let response = undefined;
6125
6233
  if (request['type'] === undefined) {
6126
6234
  const symbol = this.safeString(params, 'symbol');
6235
+ let market = undefined;
6127
6236
  if (symbol !== undefined) {
6237
+ market = this.market(symbol);
6128
6238
  params = this.omit(params, 'symbol');
6129
6239
  }
6130
6240
  let fromId = this.convertTypeToAccount(fromAccount).toUpperCase();
6131
6241
  let toId = this.convertTypeToAccount(toAccount).toUpperCase();
6242
+ let isolatedSymbol = undefined;
6243
+ if (market !== undefined) {
6244
+ isolatedSymbol = market['id'];
6245
+ }
6132
6246
  if (fromId === 'ISOLATED') {
6133
6247
  if (symbol === undefined) {
6134
6248
  throw new errors.ArgumentsRequired(this.id + ' transfer () requires params["symbol"] when fromAccount is ' + fromAccount);
6135
6249
  }
6136
- else {
6137
- fromId = this.marketId(symbol);
6138
- }
6139
6250
  }
6140
6251
  if (toId === 'ISOLATED') {
6141
6252
  if (symbol === undefined) {
6142
6253
  throw new errors.ArgumentsRequired(this.id + ' transfer () requires params["symbol"] when toAccount is ' + toAccount);
6143
6254
  }
6144
- else {
6145
- toId = this.marketId(symbol);
6146
- }
6147
6255
  }
6148
6256
  const accountsById = this.safeValue(this.options, 'accountsById', {});
6149
6257
  const fromIsolated = !(fromId in accountsById);
6150
6258
  const toIsolated = !(toId in accountsById);
6259
+ if (fromIsolated && (market === undefined)) {
6260
+ isolatedSymbol = fromId; // allow user provide symbol as the from/to account
6261
+ }
6262
+ if (toIsolated && (market === undefined)) {
6263
+ isolatedSymbol = toId;
6264
+ }
6151
6265
  if (fromIsolated || toIsolated) { // Isolated margin transfer
6152
6266
  const fromFuture = fromId === 'UMFUTURE' || fromId === 'CMFUTURE';
6153
6267
  const toFuture = toId === 'UMFUTURE' || toId === 'CMFUTURE';
6154
6268
  const fromSpot = fromId === 'MAIN';
6155
6269
  const toSpot = toId === 'MAIN';
6156
6270
  const funding = fromId === 'FUNDING' || toId === 'FUNDING';
6157
- const mining = fromId === 'MINING' || toId === 'MINING';
6158
6271
  const option = fromId === 'OPTION' || toId === 'OPTION';
6159
- const prohibitedWithIsolated = fromFuture || toFuture || mining || funding || option;
6272
+ const prohibitedWithIsolated = fromFuture || toFuture || funding || option;
6160
6273
  if ((fromIsolated || toIsolated) && prohibitedWithIsolated) {
6161
6274
  throw new errors.BadRequest(this.id + ' transfer () does not allow transfers between ' + fromAccount + ' and ' + toAccount);
6162
6275
  }
6163
6276
  else if (toSpot && fromIsolated) {
6164
- request['transFrom'] = 'ISOLATED_MARGIN';
6165
- request['transTo'] = 'SPOT';
6166
- request['symbol'] = fromId;
6167
- response = await this.sapiPostMarginIsolatedTransfer(this.extend(request, params));
6277
+ fromId = 'ISOLATED_MARGIN';
6278
+ request['fromSymbol'] = isolatedSymbol;
6168
6279
  }
6169
6280
  else if (fromSpot && toIsolated) {
6170
- request['transFrom'] = 'SPOT';
6171
- request['transTo'] = 'ISOLATED_MARGIN';
6172
- request['symbol'] = toId;
6173
- response = await this.sapiPostMarginIsolatedTransfer(this.extend(request, params));
6281
+ toId = 'ISOLATED_MARGIN';
6282
+ request['toSymbol'] = isolatedSymbol;
6174
6283
  }
6175
6284
  else {
6176
- if (fromIsolated) {
6285
+ if (fromIsolated && toIsolated) {
6177
6286
  request['fromSymbol'] = fromId;
6178
- fromId = 'ISOLATEDMARGIN';
6179
- }
6180
- if (toIsolated) {
6181
6287
  request['toSymbol'] = toId;
6288
+ fromId = 'ISOLATEDMARGIN';
6182
6289
  toId = 'ISOLATEDMARGIN';
6183
6290
  }
6184
- request['type'] = fromId + '_' + toId;
6291
+ else {
6292
+ if (fromIsolated) {
6293
+ request['fromSymbol'] = isolatedSymbol;
6294
+ fromId = 'ISOLATEDMARGIN';
6295
+ }
6296
+ if (toIsolated) {
6297
+ request['toSymbol'] = isolatedSymbol;
6298
+ toId = 'ISOLATEDMARGIN';
6299
+ }
6300
+ }
6185
6301
  }
6302
+ request['type'] = fromId + '_' + toId;
6186
6303
  }
6187
6304
  else {
6188
6305
  request['type'] = fromId + '_' + toId;
6189
6306
  }
6190
6307
  }
6191
- if (response === undefined) {
6192
- response = await this.sapiPostAssetTransfer(this.extend(request, params));
6193
- }
6308
+ const response = await this.sapiPostAssetTransfer(this.extend(request, params));
6194
6309
  //
6195
6310
  // {
6196
6311
  // "tranId":13526853623
@@ -10,6 +10,7 @@ class binanceus extends binance {
10
10
  'id': 'binanceus',
11
11
  'name': 'Binance US',
12
12
  'countries': ['US'],
13
+ 'rateLimit': 50,
13
14
  'certified': false,
14
15
  'pro': true,
15
16
  'urls': {
@@ -77,6 +78,13 @@ class binanceus extends binance {
77
78
  'setMarginMode': false,
78
79
  'setPositionMode': false,
79
80
  },
81
+ 'api': {
82
+ 'public': {
83
+ 'get': {
84
+ 'ticker/price': { 'cost': 1, 'noSymbol': 2 },
85
+ },
86
+ },
87
+ },
80
88
  });
81
89
  }
82
90
  }
@@ -38,6 +38,10 @@ class bingx extends bingx$1 {
38
38
  'createOrders': true,
39
39
  'createTrailingAmountOrder': true,
40
40
  'createTrailingPercentOrder': true,
41
+ 'createTriggerOrder': true,
42
+ 'createTakeProfitOrder': true,
43
+ 'createStopLossOrder': true,
44
+ 'createOrderWithTakeProfitAndStopLoss': true,
41
45
  'fetchBalance': true,
42
46
  'fetchClosedOrders': true,
43
47
  'fetchCurrencies': true,
@@ -119,6 +123,7 @@ class bingx extends bingx$1 {
119
123
  'trade/query': 3,
120
124
  'trade/openOrders': 3,
121
125
  'trade/historyOrders': 3,
126
+ 'trade/myTrades': 3,
122
127
  'user/commissionRate': 3,
123
128
  'account/balance': 3,
124
129
  },
@@ -178,6 +183,7 @@ class bingx extends bingx$1 {
178
183
  'user/positions': 3,
179
184
  'user/income': 3,
180
185
  'trade/openOrders': 3,
186
+ 'trade/openOrder': 3,
181
187
  'trade/order': 3,
182
188
  'trade/marginType': 3,
183
189
  'trade/leverage': 3,
@@ -845,6 +851,22 @@ class bingx extends bingx$1 {
845
851
  // "buyerMaker": false
846
852
  // }
847
853
  //
854
+ // spot
855
+ // fetchMyTrades
856
+ // {
857
+ // "symbol": "LTC-USDT",
858
+ // "id": 36237072,
859
+ // "orderId": 1674069326895775744,
860
+ // "price": "85.891",
861
+ // "qty": "0.0582",
862
+ // "quoteQty": "4.9988562000000005",
863
+ // "commission": -0.00005820000000000001,
864
+ // "commissionAsset": "LTC",
865
+ // "time": 1687964205000,
866
+ // "isBuyer": true,
867
+ // "isMaker": false
868
+ // }
869
+ //
848
870
  // swap
849
871
  // fetchTrades
850
872
  //
@@ -907,7 +929,7 @@ class bingx extends bingx$1 {
907
929
  }
908
930
  const cost = this.safeString(trade, 'quoteQty');
909
931
  const type = (cost === undefined) ? 'spot' : 'swap';
910
- const currencyId = this.safeString2(trade, 'currency', 'N');
932
+ const currencyId = this.safeStringN(trade, ['currency', 'N', 'commissionAsset']);
911
933
  const currencyCode = this.safeCurrencyCode(currencyId);
912
934
  const m = this.safeValue(trade, 'm');
913
935
  const marketId = this.safeString(trade, 's');
@@ -923,6 +945,14 @@ class bingx extends bingx$1 {
923
945
  takeOrMaker = 'taker';
924
946
  }
925
947
  }
948
+ const isBuyer = this.safeValue(trade, 'isBuyer');
949
+ if (isBuyer !== undefined) {
950
+ side = isBuyer ? 'buy' : 'sell';
951
+ }
952
+ const isMaker = this.safeValue(trade, 'isMaker');
953
+ if (isMaker !== undefined) {
954
+ takeOrMaker = isMaker ? 'maker' : 'taker';
955
+ }
926
956
  return this.safeTrade({
927
957
  'id': this.safeStringN(trade, ['id', 't']),
928
958
  'info': trade,
@@ -3257,57 +3287,101 @@ class bingx extends bingx$1 {
3257
3287
  * @method
3258
3288
  * @name bingx#fetchMyTrades
3259
3289
  * @description fetch all trades made by the user
3290
+ * @see https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20History
3260
3291
  * @see https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Query%20historical%20transaction%20orders
3261
3292
  * @param {string} [symbol] unified market symbol
3262
3293
  * @param {int} [since] the earliest time in ms to fetch trades for
3263
3294
  * @param {int} [limit] the maximum number of trades structures to retrieve
3264
3295
  * @param {object} [params] extra parameters specific to the exchange API endpoint
3296
+ * @param {int} [params.until] timestamp in ms for the ending date filter, default is undefined
3265
3297
  * @param {string} params.trandingUnit COIN (directly represent assets such as BTC and ETH) or CONT (represents the number of contract sheets)
3266
3298
  * @returns {object[]} a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
3267
3299
  */
3268
3300
  if (symbol === undefined) {
3269
3301
  throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
3270
3302
  }
3271
- if (since === undefined) {
3272
- throw new errors.ArgumentsRequired(this.id + ' fetchMyTrades() requires a since argument');
3273
- }
3274
- const tradingUnit = this.safeStringUpper(params, 'tradingUnit', 'CONT');
3275
3303
  await this.loadMarkets();
3276
3304
  const market = this.market(symbol);
3277
- if (market['spot']) {
3278
- throw new errors.BadSymbol(this.id + ' fetchMyTrades() supports swap contracts only');
3279
- }
3305
+ const now = this.milliseconds();
3306
+ let response = undefined;
3280
3307
  const request = {
3281
3308
  'symbol': market['id'],
3282
- 'tradingUnit': tradingUnit,
3283
- 'startTs': since,
3284
- 'endTs': this.nonce(),
3285
3309
  };
3286
- const query = this.omit(params, 'tradingUnit');
3287
- const response = await this.swapV2PrivateGetTradeAllFillOrders(this.extend(request, query));
3288
- //
3289
- // {
3290
- // "code": "0",
3291
- // "msg": '',
3292
- // "data": { fill_orders: [
3293
- // {
3294
- // "volume": "0.1",
3295
- // "price": "106.75",
3296
- // "amount": "10.6750",
3297
- // "commission": "-0.0053",
3298
- // "currency": "USDT",
3299
- // "orderId": "1676213270274379776",
3300
- // "liquidatedPrice": "0.00",
3301
- // "liquidatedMarginRatio": "0.00",
3302
- // "filledTime": "2023-07-04T20:56:01.000+0800"
3303
- // }
3304
- // ]
3305
- // }
3306
- // }
3307
- //
3308
- const data = this.safeValue(response, 'data', []);
3309
- const fillOrders = this.safeValue(data, 'fill_orders', []);
3310
- return this.parseTrades(fillOrders, market, since, limit, query);
3310
+ if (since !== undefined) {
3311
+ const startTimeReq = market['spot'] ? 'startTime' : 'startTs';
3312
+ request[startTimeReq] = since;
3313
+ }
3314
+ else if (market['swap']) {
3315
+ request['startTs'] = now - 7776000000; // 90 days
3316
+ }
3317
+ const until = this.safeInteger(params, 'until');
3318
+ params = this.omit(params, 'until');
3319
+ if (until !== undefined) {
3320
+ const endTimeReq = market['spot'] ? 'endTime' : 'endTs';
3321
+ request[endTimeReq] = until;
3322
+ }
3323
+ else if (market['swap']) {
3324
+ request['endTs'] = now;
3325
+ }
3326
+ let fills = undefined;
3327
+ if (market['spot']) {
3328
+ response = await this.spotV1PrivateGetTradeMyTrades(this.extend(request, params));
3329
+ const data = this.safeValue(response, 'data', []);
3330
+ fills = this.safeValue(data, 'fills', []);
3331
+ //
3332
+ // {
3333
+ // "code": 0,
3334
+ // "msg": "",
3335
+ // "debugMsg": "",
3336
+ // "data": {
3337
+ // "fills": [
3338
+ // {
3339
+ // "symbol": "LTC-USDT",
3340
+ // "id": 36237072,
3341
+ // "orderId": 1674069326895775744,
3342
+ // "price": "85.891",
3343
+ // "qty": "0.0582",
3344
+ // "quoteQty": "4.9988562000000005",
3345
+ // "commission": -0.00005820000000000001,
3346
+ // "commissionAsset": "LTC",
3347
+ // "time": 1687964205000,
3348
+ // "isBuyer": true,
3349
+ // "isMaker": false
3350
+ // }
3351
+ // ]
3352
+ // }
3353
+ // }
3354
+ //
3355
+ }
3356
+ else {
3357
+ const tradingUnit = this.safeStringUpper(params, 'tradingUnit', 'CONT');
3358
+ params = this.omit(params, 'tradingUnit');
3359
+ request['tradingUnit'] = tradingUnit;
3360
+ response = await this.swapV2PrivateGetTradeAllFillOrders(this.extend(request, params));
3361
+ const data = this.safeValue(response, 'data', []);
3362
+ fills = this.safeValue(data, 'fill_orders', []);
3363
+ //
3364
+ // {
3365
+ // "code": "0",
3366
+ // "msg": '',
3367
+ // "data": { fill_orders: [
3368
+ // {
3369
+ // "volume": "0.1",
3370
+ // "price": "106.75",
3371
+ // "amount": "10.6750",
3372
+ // "commission": "-0.0053",
3373
+ // "currency": "USDT",
3374
+ // "orderId": "1676213270274379776",
3375
+ // "liquidatedPrice": "0.00",
3376
+ // "liquidatedMarginRatio": "0.00",
3377
+ // "filledTime": "2023-07-04T20:56:01.000+0800"
3378
+ // }
3379
+ // ]
3380
+ // }
3381
+ // }
3382
+ //
3383
+ }
3384
+ return this.parseTrades(fills, market, since, limit, params);
3311
3385
  }
3312
3386
  parseDepositWithdrawFee(fee, currency = undefined) {
3313
3387
  //
@@ -40,10 +40,14 @@ class bitget extends bitget$1 {
40
40
  'createMarketBuyOrderWithCost': true,
41
41
  'createMarketOrderWithCost': false,
42
42
  'createMarketSellOrderWithCost': false,
43
- 'createTrailingPercentOrder': true,
44
43
  'createOrder': true,
45
44
  'createOrders': true,
46
45
  'createReduceOnlyOrder': false,
46
+ 'createTrailingPercentOrder': true,
47
+ 'createTriggerOrder': true,
48
+ 'createTakeProfitOrder': true,
49
+ 'createStopLossOrder': true,
50
+ 'createOrderWithTakeProfitAndStopLoss': true,
47
51
  'editOrder': true,
48
52
  'fetchAccounts': false,
49
53
  'fetchBalance': true,
@@ -2957,7 +2961,12 @@ class bitget extends bitget$1 {
2957
2961
  'symbol': market['id'],
2958
2962
  };
2959
2963
  if (limit !== undefined) {
2960
- request['limit'] = limit;
2964
+ if (market['contract']) {
2965
+ request['limit'] = Math.min(limit, 1000);
2966
+ }
2967
+ else {
2968
+ request['limit'] = limit;
2969
+ }
2961
2970
  }
2962
2971
  const options = this.safeValue(this.options, 'fetchTrades', {});
2963
2972
  let response = undefined;
@@ -3269,11 +3278,12 @@ class bitget extends bitget$1 {
3269
3278
  const marketType = market['spot'] ? 'spot' : 'swap';
3270
3279
  const timeframes = this.options['timeframes'][marketType];
3271
3280
  const selectedTimeframe = this.safeString(timeframes, timeframe, timeframe);
3272
- let request = {
3281
+ const request = {
3273
3282
  'symbol': market['id'],
3274
3283
  'granularity': selectedTimeframe,
3275
3284
  };
3276
- [request, params] = this.handleUntilOption('endTime', request, params);
3285
+ const until = this.safeInteger2(params, 'until', 'till');
3286
+ params = this.omit(params, ['until', 'till']);
3277
3287
  if (limit !== undefined) {
3278
3288
  request['limit'] = limit;
3279
3289
  }
@@ -3286,6 +3296,9 @@ class bitget extends bitget$1 {
3286
3296
  if (since !== undefined) {
3287
3297
  request['startTime'] = since;
3288
3298
  }
3299
+ if (until !== undefined) {
3300
+ request['endTime'] = until;
3301
+ }
3289
3302
  }
3290
3303
  let response = undefined;
3291
3304
  if (market['spot']) {
@@ -3293,8 +3306,6 @@ class bitget extends bitget$1 {
3293
3306
  response = await this.publicSpotGetV2SpotMarketCandles(this.extend(request, params));
3294
3307
  }
3295
3308
  else if (method === 'publicSpotGetV2SpotMarketHistoryCandles') {
3296
- const until = this.safeInteger2(params, 'until', 'till');
3297
- params = this.omit(params, ['until', 'till']);
3298
3309
  if (since !== undefined) {
3299
3310
  if (limit === undefined) {
3300
3311
  limit = 100; // exchange default
@@ -39,12 +39,12 @@ class bitmart extends bitmart$1 {
39
39
  'createMarketBuyOrderWithCost': true,
40
40
  'createMarketOrderWithCost': false,
41
41
  'createMarketSellOrderWithCost': false,
42
- 'createTrailingPercentOrder': true,
43
42
  'createOrder': true,
44
43
  'createPostOnlyOrder': true,
45
44
  'createStopLimitOrder': false,
46
45
  'createStopMarketOrder': false,
47
46
  'createStopOrder': false,
47
+ 'createTrailingPercentOrder': true,
48
48
  'fetchBalance': true,
49
49
  'fetchBorrowInterest': true,
50
50
  'fetchBorrowRateHistories': false,
@@ -263,8 +263,8 @@ class bitmart extends bitmart$1 {
263
263
  'trading': {
264
264
  'tierBased': true,
265
265
  'percentage': true,
266
- 'taker': this.parseNumber('0.0025'),
267
- 'maker': this.parseNumber('0.0025'),
266
+ 'taker': this.parseNumber('0.0040'),
267
+ 'maker': this.parseNumber('0.0035'),
268
268
  'tiers': {
269
269
  'taker': [
270
270
  [this.parseNumber('0'), this.parseNumber('0.0020')],
@@ -39,7 +39,6 @@ class bybit extends bybit$1 {
39
39
  'closePosition': false,
40
40
  'createMarketBuyOrderWithCost': true,
41
41
  'createMarketSellOrderWithCost': false,
42
- 'createTrailingAmountOrder': true,
43
42
  'createOrder': true,
44
43
  'createOrders': true,
45
44
  'createPostOnlyOrder': true,
@@ -47,6 +46,11 @@ class bybit extends bybit$1 {
47
46
  'createStopLimitOrder': true,
48
47
  'createStopMarketOrder': true,
49
48
  'createStopOrder': true,
49
+ 'createTrailingAmountOrder': true,
50
+ 'createTriggerOrder': true,
51
+ 'createTakeProfitOrder': true,
52
+ 'createStopLossOrder': true,
53
+ 'createOrderWithTakeProfitAndStopLoss': true,
50
54
  'editOrder': true,
51
55
  'fetchBalance': true,
52
56
  'fetchBorrowInterest': false,