ccxt 4.0.110 → 4.0.111

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -214,13 +214,13 @@ console.log(version, Object.keys(exchanges));
214
214
 
215
215
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
216
216
 
217
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.110/dist/ccxt.browser.js
218
- * unpkg: https://unpkg.com/ccxt@4.0.110/dist/ccxt.browser.js
217
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.0.111/dist/ccxt.browser.js
218
+ * unpkg: https://unpkg.com/ccxt@4.0.111/dist/ccxt.browser.js
219
219
 
220
220
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
221
221
 
222
222
  ```HTML
223
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.110/dist/ccxt.browser.js"></script>
223
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.0.111/dist/ccxt.browser.js"></script>
224
224
  ```
225
225
 
226
226
  Creates a global `ccxt` object:
@@ -15742,7 +15742,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
15742
15742
  'fetchFundingRateHistory': true,
15743
15743
  'fetchFundingRates': true,
15744
15744
  'fetchIndexOHLCV': true,
15745
- 'fetchL3OrderBook': undefined,
15745
+ 'fetchL3OrderBook': false,
15746
15746
  'fetchLastPrices': true,
15747
15747
  'fetchLedger': true,
15748
15748
  'fetchLeverage': false,
@@ -15781,6 +15781,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
15781
15781
  'fetchTransfers': true,
15782
15782
  'fetchUnderlyingAssets': false,
15783
15783
  'fetchVolatilityHistory': false,
15784
+ 'fetchWithdrawAddresses': false,
15784
15785
  'fetchWithdrawal': false,
15785
15786
  'fetchWithdrawals': true,
15786
15787
  'fetchWithdrawalWhitelist': false,
@@ -45157,7 +45158,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
45157
45158
  // "type": "buy"
45158
45159
  // }
45159
45160
  //
45160
- // private fetchMyTrades spot
45161
+ // spot: fetchMyTrades
45161
45162
  //
45162
45163
  // {
45163
45164
  // "tradeId":"182342999769370687",
@@ -45176,28 +45177,42 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
45176
45177
  // "createTime":1695658457836,
45177
45178
  // }
45178
45179
  //
45179
- const id = this.safeString(trade, 'tradeId');
45180
- const timestamp = this.safeInteger2(trade, 'order_time', 'createTime');
45181
- const side = this.safeStringLower2(trade, 'side', 'type');
45182
- const takerOrMaker = this.safeString(trade, 'tradeRole');
45180
+ // swap: fetchMyTrades
45181
+ //
45182
+ // {
45183
+ // "order_id": "230930336848609",
45184
+ // "trade_id": "6212604014",
45185
+ // "symbol": "BTCUSDT",
45186
+ // "side": 3,
45187
+ // "price": "26910.4",
45188
+ // "vol": "1",
45189
+ // "exec_type": "Taker",
45190
+ // "profit": false,
45191
+ // "create_time": 1695961596692,
45192
+ // "realised_profit": "-0.0003",
45193
+ // "paid_fees": "0.01614624"
45194
+ // }
45195
+ //
45196
+ const timestamp = this.safeIntegerN(trade, ['order_time', 'createTime', 'create_time']);
45183
45197
  const isPublicTrade = ('order_time' in trade);
45184
- const price = this.safeString(trade, 'price');
45185
45198
  let amount = undefined;
45186
45199
  let cost = undefined;
45187
45200
  let type = undefined;
45201
+ let side = undefined;
45188
45202
  if (isPublicTrade) {
45189
45203
  amount = this.safeString(trade, 'count');
45190
45204
  cost = this.safeString(trade, 'amount');
45205
+ side = this.safeString(trade, 'type');
45191
45206
  }
45192
45207
  else {
45193
- amount = this.safeString(trade, 'size');
45208
+ amount = this.safeString2(trade, 'size', 'vol');
45194
45209
  cost = this.safeString(trade, 'notional');
45195
45210
  type = this.safeString(trade, 'type');
45211
+ side = this.parseOrderSide(this.safeString(trade, 'side'));
45196
45212
  }
