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