ccxt 4.1.27 → 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/js/src/bitget.js CHANGED
@@ -43,6 +43,7 @@ export default class bitget extends Exchange {
43
43
  'editOrder': true,
44
44
  'fetchAccounts': false,
45
45
  'fetchBalance': true,
46
+ 'fetchBorrowInterest': true,
46
47
  'fetchBorrowRate': true,
47
48
  'fetchBorrowRateHistories': false,
48
49
  'fetchBorrowRateHistory': false,
@@ -6377,6 +6378,147 @@ export default class bitget extends Exchange {
6377
6378
  'info': info,
6378
6379
  };
6379
6380
  }
6381
+ async fetchBorrowInterest(code = undefined, symbol = undefined, since = undefined, limit = undefined, params = {}) {
6382
+ /**
6383
+ * @method
6384
+ * @name bitget#fetchBorrowInterest
6385
+ * @description fetch the interest owed by the user for borrowing currency for margin trading
6386
+ * @see https://bitgetlimited.github.io/apidoc/en/margin/#get-isolated-interest-records
6387
+ * @see https://bitgetlimited.github.io/apidoc/en/margin/#get-cross-interest-records
6388
+ * @param {string} [code] unified currency code
6389
+ * @param {string} [symbol] unified market symbol when fetching interest in isolated markets
6390
+ * @param {int} [since] the earliest time in ms to fetch borrow interest for
6391
+ * @param {int} [limit] the maximum number of structures to retrieve
6392
+ * @param {object} [params] extra parameters specific to the bitget api endpoint
6393
+ * @returns {object[]} a list of [borrow interest structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-interest-structure}
6394
+ */
6395
+ await this.loadMarkets();
6396
+ let market = undefined;
6397
+ if (symbol !== undefined) {
6398
+ market = this.market(symbol);
6399
+ }
6400
+ const request = {};
6401
+ let currency = undefined;
6402
+ if (code !== undefined) {
6403
+ currency = this.currency(code);
6404
+ request['coin'] = currency['id'];
6405
+ }
6406
+ if (since !== undefined) {
6407
+ request['startTime'] = since;
6408
+ }
6409
+ else {
6410
+ request['startTime'] = this.milliseconds() - 7776000000;
6411
+ }
6412
+ if (limit !== undefined) {
6413
+ request['pageSize'] = limit;
6414
+ }
6415
+ let response = undefined;
6416
+ let marginMode = undefined;
6417
+ [marginMode, params] = this.handleMarginModeAndParams('fetchBorrowInterest', params, 'cross');
6418
+ if (marginMode === 'isolated') {
6419
+ this.checkRequiredSymbol('fetchBorrowInterest', symbol);
6420
+ request['symbol'] = market['info']['symbolName'];
6421
+ response = await this.privateMarginGetIsolatedInterestList(this.extend(request, params));
6422
+ }
6423
+ else if (marginMode === 'cross') {
6424
+ response = await this.privateMarginGetCrossInterestList(this.extend(request, params));
6425
+ }
6426
+ //
6427
+ // isolated
6428
+ //
6429
+ // {
6430
+ // "code": "00000",
6431
+ // "msg": "success",
6432
+ // "requestTime": 1698282523888,
6433
+ // "data": {
6434
+ // "resultList": [
6435
+ // {
6436
+ // "interestId": "1100560904468705284",
6437
+ // "interestCoin": "USDT",
6438
+ // "interestRate": "0.000126279",
6439
+ // "loanCoin": "USDT",
6440
+ // "amount": "0.00000298",
6441
+ // "type": "scheduled",
6442
+ // "symbol": "BTCUSDT",
6443
+ // "ctime": "1698120000000"
6444
+ // },
6445
+ // ],
6446
+ // "maxId": "1100560904468705284",
6447
+ // "minId": "1096915487398965249"
6448
+ // }
6449
+ // }
6450
+ //
6451
+ // cross
6452
+ //
6453
+ // {
6454
+ // "code": "00000",
6455
+ // "msg": "success",
6456
+ // "requestTime": 1698282552126,
6457
+ // "data": {
6458
+ // "resultList": [
6459
+ // {
6460
+ // "interestId": "1099126154352799744",
6461
+ // "interestCoin": "USDT",
6462
+ // "interestRate": "0.000126279",
6463
+ // "loanCoin": "USDT",
6464
+ // "amount": "0.00002631",
6465
+ // "type": "scheduled",
6466
+ // "ctime": "1697778000000"
6467
+ // },
6468
+ // ],
6469
+ // "maxId": "1099126154352799744",
6470
+ // "minId": "1096917004629716993"
6471
+ // }
6472
+ // }
6473
+ //
6474
+ const data = this.safeValue(response, 'data', {});
6475
+ const rows = this.safeValue(data, 'resultList', []);
6476
+ const interest = this.parseBorrowInterests(rows, market);
6477
+ return this.filterByCurrencySinceLimit(interest, code, since, limit);
6478
+ }
6479
+ parseBorrowInterest(info, market = undefined) {
6480
+ //
6481
+ // isolated
6482
+ //
6483
+ // {
6484
+ // "interestId": "1100560904468705284",
6485
+ // "interestCoin": "USDT",
6486
+ // "interestRate": "0.000126279",
6487
+ // "loanCoin": "USDT",
6488
+ // "amount": "0.00000298",
6489
+ // "type": "scheduled",
6490
+ // "symbol": "BTCUSDT",
6491
+ // "ctime": "1698120000000"
6492
+ // }
6493
+ //
6494
+ // cross
6495
+ //
6496
+ // {
6497
+ // "interestId": "1099126154352799744",
6498
+ // "interestCoin": "USDT",
6499
+ // "interestRate": "0.000126279",
6500
+ // "loanCoin": "USDT",
6501
+ // "amount": "0.00002631",
6502
+ // "type": "scheduled",
6503
+ // "ctime": "1697778000000"
6504
+ // }
6505
+ //
6506
+ const marketId = this.safeString(info, 'symbol');
6507
+ market = this.safeMarket(marketId, market);
6508
+ const marginMode = (marketId !== undefined) ? 'isolated' : 'cross';
6509
+ const timestamp = this.safeInteger(info, 'ctime');
6510
+ return {
6511
+ 'symbol': this.safeString(market, 'symbol'),
6512
+ 'marginMode': marginMode,
6513
+ 'currency': this.safeCurrencyCode(this.safeString(info, 'interestCoin')),
6514
+ 'interest': this.safeNumber(info, 'amount'),
6515
+ 'interestRate': this.safeNumber(info, 'interestRate'),
6516
+ 'amountBorrowed': undefined,
6517
+ 'timestamp': timestamp,
6518
+ 'datetime': this.iso8601(timestamp),
6519
+ 'info': info,
6520
+ };
6521
+ }
6380
6522
  handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