45197
- const orderId = this.safeString(trade, 'orderId');
45198
45213
  const marketId = this.safeString(trade, 'symbol');
45199
- market = this.safeMarket(marketId, market, '_');
45200
- const feeCostString = this.safeString(trade, 'fee');
45214
+ market = this.safeMarket(marketId, market);
45215
+ const feeCostString = this.safeString2(trade, 'fee', 'paid_fees');
45201
45216
  let fee = undefined;
45202
45217
  if (feeCostString !== undefined) {
45203
45218
  const feeCurrencyId = this.safeString(trade, 'feeCoinName');
@@ -45212,17 +45227,17 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
45212
45227
  }
45213
45228
  return this.safeTrade({
45214
45229
  'info': trade,
45215
- 'id': id,
45216
- 'order': orderId,
45230
+ 'id': this.safeString2(trade, 'tradeId', 'trade_id'),
45231
+ 'order': this.safeString2(trade, 'orderId', 'order_id'),
45217
45232
  'timestamp': timestamp,
45218
45233
  'datetime': this.iso8601(timestamp),
45219
45234
  'symbol': market['symbol'],
45220
45235
  'type': type,
45221
45236
  'side': side,
45222
- 'price': price,
45237
+ 'price': this.safeString(trade, 'price'),
45223
45238
  'amount': amount,
45224
45239
  'cost': cost,
45225
- 'takerOrMaker': takerOrMaker,
45240
+ 'takerOrMaker': this.safeStringLower2(trade, 'tradeRole', 'exec_type'),
45226
45241
  'fee': fee,
45227
45242
  }, market);
45228
45243
  }
@@ -45425,6 +45440,7 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
45425
45440
  * @method
45426
45441
  * @name bitmart#fetchMyTrades
45427
45442
  * @see https://developer-pro.bitmart.com/en/spot/#account-trade-list-v4-signed
45443
+ * @see https://developer-pro.bitmart.com/en/futures/#get-order-trade-keyed
45428
45444
  * @description fetch all trades made by the user
45429
45445
  * @param {string} symbol unified market symbol
45430
45446
  * @param {int} [since] the earliest time in ms to fetch trades for
@@ -45439,32 +45455,46 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
45439
45455
  const request = {};
45440
45456
  if (symbol !== undefined) {
45441
45457
  market = this.market(symbol);
45458
+ request['symbol'] = market['id'];
45442
45459
  }
45443
45460
  let type = undefined;
45461
+ let response = undefined;
45444
45462
  [type, params] = this.handleMarketTypeAndParams('fetchMyTrades', market, params);
