ccxt 4.1.28 → 4.1.29

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/dist/cjs/ccxt.js CHANGED
@@ -180,7 +180,7 @@ var woo$1 = require('./src/pro/woo.js');
180
180
 
181
181
  //-----------------------------------------------------------------------------
182
182
  // this is updated by vss.js when building
183
- const version = '4.1.28';
183
+ const version = '4.1.29';
184
184
  Exchange["default"].ccxtVersion = version;
185
185
  const exchanges = {
186
186
  'ace': ace,
@@ -40,6 +40,7 @@ class bitget extends bitget$1 {
40
40
  'editOrder': true,
41
41
  'fetchAccounts': false,
42
42
  'fetchBalance': true,
43
+ 'fetchBorrowInterest': true,
43
44
  'fetchBorrowRate': true,
44
45
  'fetchBorrowRateHistories': false,
45
46
  'fetchBorrowRateHistory': false,
@@ -6374,6 +6375,147 @@ class bitget extends bitget$1 {
6374
6375
  'info': info,
6375
6376
  };
6376
6377
  }
6378
+ async fetchBorrowInterest(code = undefined, symbol = undefined, since = undefined, limit = undefined, params = {}) {
6379
+ /**
6380
+ * @method
6381
+ * @name bitget#fetchBorrowInterest
6382
+ * @description fetch the interest owed by the user for borrowing currency for margin trading
6383
+ * @see https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-interest-records
6384
+ * @see https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-interest-records
6385
+ * @param {string} [code] unified currency code
6386
+ * @param {string} [symbol] unified market symbol when fetching interest in isolated markets
6387
+ * @param {int} [since] the earliest time in ms to fetch borrow interest for
6388
+ * @param {int} [limit] the maximum number of structures to retrieve
6389
+ * @param {object} [params] extra parameters specific to the bitget api endpoint
6390
+ * @returns {object[]} a list of [borrow interest structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-interest-structure}
6391
+ */
6392
+ await this.loadMarkets();
6393
+ let market = undefined;
6394
+ if (symbol !== undefined) {
6395
+ market = this.market(symbol);
6396
+ }
6397
+ const request = {};
6398
+ let currency = undefined;
6399
+ if (code !== undefined) {
6400
+ currency = this.currency(code);
6401
+ request['coin'] = currency['id'];
6402
+ }
6403
+ if (since !== undefined) {
6404
+ request['startTime'] = since;
6405
+ }
6406
+ else {
6407
+ request['startTime'] = this.milliseconds() - 7776000000;
6408
+ }
6409
+ if (limit !== undefined) {
6410
+ request['pageSize'] = limit;
6411
+ }
6412
+ let response = undefined;
6413
+ let marginMode = undefined;
6414
+ [marginMode, params] = this.handleMarginModeAndParams('fetchBorrowInterest', params, 'cross');
6415
+ if (marginMode === 'isolated') {
6416
+ this.checkRequiredSymbol('fetchBorrowInterest', symbol);
6417
+ request['symbol'] = market['info']['symbolName'];
6418
+ response = await this.privateMarginGetIsolatedInterestList(this.extend(request, params));
6419
+ }
6420
+ else if (marginMode === 'cross') {
6421
+ response = await this.privateMarginGetCrossInterestList(this.extend(request, params));
6422
+ }
6423
+ //
6424
+ // isolated
6425
+ //
6426
+ // {
6427
+ // "code": "00000",
6428
+ // "msg": "success",
6429
+ // "requestTime": 1698282523888,
6430
+ // "data": {
6431
+ // "resultList": [
6432
+ // {
6433
+ // "interestId": "1100560904468705284",
6434
+ // "interestCoin": "USDT",
6435
+ // "interestRate": "0.000126279",
6436
+ // "loanCoin": "USDT",
6437
+ // "amount": "0.00000298",
6438
+ // "type": "scheduled",
6439
+ // "symbol": "BTCUSDT",
6440
+ // "ctime": "1698120000000"
6441
+ // },
6442
+ // ],
6443
+ // "maxId": "1100560904468705284",
6444
+ // "minId": "1096915487398965249"
6445
+ // }
6446
+ // }
6447
+ //
6448
+ // cross
6449
+ //
6450
+ // {
6451
+ // "code": "00000",
6452
+ // "msg": "success",
6453
+ // "requestTime": 1698282552126,
6454
+ // "data": {
6455
+ // "resultList": [
6456
+ // {
6457
+ // "interestId": "1099126154352799744",
6458
+ // "interestCoin": "USDT",
6459
+ // "interestRate": "0.000126279",
6460
+ // "loanCoin": "USDT",
6461
+ // "amount": "0.00002631",
6462
+ // "type": "scheduled",
6463
+ // "ctime": "1697778000000"
6464
+ // },
6465
+ // ],
6466
+ // "maxId": "1099126154352799744",
6467
+ // "minId": "1096917004629716993"
6468
+ // }
6469
+ // }
6470
+ //
6471
+ const data = this.safeValue(response, 'data', {});
6472
+ const rows = this.safeValue(data, 'resultList', []);
6473
+ const interest = this.parseBorrowInterests(rows, market);
6474
+ return this.filterByCurrencySinceLimit(interest, code, since, limit);
6475
+ }
6476
+ parseBorrowInterest(info, market = undefined) {
6477
+ //
6478
+ // isolated
6479
+ //
6480
+ // {
6481
+ // "interestId": "1100560904468705284",
6482
+ // "interestCoin": "USDT",
6483
+ // "interestRate": "0.000126279",
6484
+ // "loanCoin": "USDT",
6485
+ // "amount": "0.00000298",
6486
+ // "type": "scheduled",
6487
+ // "symbol": "BTCUSDT",
6488
+ // "ctime": "1698120000000"
6489
+ // }
6490
+ //
6491
+ // cross
6492
+ //
6493
+ // {
6494
+ // "interestId": "1099126154352799744",
6495
+ // "interestCoin": "USDT",
6496
+ // "interestRate": "0.000126279",
6497
+ // "loanCoin": "USDT",
6498
+ // "amount": "0.00002631",
6499
+ // "type": "scheduled",
6500
+ // "ctime": "1697778000000"
6501
+ // }
6502
+ //
6503
+ const marketId = this.safeString(info, 'symbol');
6504
+ market = this.safeMarket(marketId, market);
6505
+ const marginMode = (marketId !== undefined) ? 'isolated' : 'cross';
6506
+ const timestamp = this.safeInteger(info, 'ctime');
6507
+ return {
6508
+ 'symbol': this.safeString(market, 'symbol'),
6509
+ 'marginMode': marginMode,
6510
+ 'currency': this.safeCurrencyCode(this.safeString(info, 'interestCoin')),
6511
+ 'interest': this.safeNumber(info, 'amount'),
6512
+ 'interestRate': this.safeNumber(info, 'interestRate'),
6513
+ 'amountBorrowed': undefined,
6514
+ 'timestamp': timestamp,
6515
+ 'datetime': this.iso8601(timestamp),
6516
+ 'info': info,
6517
+ };
6518
+ }
6377
6519
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
6378
6520
  if (!response) {
6379
6521
  return undefined; // fallback to default error handler
@@ -616,6 +616,7 @@ class bybit extends bybit$1 {
616
616
  'v5/position/trading-stop': 5,
617
617
  'v5/position/set-auto-add-margin': 2.5,
618
618
  'v5/position/add-margin': 2.5,
619
+ 'v5/position/confirm-pending-mmr': 2.5,
619
620
  // account
620
621
  'v5/account/upgrade-to-uta': 2.5,
621
622
  'v5/account/set-margin-mode': 2.5,
@@ -3189,8 +3190,11 @@ class bybit extends bybit$1 {
3189
3190
  // "time": 1672125441042
3190
3191
  // }
3191
3192
  //
3193
+ const timestamp = this.safeInteger(response, 'time');
3192
3194
  const result = {
3193
3195
  'info': response,
3196
+ 'timestamp': timestamp,
3197
+ 'datetime': this.iso8601(timestamp),
3194
3198
  };
3195
3199
  const responseResult = this.safeValue(response, 'result', {});
3196
3200
  const currencyList = this.safeValueN(responseResult, ['loanAccountList', 'list', 'balance']);
@@ -32,6 +32,7 @@ class cryptocom extends cryptocom$1 {
32
32
  'borrowMargin': true,
33
33
  'cancelAllOrders': true,
34
34
  'cancelOrder': true,
35
+ 'cancelOrders': true,
35
36
  'createOrder': true,
36
37
  'createOrders': true,
37
38
  'fetchAccounts': true,
@@ -1426,6 +1427,37 @@ class cryptocom extends cryptocom$1 {
1426
1427
  const result = this.safeValue(response, 'result', {});
1427
1428
  return this.parseOrder(result, market);
1428
1429
  }
1430
+ async cancelOrders(ids, symbol = undefined, params = {}) {
1431
+ /**
1432
+ * @method
1433
+ * @name cryptocom#cancelOrders
1434
+ * @description cancel multiple orders
1435
+ * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order-list-list
1436
+ * @param {string[]} ids order ids
1437
+ * @param {string} symbol unified market symbol
1438
+ * @param {object} [params] extra parameters specific to the okx api endpoint
1439
+ * @returns {object} an list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1440
+ */
1441
+ this.checkRequiredSymbol('cancelOrders', symbol);
1442
+ await this.loadMarkets();
1443
+ const market = this.market(symbol);
1444
+ const orderRequests = [];
1445
+ for (let i = 0; i < ids.length; i++) {
1446
+ const id = ids[i];
1447
+ const order = {
1448
+ 'instrument_name': market['id'],
1449
+ 'order_id': id.toString(),
1450
+ };
1451
+ orderRequests.push(order);
1452
+ }
1453
+ const request = {
1454
+ 'contingency_type': 'LIST',
1455
+ 'order_list': orderRequests,
1456
+ };
1457
+ const response = await this.v1PrivatePostPrivateCancelOrderList(this.extend(request, params));
1458
+ const result = this.safeValue(response, 'result', []);
1459
+ return this.parseOrders(result, market, undefined, undefined, params);
1460
+ }
1429
1461
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1430
1462
  /**
1431
1463
  * @method
@@ -408,6 +408,7 @@ class krakenfutures extends krakenfutures$1 {
408
408
  /**
409
409
  * @method
410
410
  * @name krakenfutures#fetchOrderBook
411
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-orderbook
411
412
  * @description Fetches a list of open orders in a market
412
413
  * @param {string} symbol Unified market symbol
413
414
  * @param {int} [limit] Not used by krakenfutures
@@ -454,6 +455,15 @@ class krakenfutures extends krakenfutures$1 {
454
455
  return this.parseOrderBook(response['orderBook'], symbol, timestamp);
455
456
  }
456
457
  async fetchTickers(symbols = undefined, params = {}) {
458
+ /**
459
+ * @method
460
+ * @name krakenfutures#fetchTickers
461
+ * @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
462
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-tickers
463
+ * @param {string[]} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
464
+ * @param {object} [params] extra parameters specific to the krakenfutures api endpoint
465
+ * @returns {object} an array of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
466
+ */
457
467
  await this.loadMarkets();
458
468
  const response = await this.publicGetTickers(params);
459
469
  //
@@ -653,6 +663,7 @@ class krakenfutures extends krakenfutures$1 {
653
663
  /**
654
664
  * @method
655
665
  * @name krakenfutures#fetchTrades
666
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-trade-history
656
667
  * @descriptions Fetch a history of filled trades that this account has made
657
668
  * @param {string} symbol Unified CCXT market symbol
658
669
  * @param {int} [since] Timestamp in ms of earliest trade. Not used by krakenfutures except in combination with params.until
@@ -974,6 +985,7 @@ class krakenfutures extends krakenfutures$1 {
974
985
  /**
975
986
  * @method
976
987
  * @name krakenfutures#editOrder
988
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-edit-order
977
989
  * @description Edit an open order on the exchange
978
990
  * @param {string} id order id
979
991
  * @param {string} symbol Not used by Krakenfutures
@@ -1003,6 +1015,10 @@ class krakenfutures extends krakenfutures$1 {
1003
1015
  }
1004
1016
  async cancelOrder(id, symbol = undefined, params = {}) {
1005
1017
  /**
1018
+ * @method
1019
+ * @name krakenfutures#cancelOrder
1020
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-cancel-order
1021
+ * @description Cancel an open order on the exchange
1006
1022
  * @param {string} id Order id
1007
1023
  * @param {string} symbol Not used by Krakenfutures
1008
1024
  * @param {object} [params] Exchange specific params
@@ -1086,6 +1102,7 @@ class krakenfutures extends krakenfutures$1 {
1086
1102
  /**
1087
1103
  * @method
1088
1104
  * @name krakenfutures#cancelAllOrders
1105
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-cancel-all-orders
1089
1106
  * @description Cancels all orders on the exchange, including trigger orders
1090
1107
  * @param {str} symbol Unified market symbol
1091
1108
  * @param {dict} [params] Exchange specific params
@@ -1102,6 +1119,7 @@ class krakenfutures extends krakenfutures$1 {
1102
1119
  /**
1103
1120
  * @method
1104
1121
  * @name krakenfutures#fetchOpenOrders
1122
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-get-open-orders
1105
1123
  * @description Gets all open orders, including trigger orders, for an account from the exchange api
1106
1124
  * @param {string} symbol Unified market symbol
1107
1125
  * @param {int} [since] Timestamp (ms) of earliest order. (Not used by kraken api but filtered internally by CCXT)
@@ -1509,6 +1527,18 @@ class krakenfutures extends krakenfutures$1 {
1509
1527
  });
1510
1528
  }
1511
1529
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1530
+ /**
1531
+ * @method
1532
+ * @name krakenfutures#fetchMyTrades
1533
+ * @description fetch all trades made by the user
1534
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-historical-data-get-your-fills
1535
+ * @param {string} symbol unified market symbol
1536
+ * @param {int} [since] *not used by the api* the earliest time in ms to fetch trades for
1537
+ * @param {int} [limit] the maximum number of trades structures to retrieve
1538
+ * @param {object} [params] extra parameters specific to the bybit api endpoint
1539
+ * @param {int} [params.until] the latest time in ms to fetch entries for
1540
+ * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
1541
+ */
1512
1542
  await this.loadMarkets();
1513
1543
  let market = undefined;
1514
1544
  if (symbol !== undefined) {
@@ -1541,9 +1571,10 @@ class krakenfutures extends krakenfutures$1 {
1541
1571
  /**
1542
1572
  * @method
1543
1573
  * @name krakenfutures#fetchBalance
1574
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-account-information-get-wallets
1544
1575
  * @description Fetch the balance for a sub-account, all sub-account balances are inside 'info' in the response
1545
1576
  * @param {object} [params] Exchange specific parameters
1546
- * @param {string} [params.type] The sub-account type to query the balance of, possible values include 'flex', 'cash'/'main'/'funding', or a market symbol * defaults to 'cash' *
1577
+ * @param {string} [params.type] The sub-account type to query the balance of, possible values include 'flex', 'cash'/'main'/'funding', or a market symbol * defaults to 'flex' *
1547
1578
  * @param {string} [params.symbol] A unified market symbol, when assigned the balance for a trading market that matches the symbol is returned
1548
1579
  * @returns A [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
1549
1580
  */
@@ -1647,7 +1678,7 @@ class krakenfutures extends krakenfutures$1 {
1647
1678
  type = symbol;
1648
1679
  }
1649
1680
  if (type === undefined) {
1650
- type = (symbol === undefined) ? 'cash' : symbol;
1681
+ type = (symbol === undefined) ? 'flex' : symbol;
1651
1682
  }
1652
1683
  const accountName = this.parseAccount(type);
1653
1684
  const accounts = this.safeValue(response, 'accounts');
@@ -1845,6 +1876,17 @@ class krakenfutures extends krakenfutures$1 {
1845
1876
  };
1846
1877
  }
1847
1878
  async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1879
+ /**
1880
+ * @method
1881
+ * @name krakenfutures#fetchFundingRateHistory
1882
+ * @description fetches historical funding rate prices
1883
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-historical-funding-rates-historical-funding-rates
1884
+ * @param {string} symbol unified symbol of the market to fetch the funding rate history for
1885
+ * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
1886
+ * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
1887
+ * @param {object} [params] extra parameters specific to the api endpoint
1888
+ * @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
1889
+ */
1848
1890
  this.checkRequiredSymbol('fetchFundingRateHistory', symbol);
1849
1891
  await this.loadMarkets();
1850
1892
  const market = this.market(symbol);
@@ -1887,6 +1929,7 @@ class krakenfutures extends krakenfutures$1 {
1887
1929
  /**
1888
1930
  * @method
1889
1931
  * @name krakenfutures#fetchPositions
1932
+ * @see https://docs.futures.kraken.com/#websocket-api-private-feeds-open-positions
1890
1933
  * @description Fetches current contract trading positions
1891
1934
  * @param {string[]} symbols List of unified symbols
1892
1935
  * @param {object} [params] Not used by krakenfutures
@@ -1966,7 +2009,7 @@ class krakenfutures extends krakenfutures$1 {
1966
2009
  'entryPrice': this.safeNumber(position, 'price'),
1967
2010
  'notional': undefined,
1968
2011
  'leverage': leverage,
1969
- 'unrealizedPnl': this.safeNumber(position, 'unrealizedFunding'),
2012
+ 'unrealizedPnl': undefined,
1970
2013
  'contracts': this.safeNumber(position, 'size'),
1971
2014
  'contractSize': this.safeNumber(market, 'contractSize'),
1972
2015
  'marginRatio': undefined,
@@ -1979,6 +2022,15 @@ class krakenfutures extends krakenfutures$1 {
1979
2022
  };
1980
2023
  }
1981
2024
  async fetchLeverageTiers(symbols = undefined, params = {}) {
2025
+ /**
2026
+ * @method
2027
+ * @name krakenfutures#fetchLeverageTiers
2028
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-instrument-details-get-instruments
2029
+ * @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
2030
+ * @param {string[]|undefined} symbols list of unified market symbols
2031
+ * @param {object} [params] extra parameters specific to the krakenfutures api endpoint
2032
+ * @returns {object} a dictionary of [leverage tiers structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure}, indexed by market symbols
2033
+ */
1982
2034
  await this.loadMarkets();
1983
2035
  const response = await this.publicGetInstruments(params);
1984
2036
  //
@@ -2158,6 +2210,8 @@ class krakenfutures extends krakenfutures$1 {
2158
2210
  /**
2159
2211
  * @method
2160
2212
  * @name krakenfutures#transfer
2213
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-transfers-initiate-wallet-transfer
2214
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-transfers-initiate-withdrawal-to-spot-wallet
2161
2215
  * @description transfers currencies between sub-accounts
2162
2216
  * @param {string} code Unified currency code
2163
2217
  * @param {float} amount Size of the transfer
@@ -36,6 +36,7 @@ class mexc extends mexc$1 {
36
36
  'cancelOrders': undefined,
37
37
  'createDepositAddress': true,
38
38
  'createOrder': true,
39
+ 'createOrders': true,
39
40
  'createReduceOnlyOrder': true,
40
41
  'deposit': undefined,
41
42
  'editOrder': undefined,
@@ -2080,7 +2081,7 @@ class mexc extends mexc$1 {
2080
2081
  return await this.createSwapOrder(market, type, side, amount, price, marginMode, query);
2081
2082
  }
2082
2083
  }
2083
- async createSpotOrder(market, type, side, amount, price = undefined, marginMode = undefined, params = {}) {
2084
+ createSpotOrderRequest(market, type, side, amount, price = undefined, marginMode = undefined, params = {}) {
2084
2085
  const symbol = market['symbol'];
2085
2086
  const orderSide = (side === 'buy') ? 'BUY' : 'SELL';
2086
2087
  const request = {
@@ -2117,19 +2118,28 @@ class mexc extends mexc$1 {
2117
2118
  request['newClientOrderId'] = clientOrderId;
2118
2119
  params = this.omit(params, ['type', 'clientOrderId']);
2119
2120
  }
2120
- let method = 'spotPrivatePostOrder';
2121
2121
  if (marginMode !== undefined) {
2122
2122
  if (marginMode !== 'isolated') {
2123
2123
  throw new errors.BadRequest(this.id + ' createOrder() does not support marginMode ' + marginMode + ' for spot-margin trading');
2124
2124
  }
2125
- method = 'spotPrivatePostMarginOrder';
2126
2125
  }
2127
2126
  let postOnly = undefined;
2128
2127
  [postOnly, params] = this.handlePostOnly(type === 'market', type === 'LIMIT_MAKER', params);
2129
2128
  if (postOnly) {
2130
2129
  request['type'] = 'LIMIT_MAKER';
2131
2130
  }
2132
- const response = await this[method](this.extend(request, params));
2131
+ return this.extend(request, params);
2132
+ }
2133
+ async createSpotOrder(market, type, side, amount, price = undefined, marginMode = undefined, params = {}) {
2134
+ await this.loadMarkets();
2135
+ const request = this.createSpotOrderRequest(market, type, side, amount, price, marginMode, params);
2136
+ let response = undefined;
2137
+ if (marginMode !== undefined) {
2138
+ response = await this.spotPrivatePostMarginOrder(this.extend(request, params));
2139
+ }
2140
+ else {
2141
+ response = await this.spotPrivatePostOrder(this.extend(request, params));
2142
+ }
2133
2143
  //
2134
2144
  // spot
2135
2145
  //
@@ -2262,6 +2272,70 @@ class mexc extends mexc$1 {
2262
2272
  const data = this.safeString(response, 'data');
2263
2273
  return this.parseOrder(data, market);
2264
2274
  }
2275
+ async createOrders(orders, params = {}) {
2276
+ /**
2277
+ * @method
2278
+ * @name mexc#createOrders
2279
+ * @description *spot only* *all orders must have the same symbol* create a list of trade orders
2280
+ * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#batch-orders
2281
+ * @param {array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
2282
+ * @param {object} [params] extra parameters specific to api endpoint
2283
+ * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
2284
+ */
2285
+ await this.loadMarkets();
2286
+ const ordersRequests = [];
2287
+ let symbol = undefined;
2288
+ for (let i = 0; i < orders.length; i++) {
2289
+ const rawOrder = orders[i];
2290
+ const marketId = this.safeString(rawOrder, 'symbol');
2291
+ const market = this.market(marketId);
2292
+ if (!market['spot']) {
2293
+ throw new errors.NotSupported(this.id + ' createOrders() is only supported for spot markets');
2294
+ }
2295
+ if (symbol === undefined) {
2296
+ symbol = marketId;
2297
+ }
2298
+ else {
2299
+ if (symbol !== marketId) {
2300
+ throw new errors.BadRequest(this.id + ' createOrders() requires all orders to have the same symbol');
2301
+ }
2302
+ }
2303
+ const type = this.safeString(rawOrder, 'type');
2304
+ const side = this.safeString(rawOrder, 'side');
2305
+ const amount = this.safeValue(rawOrder, 'amount');
2306
+ const price = this.safeValue(rawOrder, 'price');
2307
+ const orderParams = this.safeValue(rawOrder, 'params', {});
2308
+ let marginMode = undefined;
2309
+ [marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
2310
+ const orderRequest = this.createSpotOrderRequest(market, type, side, amount, price, marginMode, orderParams);
2311
+ ordersRequests.push(orderRequest);
2312
+ }
2313
+ const request = {
2314
+ 'batchOrders': ordersRequests,
2315
+ };
2316
+ const response = await this.spotPrivatePostBatchOrders(request);
2317
+ //
2318
+ // [
2319
+ // {
2320
+ // "symbol": "BTCUSDT",
2321
+ // "orderId": "1196315350023612316",
2322
+ // "newClientOrderId": "hio8279hbdsds",
2323
+ // "orderListId": -1
2324
+ // },
2325
+ // {
2326
+ // "newClientOrderId": "123456",
2327
+ // "msg": "The minimum transaction volume cannot be less than:0.5USDT",
2328
+ // "code": 30002
2329
+ // },
2330
+ // {
2331
+ // "symbol": "BTCUSDT",
2332
+ // "orderId": "1196315350023612318",
2333
+ // "orderListId": -1
2334
+ // }
2335
+ // ]
2336
+ //
2337
+ return this.parseOrders(response);
2338
+ }
2265
2339
  async fetchOrder(id, symbol = undefined, params = {}) {
2266
2340
  /**
2267
2341
  * @method
@@ -3121,6 +3195,23 @@ class mexc extends mexc$1 {
3121
3195
  // "updateTime": "1648984276000",
3122
3196
  // }
3123
3197
  //
3198
+ // createOrders error
3199
+ //
3200
+ // {
3201
+ // "newClientOrderId": "123456",
3202
+ // "msg": "The minimum transaction volume cannot be less than:0.5USDT",
3203
+ // "code": 30002
3204
+ // }
3205
+ //
3206
+ const code = this.safeInteger(order, 'code');
3207
+ if (code !== undefined) {
3208
+ // error upon placing multiple orders
3209
+ return this.safeOrder({
3210
+ 'info': order,
3211
+ 'status': 'rejected',
3212
+ 'clientOrderId': this.safeString(order, 'newClientOrderId'),
3213
+ });
3214
+ }
3124
3215
  let id = undefined;
3125
3216
  if (typeof order === 'string') {
3126
3217
  id = order;
@@ -372,6 +372,7 @@ class okx extends okx$1 {
372
372
  'sprd/order': 1,
373
373
  'sprd/cancel-order': 1,
374
374
  'sprd/mass-cancel': 1,
375
+ 'sprd/amend-order': 1,
375
376
  // trade
376
377
  'trade/order': 1 / 3,
377
378
  'trade/batch-orders': 1 / 15,
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
7
- declare const version = "4.1.27";
7
+ declare const version = "4.1.28";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.1.28';
41
+ const version = '4.1.29';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -426,6 +426,7 @@ interface Exchange {
426
426
  privatePostV5PositionTradingStop(params?: {}): Promise<implicitReturnType>;
427
427
  privatePostV5PositionSetAutoAddMargin(params?: {}): Promise<implicitReturnType>;
428
428
  privatePostV5PositionAddMargin(params?: {}): Promise<implicitReturnType>;
429
+ privatePostV5PositionConfirmPendingMmr(params?: {}): Promise<implicitReturnType>;
429
430
  privatePostV5AccountUpgradeToUta(params?: {}): Promise<implicitReturnType>;
430
431
  privatePostV5AccountSetMarginMode(params?: {}): Promise<implicitReturnType>;
431
432
  privatePostV5AccountMmpModify(params?: {}): Promise<implicitReturnType>;
@@ -189,6 +189,7 @@ interface okx {
189
189
  privatePostSprdOrder(params?: {}): Promise<implicitReturnType>;
190
190
  privatePostSprdCancelOrder(params?: {}): Promise<implicitReturnType>;
191
191
  privatePostSprdMassCancel(params?: {}): Promise<implicitReturnType>;
192
+ privatePostSprdAmendOrder(params?: {}): Promise<implicitReturnType>;
192
193
  privatePostTradeOrder(params?: {}): Promise<implicitReturnType>;
193
194
  privatePostTradeBatchOrders(params?: {}): Promise<implicitReturnType>;
194
195
  privatePostTradeCancelOrder(params?: {}): Promise<implicitReturnType>;
@@ -189,6 +189,7 @@ interface okex {
189
189
  privatePostSprdOrder(params?: {}): Promise<implicitReturnType>;
190
190
  privatePostSprdCancelOrder(params?: {}): Promise<implicitReturnType>;
191
191
  privatePostSprdMassCancel(params?: {}): Promise<implicitReturnType>;
192
+ privatePostSprdAmendOrder(params?: {}): Promise<implicitReturnType>;
192
193
  privatePostTradeOrder(params?: {}): Promise<implicitReturnType>;
193
194
  privatePostTradeBatchOrders(params?: {}): Promise<implicitReturnType>;
194
195
  privatePostTradeCancelOrder(params?: {}): Promise<implicitReturnType>;
@@ -189,6 +189,7 @@ interface Exchange {
189
189
  privatePostSprdOrder(params?: {}): Promise<implicitReturnType>;
190
190
  privatePostSprdCancelOrder(params?: {}): Promise<implicitReturnType>;
191
191
  privatePostSprdMassCancel(params?: {}): Promise<implicitReturnType>;
192
+ privatePostSprdAmendOrder(params?: {}): Promise<implicitReturnType>;
192
193
  privatePostTradeOrder(params?: {}): Promise<implicitReturnType>;
193
194
  privatePostTradeBatchOrders(params?: {}): Promise<implicitReturnType>;
194
195
  privatePostTradeCancelOrder(params?: {}): Promise<implicitReturnType>;
@@ -344,6 +344,18 @@ export default class bitget extends Exchange {
344
344
  datetime: string;
345
345
  info: any;
346
346
  };
347
+ fetchBorrowInterest(code?: string, symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
348
+ parseBorrowInterest(info: any, market?: any): {
349
+ symbol: string;
350
+ marginMode: string;
351
+ currency: any;
352
+ interest: number;
353
+ interestRate: number;
354
+ amountBorrowed: any;
355
+ timestamp: number;
356
+ datetime: string;
357
+ info: any;
358
+ };
347
359
  handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
348
360
  sign(path: any, api?: any[], method?: string, params?: {}, headers?: any, body?: any): {
349
361
  url: string;