6381
6523
  if (!response) {
6382
6524
  return undefined; // fallback to default error handler
package/js/src/bybit.js CHANGED
@@ -619,6 +619,7 @@ export default class bybit extends Exchange {
619
619
  'v5/position/trading-stop': 5,
620
620
  'v5/position/set-auto-add-margin': 2.5,
621
621
  'v5/position/add-margin': 2.5,
622
+ 'v5/position/confirm-pending-mmr': 2.5,
622
623
  // account
623
624
  'v5/account/upgrade-to-uta': 2.5,
624
625
  'v5/account/set-margin-mode': 2.5,
@@ -3192,8 +3193,11 @@ export default class bybit extends Exchange {
3192
3193
  // "time": 1672125441042
3193
3194
  // }
3194
3195
  //
3196
+ const timestamp = this.safeInteger(response, 'time');
3195
3197
  const result = {
3196
3198
  'info': response,
3199
+ 'timestamp': timestamp,
3200
+ 'datetime': this.iso8601(timestamp),
3197
3201
  };
3198
3202
  const responseResult = this.safeValue(response, 'result', {});
3199
3203
  const currencyList = this.safeValueN(responseResult, ['loanAccountList', 'list', 'balance']);
@@ -22,6 +22,7 @@ export default class cryptocom extends Exchange {
22
22
  createAdvancedOrderRequest(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): any;
23
23
  cancelAllOrders(symbol?: string, params?: {}): Promise<any>;
24
24
  cancelOrder(id: string, symbol?: string, params?: {}): Promise<Order>;
25
+ cancelOrders(ids: any, symbol?: string, params?: {}): Promise<Order[]>;
25
26
  fetchOpenOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
26
27
  fetchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
27
28
  parseAddress(addressString: any): any[];
@@ -35,6 +35,7 @@ export default class cryptocom extends Exchange {
35
35
  'borrowMargin': true,
36
36
  'cancelAllOrders': true,
37
37
  'cancelOrder': true,
38
+ 'cancelOrders': true,
38
39
  'createOrder': true,
39
40
  'createOrders': true,
40
41
  'fetchAccounts': true,
@@ -1429,6 +1430,37 @@ export default class cryptocom extends Exchange {
1429
1430
  const result = this.safeValue(response, 'result', {});
1430
1431
  return this.parseOrder(result, market);
1431
1432
  }
1433
+ async cancelOrders(ids, symbol = undefined, params = {}) {
1434
+ /**
1435
+ * @method
1436
+ * @name cryptocom#cancelOrders
1437
+ * @description cancel multiple orders
1438
+ * @see https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order-list-list
1439
+ * @param {string[]} ids order ids
1440
+ * @param {string} symbol unified market symbol
1441
+ * @param {object} [params] extra parameters specific to the okx api endpoint
1442
+ * @returns {object} an list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
1443
+ */
1444
+ this.checkRequiredSymbol('cancelOrders', symbol);
1445
+ await this.loadMarkets();
1446
+ const market = this.market(symbol);
1447
+ const orderRequests = [];
1448
+ for (let i = 0; i < ids.length; i++) {
1449
+ const id = ids[i];
1450
+ const order = {
1451
+ 'instrument_name': market['id'],
1452
+ 'order_id': id.toString(),
1453
+ };
1454
+ orderRequests.push(order);
1455
+ }
1456
+ const request = {
1457
+ 'contingency_type': 'LIST',
1458
+ 'order_list': orderRequests,
1459
+ };
1460
+ const response = await this.v1PrivatePostPrivateCancelOrderList(this.extend(request, params));
1461
+ const result = this.safeValue(response, 'result', []);
1462
+ return this.parseOrders(result, market, undefined, undefined, params);
1463
+ }
1432
1464
  async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1433
1465
  /**
1434
1466
  * @method
@@ -64,7 +64,7 @@ export default class krakenfutures extends Exchange {
64
64
  entryPrice: number;
65
65
  notional: any;
66
66
  leverage: number;
67
- unrealizedPnl: number;
67
+ unrealizedPnl: any;
68
68
  contracts: number;
69
69
  contractSize: number;
70
70
  marginRatio: any;
@@ -411,6 +411,7 @@ export default class krakenfutures extends Exchange {
411
411
  /**
412
412
  * @method
413
413
  * @name krakenfutures#fetchOrderBook
414
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-orderbook
414
415
  * @description Fetches a list of open orders in a market
415
416
  * @param {string} symbol Unified market symbol
416
417
  * @param {int} [limit] Not used by krakenfutures
@@ -457,6 +458,15 @@ export default class krakenfutures extends Exchange {
457
458
  return this.parseOrderBook(response['orderBook'], symbol, timestamp);
458
459
  }
459
460
  async fetchTickers(symbols = undefined, params = {}) {
461
+ /**
462
+ * @method
463
+ * @name krakenfutures#fetchTickers
464
+ * @description fetches price tickers for multiple markets, statistical calculations with the information calculated over the past 24 hours each market
465
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-tickers
466
+ * @param {string[]} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
467
+ * @param {object} [params] extra parameters specific to the krakenfutures api endpoint
468
+ * @returns {object} an array of [ticker structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#ticker-structure}
469
+ */
460
470
  await this.loadMarkets();
461
471
  const response = await this.publicGetTickers(params);
462
472
  //
@@ -656,6 +666,7 @@ export default class krakenfutures extends Exchange {
656
666
  /**
657
667
  * @method
658
668
  * @name krakenfutures#fetchTrades
669
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-trade-history
659
670
  * @descriptions Fetch a history of filled trades that this account has made
660
671
  * @param {string} symbol Unified CCXT market symbol
661
672
  * @param {int} [since] Timestamp in ms of earliest trade. Not used by krakenfutures except in combination with params.until
@@ -977,6 +988,7 @@ export default class krakenfutures extends Exchange {
977
988
  /**
978
989
  * @method
979
990
  * @name krakenfutures#editOrder
991
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-edit-order
980
992
  * @description Edit an open order on the exchange
981
993
  * @param {string} id order id
982
994
  * @param {string} symbol Not used by Krakenfutures
@@ -1006,6 +1018,10 @@ export default class krakenfutures extends Exchange {
1006
1018
  }
1007
1019
  async cancelOrder(id, symbol = undefined, params = {}) {
1008
1020
  /**
1021
+ * @method
1022
+ * @name krakenfutures#cancelOrder
1023
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-cancel-order
1024
+ * @description Cancel an open order on the exchange
1009
1025
  * @param {string} id Order id
1010
1026
  * @param {string} symbol Not used by Krakenfutures
1011
1027
  * @param {object} [params] Exchange specific params
@@ -1089,6 +1105,7 @@ export default class krakenfutures extends Exchange {
1089
1105
  /**
1090
1106
  * @method
1091
1107
  * @name krakenfutures#cancelAllOrders
1108
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-cancel-all-orders
1092
1109
  * @description Cancels all orders on the exchange, including trigger orders
1093
1110
  * @param {str} symbol Unified market symbol
1094
1111
  * @param {dict} [params] Exchange specific params
@@ -1105,6 +1122,7 @@ export default class krakenfutures extends Exchange {
1105
1122
  /**
1106
1123
  * @method
1107
1124
  * @name krakenfutures#fetchOpenOrders
1125
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-get-open-orders
1108
1126
  * @description Gets all open orders, including trigger orders, for an account from the exchange api
1109
1127
  * @param {string} symbol Unified market symbol
1110
1128
  * @param {int} [since] Timestamp (ms) of earliest order. (Not used by kraken api but filtered internally by CCXT)
@@ -1512,6 +1530,18 @@ export default class krakenfutures extends Exchange {
1512
1530
  });
1513
1531
  }
1514
1532
  async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1533
+ /**
1534
+ * @method
1535
+ * @name krakenfutures#fetchMyTrades
1536
+ * @description fetch all trades made by the user
1537
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-historical-data-get-your-fills
1538
+ * @param {string} symbol unified market symbol
1539
+ * @param {int} [since] *not used by the api* the earliest time in ms to fetch trades for
1540
+ * @param {int} [limit] the maximum number of trades structures to retrieve
1541
+ * @param {object} [params] extra parameters specific to the bybit api endpoint
1542
+ * @param {int} [params.until] the latest time in ms to fetch entries for
1543
+ * @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
1544
+ */
1515
1545
  await this.loadMarkets();
1516
1546
  let market = undefined;
1517
1547
  if (symbol !== undefined) {
@@ -1544,9 +1574,10 @@ export default class krakenfutures extends Exchange {
1544
1574
  /**
1545
1575
  * @method
1546
1576
  * @name krakenfutures#fetchBalance
1577
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-account-information-get-wallets
1547
1578
  * @description Fetch the balance for a sub-account, all sub-account balances are inside 'info' in the response
1548
1579
  * @param {object} [params] Exchange specific parameters
1549
- * @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' *
1580
+ * @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' *
1550
1581
  * @param {string} [params.symbol] A unified market symbol, when assigned the balance for a trading market that matches the symbol is returned
1551
1582
  * @returns A [balance structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#balance-structure}
1552
1583
  */
@@ -1650,7 +1681,7 @@ export default class krakenfutures extends Exchange {
1650
1681
  type = symbol;
1651
1682
  }
1652
1683
  if (type === undefined) {
1653
- type = (symbol === undefined) ? 'cash' : symbol;
1684
+ type = (symbol === undefined) ? 'flex' : symbol;
1654
1685
  }
1655
1686
  const accountName = this.parseAccount(type);
1656
1687
  const accounts = this.safeValue(response, 'accounts');
@@ -1848,6 +1879,17 @@ export default class krakenfutures extends Exchange {
1848
1879
  };
1849
1880
  }
1850
1881
  async fetchFundingRateHistory(symbol = undefined, since = undefined, limit = undefined, params = {}) {
1882
+ /**
1883
+ * @method
1884
+ * @name krakenfutures#fetchFundingRateHistory
1885
+ * @description fetches historical funding rate prices
1886
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-historical-funding-rates-historical-funding-rates
1887
+ * @param {string} symbol unified symbol of the market to fetch the funding rate history for
1888
+ * @param {int} [since] timestamp in ms of the earliest funding rate to fetch
1889
+ * @param {int} [limit] the maximum amount of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure} to fetch
1890
+ * @param {object} [params] extra parameters specific to the api endpoint
1891
+ * @returns {object[]} a list of [funding rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#funding-rate-history-structure}
1892
+ */
1851
1893
  this.checkRequiredSymbol('fetchFundingRateHistory', symbol);
1852
1894
  await this.loadMarkets();
1853
1895
  const market = this.market(symbol);
@@ -1890,6 +1932,7 @@ export default class krakenfutures extends Exchange {
1890
1932
  /**
1891
1933
  * @method
1892
1934
  * @name krakenfutures#fetchPositions
1935
+ * @see https://docs.futures.kraken.com/#websocket-api-private-feeds-open-positions
1893
1936
  * @description Fetches current contract trading positions
1894
1937
  * @param {string[]} symbols List of unified symbols
1895
1938
  * @param {object} [params] Not used by krakenfutures
@@ -1969,7 +2012,7 @@ export default class krakenfutures extends Exchange {
1969
2012
  'entryPrice': this.safeNumber(position, 'price'),
1970
2013
  'notional': undefined,
1971
2014
  'leverage': leverage,
1972
- 'unrealizedPnl': this.safeNumber(position, 'unrealizedFunding'),
2015
+ 'unrealizedPnl': undefined,
1973
2016
  'contracts': this.safeNumber(position, 'size'),
1974
2017
  'contractSize': this.safeNumber(market, 'contractSize'),
1975
2018
  'marginRatio': undefined,
@@ -1982,6 +2025,15 @@ export default class krakenfutures extends Exchange {
1982
2025
  };
1983
2026
  }
1984
2027
  async fetchLeverageTiers(symbols = undefined, params = {}) {
2028
+ /**
2029
+ * @method
2030
+ * @name krakenfutures#fetchLeverageTiers
2031
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-instrument-details-get-instruments
2032
+ * @description retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
2033
+ * @param {string[]|undefined} symbols list of unified market symbols
2034
+ * @param {object} [params] extra parameters specific to the krakenfutures api endpoint
2035
+ * @returns {object} a dictionary of [leverage tiers structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#leverage-tiers-structure}, indexed by market symbols
2036
+ */
1985
2037
  await this.loadMarkets();
1986
2038
  const response = await this.publicGetInstruments(params);
1987
2039
  //
@@ -2161,6 +2213,8 @@ export default class krakenfutures extends Exchange {
2161
2213
  /**
2162
2214
  * @method
2163
2215
  * @name krakenfutures#transfer
2216
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-transfers-initiate-wallet-transfer
2217
+ * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-transfers-initiate-withdrawal-to-spot-wallet
2164
2218
  * @description transfers currencies between sub-accounts
2165
2219
  * @param {string} code Unified currency code
2166
2220
  * @param {float} amount Size of the transfer
package/js/src/mexc.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/mexc.js';
2
- import { IndexType, Int, OrderSide, Balances, OrderType, OHLCV, FundingRateHistory, Position, OrderBook } from './base/types.js';
2
+ import { IndexType, Int, OrderSide, Balances, OrderType, OHLCV, FundingRateHistory, Position, OrderBook, OrderRequest } from './base/types.js';
3
3
  /**
4
4
  * @class mexc
5
5
  * @extends Exchange
@@ -31,8 +31,10 @@ export default class mexc extends Exchange {
31
31
  parseTicker(ticker: any, market?: any): import("./base/types.js").Ticker;
32
32
  fetchBidsAsks(symbols?: string[], params?: {}): Promise<import("./base/types.js").Dictionary<import("./base/types.js").Ticker>>;
33
33
  createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<import("./base/types.js").Order>;
34
+ createSpotOrderRequest(market: any, type: any, side: any, amount: any, price?: any, marginMode?: any, params?: {}): any;
34
35
  createSpotOrder(market: any, type: any, side: any, amount: any, price?: any, marginMode?: any, params?: {}): Promise<import("./base/types.js").Order>;
35
36
  createSwapOrder(market: any, type: any, side: any, amount: any, price?: any, marginMode?: any, params?: {}): Promise<import("./base/types.js").Order>;
37
+ createOrders(orders: OrderRequest[], params?: {}): Promise<import("./base/types.js").Order[]>;
36
38
  fetchOrder(id: string, symbol?: string, params?: {}): Promise<import("./base/types.js").Order>;
37
39
  fetchOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
38
40
  fetchOrdersByIds(ids: any, symbol?: string, params?: {}): Promise<import("./base/types.js").Order[]>;
package/js/src/mexc.js CHANGED
@@ -39,6 +39,7 @@ export default class mexc extends Exchange {
39
39
  'cancelOrders': undefined,
40
40
  'createDepositAddress': true,
41
41
  'createOrder': true,
42
+ 'createOrders': true,
42
43
  'createReduceOnlyOrder': true,
43
44
  'deposit': undefined,
44
45
  'editOrder': undefined,
@@ -2083,7 +2084,7 @@ export default class mexc extends Exchange {
2083
2084
  return await this.createSwapOrder(market, type, side, amount, price, marginMode, query);
2084
2085
  }
2085
2086
  }
2086
- async createSpotOrder(market, type, side, amount, price = undefined, marginMode = undefined, params = {}) {
2087
+ createSpotOrderRequest(market, type, side, amount, price = undefined, marginMode = undefined, params = {}) {
2087
2088
  const symbol = market['symbol'];
2088
2089
  const orderSide = (side === 'buy') ? 'BUY' : 'SELL';
2089
2090
  const request = {
@@ -2120,19 +2121,28 @@ export default class mexc extends Exchange {
2120
2121
  request['newClientOrderId'] = clientOrderId;
2121
2122
  params = this.omit(params, ['type', 'clientOrderId']);
2122
2123
  }
2123
- let method = 'spotPrivatePostOrder';
2124
2124
  if (marginMode !== undefined) {
2125
2125
  if (marginMode !== 'isolated') {
2126
2126
  throw new BadRequest(this.id + ' createOrder() does not support marginMode ' + marginMode + ' for spot-margin trading');
2127
2127
  }
2128
- method = 'spotPrivatePostMarginOrder';
2129
2128
  }
2130
2129
  let postOnly = undefined;
2131
2130
  [postOnly, params] = this.handlePostOnly(type === 'market', type === 'LIMIT_MAKER', params);
2132
2131
  if (postOnly) {
2133
2132
  request['type'] = 'LIMIT_MAKER';
2134
2133
  }
2135
- const response = await this[method](this.extend(request, params));
2134
+ return this.extend(request, params);
2135
+ }
2136
+ async createSpotOrder(market, type, side, amount, price = undefined, marginMode = undefined, params = {}) {
2137
+ await this.loadMarkets();
2138
+ const request = this.createSpotOrderRequest(market, type, side, amount, price, marginMode, params);
2139
+ let response = undefined;
2140
+ if (marginMode !== undefined) {
2141
+ response = await this.spotPrivatePostMarginOrder(this.extend(request, params));
2142
+ }
2143
+ else {
2144
+ response = await this.spotPrivatePostOrder(this.extend(request, params));
2145
+ }
2136
2146
  //
2137
2147
  // spot
2138
2148
  //
@@ -2265,6 +2275,70 @@ export default class mexc extends Exchange {
2265
2275
  const data = this.safeString(response, 'data');
2266
2276
  return this.parseOrder(data, market);
2267
2277
  }
2278
+ async createOrders(orders, params = {}) {
2279
+ /**
2280
+ * @method
2281
+ * @name mexc#createOrders
2282
+ * @description *spot only* *all orders must have the same symbol* create a list of trade orders
2283
+ * @see https://mexcdevelop.github.io/apidocs/spot_v3_en/#batch-orders
2284
+ * @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
2285
+ * @param {object} [params] extra parameters specific to api endpoint
2286
+ * @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
2287
+ */
2288
+ await this.loadMarkets();
2289
+ const ordersRequests = [];
2290
+ let symbol = undefined;
2291
+ for (let i = 0; i < orders.length; i++) {
2292
+ const rawOrder = orders[i];
2293
+ const marketId = this.safeString(rawOrder, 'symbol');
2294
+ const market = this.market(marketId);
2295
+ if (!market['spot']) {
2296
+ throw new NotSupported(this.id + ' createOrders() is only supported for spot markets');
2297
+ }
2298
+ if (symbol === undefined) {
2299
+ symbol = marketId;
2300
+ }
2301
+ else {
2302
+ if (symbol !== marketId) {
2303
+ throw new BadRequest(this.id + ' createOrders() requires all orders to have the same symbol');
2304
+ }
2305
+ }
2306
+ const type = this.safeString(rawOrder, 'type');
2307
+ const side = this.safeString(rawOrder, 'side');
2308
+ const amount = this.safeValue(rawOrder, 'amount');
2309
+ const price = this.safeValue(rawOrder, 'price');
2310
+ const orderParams = this.safeValue(rawOrder, 'params', {});
2311
+ let marginMode = undefined;
2312
+ [marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
2313
+ const orderRequest = this.createSpotOrderRequest(market, type, side, amount, price, marginMode, orderParams);
2314
+ ordersRequests.push(orderRequest);
2315
+ }
2316
+ const request = {
2317
+ 'batchOrders': ordersRequests,
2318
+ };
2319
+ const response = await this.spotPrivatePostBatchOrders(request);
2320
+ //
2321
+ // [
2322
+ // {
2323
+ // "symbol": "BTCUSDT",
2324
+ // "orderId": "1196315350023612316",
2325
+ // "newClientOrderId": "hio8279hbdsds",
2326
+ // "orderListId": -1
2327
+ // },
2328
+ // {
2329
+ // "newClientOrderId": "123456",
2330
+ // "msg": "The minimum transaction volume cannot be less than:0.5USDT",
2331
+ // "code": 30002
2332
+ // },
2333
+ // {
2334
+ // "symbol": "BTCUSDT",
2335
+ // "orderId": "1196315350023612318",
2336
+ // "orderListId": -1
2337
+ // }
2338
+ // ]
2339
+ //
2340
+ return this.parseOrders(response);
2341
+ }
2268
2342
  async fetchOrder(id, symbol = undefined, params = {}) {
2269
2343
  /**
2270
2344
  * @method
@@ -3125,6 +3199,23 @@ export default class mexc extends Exchange {
3125
3199
  // "updateTime": "1648984276000",
3126
3200
  // }
3127
3201
  //
3202
+ // createOrders error
3203
+ //
3204
+ // {
3205
+ // "newClientOrderId": "123456",
3206
+ // "msg": "The minimum transaction volume cannot be less than:0.5USDT",
3207
+ // "code": 30002
3208
+ // }
3209
+ //
3210
+ const code = this.safeInteger(order, 'code');
3211
+ if (code !== undefined) {
3212
+ // error upon placing multiple orders
3213
+ return this.safeOrder({
3214
+ 'info': order,
3215
+ 'status': 'rejected',
3216
+ 'clientOrderId': this.safeString(order, 'newClientOrderId'),
3217
+ });
3218
+ }
3128
3219
  let id = undefined;
3129
3220
  if (typeof order === 'string') {
3130
3221
  id = order;
package/js/src/okx.js CHANGED
@@ -375,6 +375,7 @@ export default class okx extends Exchange {
375
375
  'sprd/order': 1,
376
376
  'sprd/cancel-order': 1,
377
377
  'sprd/mass-cancel': 1,
378
+ 'sprd/amend-order': 1,
378
379
  // trade
379
380
  'trade/order': 1 / 3,
380
381
  'trade/batch-orders': 1 / 15,
package/js/src/woo.js CHANGED
@@ -126,7 +126,10 @@ export default class woo extends Exchange {
126
126
  'fees': [
127
127
  'https://support.woo.org/hc/en-001/articles/4404611795353--Trading-Fees',
128
128
  ],
129
- 'referral': 'https://referral.woo.org/BAJS6oNmZb3vi3RGA',
129
+ 'referral': {
130
+ 'url': 'https://x.woo.org/register?ref=YWOWC96B',
131
+ 'discount': 0.35,
132
+ },
130
133
  },
131
134
  'api': {
132
135
  'v1': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.1.27",
3
+ "version": "4.1.29",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 130+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",