45445
- if (type !== 'spot') {
45446
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchMyTrades() does not support ' + type + ' orders, only spot orders are accepted');
45447
- }
45448
- let marginMode = undefined;
45449
- [marginMode, params] = this.handleMarginModeAndParams('fetchMyTrades', params);
45450
- if (marginMode === 'isolated') {
45451
- request['orderMode'] = 'iso_margin';
45452
- }
45453
- const options = this.safeValue(this.options, 'fetchMyTrades', {});
45454
- const defaultLimit = this.safeInteger(options, 'limit', 200);
45455
- if (limit === undefined) {
45456
- limit = defaultLimit;
45463
+ const until = this.safeIntegerN(params, ['until', 'endTime', 'end_time']);
45464
+ params = this.omit(params, ['until']);
45465
+ if (type === 'spot') {
45466
+ let marginMode = undefined;
45467
+ [marginMode, params] = this.handleMarginModeAndParams('fetchMyTrades', params);
45468
+ if (marginMode === 'isolated') {
45469
+ request['orderMode'] = 'iso_margin';
45470
+ }
45471
+ const options = this.safeValue(this.options, 'fetchMyTrades', {});
45472
+ const defaultLimit = this.safeInteger(options, 'limit', 200);
45473
+ if (limit === undefined) {
45474
+ limit = defaultLimit;
45475
+ }
45476
+ request['limit'] = limit;
45477
+ if (since !== undefined) {
45478
+ request['startTime'] = since;
45479
+ }
45480
+ if (until !== undefined) {
45481
+ request['endTime'] = until;
45482
+ }
45483
+ response = await this.privatePostSpotV4QueryTrades(this.extend(request, params));
45457
45484
  }
45458
- request['limit'] = limit;
45459
- if (symbol !== undefined) {
45460
- request['symbol'] = market['id'];
45485
+ else if (type === 'swap') {
45486
+ this.checkRequiredSymbol('fetchMyTrades', symbol);
45487
+ if (since !== undefined) {
45488
+ request['start_time'] = since;
45489
+ }
45490
+ if (until !== undefined) {
45491
+ request['end_time'] = until;
45492
+ }
45493
+ response = await this.privateGetContractPrivateTrades(this.extend(request, params));
45461
45494
  }
45462
- const until = this.safeInteger2(params, 'until', 'endTime');
45463
- if (until !== undefined) {
45464
- params = this.omit(params, ['endTime']);
45465
- request['endTime'] = until;
45495
+ else {
45496
+ throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' fetchMyTrades() does not support ' + type + ' orders, only spot and swap orders are accepted');
45466
45497
  }
45467
- const response = await this.privatePostSpotV4QueryTrades(this.extend(request, params));
45468
45498
  //
45469
45499
  // spot
45470
45500
  //
@@ -45493,7 +45523,30 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
45493
45523
  // "trace":"fbaee9e0e2f5442fba5b3262fc86b0ac.65.16956593456523085"
45494
45524
  // }
45495
45525
  //
45496
- const data = this.safeValue(response, 'data', {});
45526
+ // swap
45527
+ //
45528
+ // {
45529
+ // "code": 1000,
45530
+ // "message": "Ok",
45531
+ // "data": [
45532
+ // {
45533
+ // "order_id": "230930336848609",
45534
+ // "trade_id": "6212604014",
45535
+ // "symbol": "BTCUSDT",
45536
+ // "side": 3,
45537
+ // "price": "26910.4",
45538
+ // "vol": "1",
45539
+ // "exec_type": "Taker",
45540
+ // "profit": false,
45541
+ // "create_time": 1695961596692,
45542
+ // "realised_profit": "-0.0003",
45543
+ // "paid_fees": "0.01614624"
45544
+ // },
45545
+ // ],
45546
+ // "trace": "4cad855074634097ac6ba5257c47305d.62.16959616054873723"
45547
+ // }
45548
+ //
45549
+ const data = this.safeValue(response, 'data', []);
45497
45550
  return this.parseTrades(data, market, since, limit);
45498
45551
  }
45499
45552
  async fetchOrderTrades(id, symbol = undefined, since = undefined, limit = undefined, params = {}) {
@@ -45862,10 +45915,10 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
45862
45915
  }
45863
45916
  parseOrderSide(side) {
45864
45917
  const sides = {
45865
- '1': 'open long',
45866
- '2': 'close short',
45867
- '3': 'close long',
45868
- '4': 'open short',
45918
+ '1': 'buy',
45919
+ '2': 'buy',
45920
+ '3': 'sell',
45921
+ '4': 'sell',
45869
45922
  };
45870
45923
  return this.safeString(sides, side, side);
45871
45924
  }
@@ -46004,25 +46057,47 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
46004
46057
  /**
46005
46058
  * @method
46006
46059
  * @name bitmart#cancelOrder
46060
+ * @see https://developer-pro.bitmart.com/en/futures/#cancel-order-signed
46061
+ * @see https://developer-pro.bitmart.com/en/spot/#cancel-order-v3-signed
46062
+ * @see https://developer-pro.bitmart.com/en/futures/#cancel-plan-order-signed
46007
46063
  * @description cancels an open order
46008
46064
  * @param {string} id order id
46009
46065
  * @param {string} symbol unified symbol of the market the order was made in
46010
46066
  * @param {object} [params] extra parameters specific to the bitmart api endpoint
46067
+ * @param {string} [params.clientOrderId] *spot only* the client order id of the order to cancel
46068
+ * @param {boolean} [params.stop] *swap only* whether the order is a stop order
46011
46069
  * @returns {object} An [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
46012
46070
  */
46013
- if (symbol === undefined) {
46014
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' cancelOrder() requires a symbol argument');
46015
- }
46071
+ this.checkRequiredSymbol('cancelOrder', symbol);
46016
46072
  await this.loadMarkets();
46017
46073
  const market = this.market(symbol);
46018
- if (!market['spot']) {
46019
- throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' cancelOrder() does not support ' + market['type'] + ' orders, only spot orders are accepted');
46020
- }
46021
46074
  const request = {
46022
- 'order_id': id.toString(),
46023
46075
  'symbol': market['id'],
46024
46076
  };
46025
- const response = await this.privatePostSpotV3CancelOrder(this.extend(request, params));
46077
+ const clientOrderId = this.safeString2(params, 'clientOrderId', 'client_order_id');
46078
+ if (clientOrderId !== undefined) {
46079
+ request['client_order_id'] = clientOrderId;
46080
+ }
46081
+ else {
46082
+ request['order_id'] = id.toString();
46083
+ }
46084
+ params = this.omit(params, ['clientOrderId']);
46085
+ let response = undefined;
46086
+ if (market['spot']) {
46087
+ response = await this.privatePostSpotV3CancelOrder(this.extend(request, params));
46088
+ }
46089
+ else {
46090
+ const stop = this.safeValue(params, 'stop');
46091
+ params = this.omit(params, ['stop']);
46092
+ if (!stop) {
46093
+ response = await this.privatePostContractPrivateCancelOrder(this.extend(request, params));
46094
+ }
46095
+ else {
46096
+ response = await this.privatePostContractPrivateCancelPlanOrder(this.extend(request, params));
46097
+ }
46098
+ }
46099
+ // swap
46100
+ // {"code":1000,"message":"Ok","trace":"7f9c94e10f9d4513bc08a7bfc2a5559a.55.16959817848001851"}
46026
46101
  //
46027
46102
  // spot
46028
46103
  //
@@ -46044,6 +46119,9 @@ class bitmart extends _abstract_bitmart_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
46044
46119
  // "data": true
46045
46120
  // }
46046
46121
  //
46122
+ if (market['swap']) {
46123
+ return response;
46124
+ }
46047
46125
  const data = this.safeValue(response, 'data');
46048
46126
  if (data === true) {
46049
46127
  return this.parseOrder(id, market);
@@ -70785,6 +70863,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
70785
70863
  'v5/market/insurance': 2.5,
70786
70864
  'v5/market/risk-limit': 2.5,
70787
70865
  'v5/market/delivery-price': 2.5,
70866
+ 'v5/market/account-ratio': 2.5,
70788
70867
  // spot leverage token
70789
70868
  'v5/spot-lever-token/info': 2.5,
70790
70869
  'v5/spot-lever-token/reference': 2.5,
@@ -71186,6 +71265,7 @@ class bybit extends _abstract_bybit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
71186
71265
  // c2c lending
71187
71266
  'v5/lending/purchase': 2.5,
71188
71267
  'v5/lending/redeem': 2.5,
71268
+ 'v5/lending/redeem-cancel': 2.5,
71189
71269
  },
71190
71270
  'delete': {
71191
71271
  // spot
@@ -273364,7 +273444,7 @@ SOFTWARE.
273364
273444
 
273365
273445
  //-----------------------------------------------------------------------------
273366
273446
  // this is updated by vss.js when building
273367
- const version = '4.0.110';
273447
+ const version = '4.0.111';
273368
273448
  _src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange.ccxtVersion */ .e.ccxtVersion = version;
273369
273449
  //-----------------------------------------------------------------------------
273370
273450