ccxt 4.3.28 → 4.3.30

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 (46) hide show
  1. package/README.md +3 -3
  2. package/dist/ccxt.browser.min.js +30 -0
  3. package/dist/ccxt.browser.min.js.LICENSE.txt +12 -0
  4. package/dist/cjs/ccxt.js +1 -1
  5. package/dist/cjs/src/base/Exchange.js +6 -0
  6. package/dist/cjs/src/base/ws/OrderBookSide.js +4 -4
  7. package/dist/cjs/src/bingx.js +98 -84
  8. package/dist/cjs/src/bitmart.js +72 -0
  9. package/dist/cjs/src/coinex.js +260 -311
  10. package/dist/cjs/src/kucoin.js +1 -0
  11. package/dist/cjs/src/pro/bitfinex.js +4 -4
  12. package/dist/cjs/src/pro/bitfinex2.js +2 -2
  13. package/dist/cjs/src/pro/bitmex.js +3 -3
  14. package/dist/cjs/src/pro/blockchaincom.js +2 -2
  15. package/dist/cjs/src/pro/cryptocom.js +4 -4
  16. package/dist/cjs/src/pro/deribit.js +9 -9
  17. package/dist/cjs/src/pro/idex.js +1 -1
  18. package/dist/cjs/src/pro/luno.js +4 -5
  19. package/dist/cjs/src/pro/mexc.js +2 -2
  20. package/dist/cjs/src/whitebit.js +55 -5
  21. package/js/ccxt.d.ts +1 -1
  22. package/js/ccxt.js +1 -1
  23. package/js/src/abstract/bingx.d.ts +7 -0
  24. package/js/src/abstract/bitmart.d.ts +1 -0
  25. package/js/src/base/Exchange.js +6 -0
  26. package/js/src/base/ws/Cache.d.ts +1 -1
  27. package/js/src/base/ws/OrderBookSide.d.ts +4 -5
  28. package/js/src/base/ws/OrderBookSide.js +4 -4
  29. package/js/src/bingx.js +98 -84
  30. package/js/src/bitmart.d.ts +2 -1
  31. package/js/src/bitmart.js +72 -0
  32. package/js/src/coinex.d.ts +5 -6
  33. package/js/src/coinex.js +260 -311
  34. package/js/src/kucoin.js +1 -0
  35. package/js/src/pro/bitfinex.js +4 -4
  36. package/js/src/pro/bitfinex2.js +2 -2
  37. package/js/src/pro/bitmex.js +3 -3
  38. package/js/src/pro/blockchaincom.js +2 -2
  39. package/js/src/pro/cryptocom.js +4 -4
  40. package/js/src/pro/deribit.js +9 -9
  41. package/js/src/pro/idex.js +1 -1
  42. package/js/src/pro/luno.js +4 -5
  43. package/js/src/pro/mexc.js +2 -2
  44. package/js/src/whitebit.d.ts +2 -0
  45. package/js/src/whitebit.js +55 -5
  46. package/package.json +4 -2
@@ -427,6 +427,7 @@ class kucoin extends kucoin$1 {
427
427
  'The withdrawal amount is below the minimum requirement.': errors.ExchangeError,
428
428
  'Unsuccessful! Exceeded the max. funds out-transfer limit': errors.InsufficientFunds,
429
429
  'The amount increment is invalid.': errors.BadRequest,
430
+ 'The quantity is below the minimum requirement.': errors.InvalidOrder,
430
431
  '400': errors.BadRequest,
431
432
  '401': errors.AuthenticationError,
432
433
  '403': errors.NotSupported,
@@ -325,7 +325,7 @@ class bitfinex extends bitfinex$1 {
325
325
  const size = (delta2Value < 0) ? -delta2Value : delta2Value;
326
326
  const side = (delta2Value < 0) ? 'asks' : 'bids';
327
327
  const bookside = orderbook[side];
328
- bookside.store(price, size, id);
328
+ bookside.storeArray([price, size, id]);
329
329
  }
330
330
  }
331
331
  else {
@@ -336,7 +336,7 @@ class bitfinex extends bitfinex$1 {
336
336
  const size = (delta2 < 0) ? -delta2 : delta2;
337
337
  const side = (delta2 < 0) ? 'asks' : 'bids';
338
338
  const countedBookSide = orderbook[side];
339
- countedBookSide.store(delta[0], size, delta[1]);
339
+ countedBookSide.storeArray([delta[0], size, delta[1]]);
340
340
  }
341
341
  }
342
342
  client.resolve(orderbook, messageHash);
@@ -352,14 +352,14 @@ class bitfinex extends bitfinex$1 {
352
352
  const bookside = orderbook[side];
353
353
  // price = 0 means that you have to remove the order from your book
354
354
  const amount = Precise["default"].stringGt(price, '0') ? size : '0';
355
- bookside.store(this.parseNumber(price), this.parseNumber(amount), id);
355
+ bookside.storeArray([this.parseNumber(price), this.parseNumber(amount), id]);
356
356
  }
357
357
  else {
358
358
  const message3Value = message[3];
359
359
  const size = (message3Value < 0) ? -message3Value : message3Value;
360
360
  const side = (message3Value < 0) ? 'asks' : 'bids';
361
361
  const countedBookSide = orderbook[side];
362
- countedBookSide.store(message[1], size, message[2]);
362
+ countedBookSide.storeArray([message[1], size, message[2]]);
363
363
  }
364
364
  client.resolve(orderbook, messageHash);
365
365
  }
@@ -630,7 +630,7 @@ class bitfinex2 extends bitfinex2$1 {
630
630
  // price = 0 means that you have to remove the order from your book
631
631
  const amount = Precise["default"].stringGt(price, '0') ? size : '0';
632
632
  const idString = this.safeString(deltas, 0);
633
- bookside.store(this.parseNumber(price), this.parseNumber(amount), idString);
633
+ bookside.storeArray([this.parseNumber(price), this.parseNumber(amount), idString]);
634
634
  }
635
635
  else {
636
636
  const amount = this.safeString(deltas, 2);
@@ -639,7 +639,7 @@ class bitfinex2 extends bitfinex2$1 {
639
639
  const size = Precise["default"].stringLt(amount, '0') ? Precise["default"].stringNeg(amount) : amount;
640
640
  const side = Precise["default"].stringLt(amount, '0') ? 'asks' : 'bids';
641
641
  const bookside = orderbookItem[side];
642
- bookside.store(this.parseNumber(price), this.parseNumber(size), this.parseNumber(counter));
642
+ bookside.storeArray([this.parseNumber(price), this.parseNumber(size), this.parseNumber(counter)]);
643
643
  }
644
644
  client.resolve(orderbook, messageHash);
645
645
  }
@@ -1430,7 +1430,7 @@ class bitmex extends bitmex$1 {
1430
1430
  const data = this.safeValue(message, 'data', []);
1431
1431
  // if it's an initial snapshot
1432
1432
  if (action === 'partial') {
1433
- const filter = this.safeValue(message, 'filter', {});
1433
+ const filter = this.safeDict(message, 'filter', {});
1434
1434
  const marketId = this.safeValue(filter, 'symbol');
1435
1435
  const market = this.safeMarket(marketId);
1436
1436
  const symbol = market['symbol'];
@@ -1452,7 +1452,7 @@ class bitmex extends bitmex$1 {
1452
1452
  let side = this.safeString(data[i], 'side');
1453
1453
  side = (side === 'Buy') ? 'bids' : 'asks';
1454
1454
  const bookside = orderbook[side];
1455
- bookside.store(price, size, id);
1455
+ bookside.storeArray([price, size, id]);
1456
1456
  const datetime = this.safeString(data[i], 'timestamp');
1457
1457
  orderbook['timestamp'] = this.parse8601(datetime);
1458
1458
  orderbook['datetime'] = datetime;
@@ -1477,7 +1477,7 @@ class bitmex extends bitmex$1 {
1477
1477
  let side = this.safeString(data[i], 'side');
1478
1478
  side = (side === 'Buy') ? 'bids' : 'asks';
1479
1479
  const bookside = orderbook[side];
1480
- bookside.store(price, size, id);
1480
+ bookside.storeArray([price, size, id]);
1481
1481
  const datetime = this.safeString(data[i], 'timestamp');
1482
1482
  orderbook['timestamp'] = this.parse8601(datetime);
1483
1483
  orderbook['datetime'] = datetime;
@@ -695,8 +695,8 @@ class blockchaincom extends blockchaincom$1 {
695
695
  orderbook.reset(snapshot);
696
696
  }
697
697
  else if (event === 'updated') {
698
- const asks = this.safeValue(message, 'asks', []);
699
- const bids = this.safeValue(message, 'bids', []);
698
+ const asks = this.safeList(message, 'asks', []);
699
+ const bids = this.safeList(message, 'bids', []);
700
700
  this.handleDeltas(orderbook['asks'], asks);
701
701
  this.handleDeltas(orderbook['bids'], bids);
702
702
  orderbook['timestamp'] = timestamp;
@@ -128,7 +128,7 @@ class cryptocom extends cryptocom$1 {
128
128
  const price = this.safeFloat(delta, 0);
129
129
  const amount = this.safeFloat(delta, 1);
130
130
  const count = this.safeInteger(delta, 2);
131
- bookside.store(price, amount, count);
131
+ bookside.storeArray([price, amount, count]);
132
132
  }
133
133
  handleDeltas(bookside, deltas) {
134
134
  for (let i = 0; i < deltas.length; i++) {
@@ -197,11 +197,11 @@ class cryptocom extends cryptocom$1 {
197
197
  let data = this.safeValue(message, 'data');
198
198
  data = this.safeValue(data, 0);
199
199
  const timestamp = this.safeInteger(data, 't');
200
- let orderbook = this.safeValue(this.orderbooks, symbol);
201
- if (orderbook === undefined) {
200
+ if (!(symbol in this.orderbooks)) {
202
201
  const limit = this.safeInteger(message, 'depth');
203
- orderbook = this.countedOrderBook({}, limit);
202
+ this.orderbooks[symbol] = this.countedOrderBook({}, limit);
204
203
  }
204
+ const orderbook = this.orderbooks[symbol];
205
205
  const channel = this.safeString(message, 'channel');
206
206
  const nonce = this.safeInteger2(data, 'u', 's');
207
207
  let books = data;
@@ -505,12 +505,12 @@ class deribit extends deribit$1 {
505
505
  const marketId = this.safeString(data, 'instrument_name');
506
506
  const symbol = this.safeSymbol(marketId);
507
507
  const timestamp = this.safeInteger(data, 'timestamp');
508
- let storedOrderBook = this.safeValue(this.orderbooks, symbol);
509
- if (storedOrderBook === undefined) {
510
- storedOrderBook = this.countedOrderBook();
508
+ if (!(symbol in this.orderbooks)) {
509
+ this.orderbooks[symbol] = this.countedOrderBook();
511
510
  }
512
- const asks = this.safeValue(data, 'asks', []);
513
- const bids = this.safeValue(data, 'bids', []);
511
+ const storedOrderBook = this.orderbooks[symbol];
512
+ const asks = this.safeList(data, 'asks', []);
513
+ const bids = this.safeList(data, 'bids', []);
514
514
  this.handleDeltas(storedOrderBook['asks'], asks);
515
515
  this.handleDeltas(storedOrderBook['bids'], bids);
516
516
  storedOrderBook['nonce'] = timestamp;
@@ -522,8 +522,8 @@ class deribit extends deribit$1 {
522
522
  client.resolve(storedOrderBook, messageHash);
523
523
  }
524
524
  cleanOrderBook(data) {
525
- const bids = this.safeValue(data, 'bids', []);
526
- const asks = this.safeValue(data, 'asks', []);
525
+ const bids = this.safeList(data, 'bids', []);
526
+ const asks = this.safeList(data, 'asks', []);
527
527
  const cleanedBids = [];
528
528
  for (let i = 0; i < bids.length; i++) {
529
529
  cleanedBids.push([bids[i][1], bids[i][2]]);
@@ -540,10 +540,10 @@ class deribit extends deribit$1 {
540
540
  const price = delta[1];
541
541
  const amount = delta[2];
542
542
  if (delta[0] === 'new' || delta[0] === 'change') {
543
- bookside.store(price, amount, 1);
543
+ bookside.storeArray([price, amount, 1]);
544
544
  }
545
545
  else if (delta[0] === 'delete') {
546
- bookside.store(price, amount, 0);
546
+ bookside.storeArray([price, amount, 0]);
547
547
  }
548
548
  }
549
549
  handleDeltas(bookside, deltas) {
@@ -481,7 +481,7 @@ class idex extends idex$1 {
481
481
  const price = this.safeFloat(delta, 0);
482
482
  const amount = this.safeFloat(delta, 1);
483
483
  const count = this.safeInteger(delta, 2);
484
- bookside.store(price, amount, count);
484
+ bookside.storeArray([price, amount, count]);
485
485
  }
486
486
  handleDeltas(bookside, deltas) {
487
487
  for (let i = 0; i < deltas.length; i++) {
@@ -190,12 +190,11 @@ class luno extends luno$1 {
190
190
  //
191
191
  const symbol = subscription['symbol'];
192
192
  const messageHash = 'orderbook:' + symbol;
193
- const timestamp = this.safeString(message, 'timestamp');
194
- let orderbook = this.safeValue(this.orderbooks, symbol);
195
- if (orderbook === undefined) {
196
- orderbook = this.indexedOrderBook({});
197
- this.orderbooks[symbol] = orderbook;
193
+ const timestamp = this.safeInteger(message, 'timestamp');
194
+ if (!(symbol in this.orderbooks)) {
195
+ this.orderbooks[symbol] = this.indexedOrderBook({});
198
196
  }
197
+ const orderbook = this.orderbooks[symbol];
199
198
  const asks = this.safeValue(message, 'asks');
200
199
  if (asks !== undefined) {
201
200
  const snapshot = this.customParseOrderBook(message, symbol, timestamp, 'bids', 'asks', 'price', 'volume', 'id');
@@ -508,8 +508,8 @@ class mexc extends mexc$1 {
508
508
  return;
509
509
  }
510
510
  orderbook['nonce'] = deltaNonce;
511
- const asks = this.safeValue(delta, 'asks', []);
512
- const bids = this.safeValue(delta, 'bids', []);
511
+ const asks = this.safeList(delta, 'asks', []);
512
+ const bids = this.safeList(delta, 'bids', []);
513
513
  const asksOrderSide = orderbook['asks'];
514
514
  const bidsOrderSide = orderbook['bids'];
515
515
  this.handleBooksideDelta(asksOrderSide, asks);
@@ -32,6 +32,9 @@ class whitebit extends whitebit$1 {
32
32
  'cancelAllOrdersAfter': true,
33
33
  'cancelOrder': true,
34
34
  'cancelOrders': false,
35
+ 'createMarketBuyOrderWithCost': true,
36
+ 'createMarketOrderWithCost': false,
37
+ 'createMarketSellOrderWithCost': false,
35
38
  'createOrder': true,
36
39
  'createStopLimitOrder': true,
37
40
  'createStopMarketOrder': true,
@@ -1197,6 +1200,33 @@ class whitebit extends whitebit$1 {
1197
1200
  //
1198
1201
  return this.safeInteger(response, 'time');
1199
1202
  }
1203
+ async createMarketOrderWithCost(symbol, side, cost, params = {}) {
1204
+ /**
1205
+ * @method
1206
+ * @name createMarketOrderWithCost
1207
+ * @description create a market order by providing the symbol, side and cost
1208
+ * @param {string} symbol unified symbol of the market to create an order in
1209
+ * @param {string} side 'buy' or 'sell'
1210
+ * @param {float} cost how much you want to trade in units of the quote currency
1211
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1212
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1213
+ */
1214
+ params['cost'] = cost;
1215
+ // only buy side is supported
1216
+ return await this.createOrder(symbol, 'market', side, 0, undefined, params);
1217
+ }
1218
+ async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
1219
+ /**
1220
+ * @method
1221
+ * @name createMarketBuyOrderWithCost
1222
+ * @description create a market buy order by providing the symbol and cost
1223
+ * @param {string} symbol unified symbol of the market to create an order in
1224
+ * @param {float} cost how much you want to trade in units of the quote currency
1225
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1226
+ * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1227
+ */
1228
+ return await this.createMarketOrderWithCost(symbol, 'buy', cost, params);
1229
+ }
1200
1230
  async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
1201
1231
  /**
1202
1232
  * @method
@@ -1213,6 +1243,7 @@ class whitebit extends whitebit$1 {
1213
1243
  * @param {float} amount how much of currency you want to trade in units of base currency
1214
1244
  * @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1215
1245
  * @param {object} [params] extra parameters specific to the exchange API endpoint
1246
+ * @param {float} [params.cost] *market orders only* the cost of the order in units of the base currency
1216
1247
  * @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
1217
1248
  */
1218
1249
  await this.loadMarkets();
@@ -1220,8 +1251,18 @@ class whitebit extends whitebit$1 {
1220
1251
  const request = {
1221
1252
  'market': market['id'],
1222
1253
  'side': side,
1223
- 'amount': this.amountToPrecision(symbol, amount),
1224
1254
  };
1255
+ let cost = undefined;
1256
+ [cost, params] = this.handleParamString(params, 'cost');
1257
+ if (cost !== undefined) {
1258
+ if ((side !== 'buy') || (type !== 'market')) {
1259
+ throw new errors.InvalidOrder(this.id + ' createOrder() cost is only supported for market buy orders');
1260
+ }
1261
+ request['amount'] = this.costToPrecision(symbol, cost);
1262
+ }
1263
+ else {
1264
+ request['amount'] = this.amountToPrecision(symbol, amount);
1265
+ }
1225
1266
  const clientOrderId = this.safeString2(params, 'clOrdId', 'clientOrderId');
1226
1267
  if (clientOrderId === undefined) {
1227
1268
  const brokerId = this.safeString(this.options, 'brokerId');
@@ -1283,7 +1324,12 @@ class whitebit extends whitebit$1 {
1283
1324
  response = await this.v4PrivatePostOrderCollateralMarket(this.extend(request, params));
1284
1325
  }
1285
1326
  else {
1286
- response = await this.v4PrivatePostOrderStockMarket(this.extend(request, params));
1327
+ if (cost !== undefined) {
1328
+ response = await this.v4PrivatePostOrderMarket(this.extend(request, params));
1329
+ }
1330
+ else {
1331
+ response = await this.v4PrivatePostOrderStockMarket(this.extend(request, params));
1332
+ }
1287
1333
  }
1288
1334
  }
1289
1335
  }
@@ -1470,7 +1516,7 @@ class whitebit extends whitebit$1 {
1470
1516
  const balance = response[id];
1471
1517
  if (typeof balance === 'object' && balance !== undefined) {
1472
1518
  const account = this.account();
1473
- account['free'] = this.safeString(balance, 'available');
1519
+ account['free'] = this.safeString2(balance, 'available', 'main_balance');
1474
1520
  account['used'] = this.safeString(balance, 'freeze');
1475
1521
  account['total'] = this.safeString(balance, 'main_balance');
1476
1522
  result[code] = account;
@@ -1694,7 +1740,7 @@ class whitebit extends whitebit$1 {
1694
1740
  const symbol = market['symbol'];
1695
1741
  const side = this.safeString(order, 'side');
1696
1742
  const filled = this.safeString(order, 'dealStock');
1697
- const remaining = this.safeString(order, 'left');
1743
+ let remaining = this.safeString(order, 'left');
1698
1744
  let clientOrderId = this.safeString(order, 'clientOrderId');
1699
1745
  if (clientOrderId === '') {
1700
1746
  clientOrderId = undefined;
@@ -1703,6 +1749,10 @@ class whitebit extends whitebit$1 {
1703
1749
  const stopPrice = this.safeNumber(order, 'activation_price');
1704
1750
  const orderId = this.safeString2(order, 'orderId', 'id');
1705
1751
  const type = this.safeString(order, 'type');
1752
+ const orderType = this.parseOrderType(type);
1753
+ if (orderType === 'market') {
1754
+ remaining = undefined;
1755
+ }
1706
1756
  let amount = this.safeString(order, 'amount');
1707
1757
  const cost = this.safeString(order, 'dealMoney');
1708
1758
  if ((side === 'buy') && ((type === 'market') || (type === 'stop market'))) {
@@ -1731,7 +1781,7 @@ class whitebit extends whitebit$1 {
1731
1781
  'status': undefined,
1732
1782
  'side': side,
1733
1783
  'price': price,
1734
- 'type': this.parseOrderType(type),
1784
+ 'type': orderType,
1735
1785
  'stopPrice': stopPrice,
1736
1786
  'triggerPrice': stopPrice,
1737
1787
  'amount': amount,
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 type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, Option, OptionChain, Conversion } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
7
- declare const version = "4.3.27";
7
+ declare const version = "4.3.29";
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, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, MarketClosed, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.3.28';
41
+ const version = '4.3.30';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -7,6 +7,8 @@ interface Exchange {
7
7
  spotV1PublicGetMarketDepth(params?: {}): Promise<implicitReturnType>;
8
8
  spotV1PublicGetMarketKline(params?: {}): Promise<implicitReturnType>;
9
9
  spotV1PublicGetTicker24hr(params?: {}): Promise<implicitReturnType>;
10
+ spotV1PublicGetTickerPrice(params?: {}): Promise<implicitReturnType>;
11
+ spotV1PublicGetTickerBookTicker(params?: {}): Promise<implicitReturnType>;
10
12
  spotV1PrivateGetTradeQuery(params?: {}): Promise<implicitReturnType>;
11
13
  spotV1PrivateGetTradeOpenOrders(params?: {}): Promise<implicitReturnType>;
12
14
  spotV1PrivateGetTradeHistoryOrders(params?: {}): Promise<implicitReturnType>;
@@ -20,12 +22,15 @@ interface Exchange {
20
22
  spotV1PrivatePostTradeCancelOrders(params?: {}): Promise<implicitReturnType>;
21
23
  spotV1PrivatePostTradeCancelOpenOrders(params?: {}): Promise<implicitReturnType>;
22
24
  spotV1PrivatePostTradeCancelAllAfter(params?: {}): Promise<implicitReturnType>;
25
+ spotV2PublicGetMarketDepth(params?: {}): Promise<implicitReturnType>;
26
+ spotV2PublicGetMarketKline(params?: {}): Promise<implicitReturnType>;
23
27
  spotV3PrivateGetGetAssetTransfer(params?: {}): Promise<implicitReturnType>;
24
28
  spotV3PrivateGetAssetTransfer(params?: {}): Promise<implicitReturnType>;
25
29
  spotV3PrivateGetCapitalDepositHisrec(params?: {}): Promise<implicitReturnType>;
26
30
  spotV3PrivateGetCapitalWithdrawHistory(params?: {}): Promise<implicitReturnType>;
27
31
  spotV3PrivatePostPostAssetTransfer(params?: {}): Promise<implicitReturnType>;
28
32
  swapV1PublicGetTickerPrice(params?: {}): Promise<implicitReturnType>;
33
+ swapV1PublicGetMarketHistoricalTrades(params?: {}): Promise<implicitReturnType>;
29
34
  swapV1PrivateGetPositionSideDual(params?: {}): Promise<implicitReturnType>;
30
35
  swapV1PrivateGetMarketMarkPriceKlines(params?: {}): Promise<implicitReturnType>;
31
36
  swapV1PrivateGetTradeBatchCancelReplace(params?: {}): Promise<implicitReturnType>;
@@ -79,6 +84,7 @@ interface Exchange {
79
84
  walletsV1PrivateGetCapitalSubAccountDepositAddress(params?: {}): Promise<implicitReturnType>;
80
85
  walletsV1PrivateGetCapitalDepositSubHisrec(params?: {}): Promise<implicitReturnType>;
81
86
  walletsV1PrivateGetCapitalSubAccountInnerTransferRecords(params?: {}): Promise<implicitReturnType>;
87
+ walletsV1PrivateGetCapitalDepositRiskRecords(params?: {}): Promise<implicitReturnType>;
82
88
  walletsV1PrivatePostCapitalWithdrawApply(params?: {}): Promise<implicitReturnType>;
83
89
  walletsV1PrivatePostCapitalInnerTransferApply(params?: {}): Promise<implicitReturnType>;
84
90
  walletsV1PrivatePostCapitalSubAccountInnerTransferApply(params?: {}): Promise<implicitReturnType>;
@@ -95,6 +101,7 @@ interface Exchange {
95
101
  accountV1PrivatePostInnerTransferAuthorizeSubAccount(params?: {}): Promise<implicitReturnType>;
96
102
  userAuthPrivatePostUserDataStream(params?: {}): Promise<implicitReturnType>;
97
103
  userAuthPrivatePutUserDataStream(params?: {}): Promise<implicitReturnType>;
104
+ userAuthPrivateDeleteUserDataStream(params?: {}): Promise<implicitReturnType>;
98
105
  copyTradingV1PrivateGetSwapTraceCurrentTrack(params?: {}): Promise<implicitReturnType>;
99
106
  copyTradingV1PrivatePostSwapTraceCloseTrackOrder(params?: {}): Promise<implicitReturnType>;
100
107
  copyTradingV1PrivatePostSwapTraceSetTPSL(params?: {}): Promise<implicitReturnType>;
@@ -80,6 +80,7 @@ interface Exchange {
80
80
  privatePostSpotV4QueryTrades(params?: {}): Promise<implicitReturnType>;
81
81
  privatePostSpotV4QueryOrderTrades(params?: {}): Promise<implicitReturnType>;
82
82
  privatePostSpotV4CancelOrders(params?: {}): Promise<implicitReturnType>;
83
+ privatePostSpotV4BatchOrders(params?: {}): Promise<implicitReturnType>;
83
84
  privatePostSpotV3CancelOrder(params?: {}): Promise<implicitReturnType>;
84
85
  privatePostSpotV2BatchOrders(params?: {}): Promise<implicitReturnType>;
85
86
  privatePostSpotV2SubmitOrder(params?: {}): Promise<implicitReturnType>;
@@ -6113,6 +6113,9 @@ export default class Exchange {
6113
6113
  }
6114
6114
  parseMarginModes(response, symbols = undefined, symbolKey = undefined, marketType = undefined) {
6115
6115
  const marginModeStructures = {};
6116
+ if (marketType === undefined) {
6117
+ marketType = 'swap'; // default to swap
6118
+ }
6116
6119
  for (let i = 0; i < response.length; i++) {
6117
6120
  const info = response[i];
6118
6121
  const marketId = this.safeString(info, symbolKey);
@@ -6128,6 +6131,9 @@ export default class Exchange {
6128
6131
  }
6129
6132
  parseLeverages(response, symbols = undefined, symbolKey = undefined, marketType = undefined) {
6130
6133
  const leverageStructures = {};
6134
+ if (marketType === undefined) {
6135
+ marketType = 'swap'; // default to swap
6136
+ }
6131
6137
  for (let i = 0; i < response.length; i++) {
6132
6138
  const info = response[i];
6133
6139
  const marketId = this.safeString(info, symbolKey);
@@ -1,4 +1,4 @@
1
- interface CustomArray extends Array {
1
+ interface CustomArray extends Array<any> {
2
2
  hashmap: object;
3
3
  }
4
4
  declare class BaseCache extends Array {
@@ -1,22 +1,21 @@
1
1
  interface IOrderBookSide<T> extends Array<T> {
2
2
  store(price: any, size: any): any;
3
- store(price: any, size: any, index: any): any;
4
3
  storeArray(array: any[]): any;
5
4
  limit(): any;
6
5
  }
7
- declare class OrderBookSide extends Array implements IOrderBookSide {
6
+ declare class OrderBookSide extends Array implements IOrderBookSide<any> {
8
7
  constructor(deltas?: any[], depth?: any);
9
8
  storeArray(delta: any): void;
10
9
  store(price: any, size: any): void;
11
10
  limit(): void;
12
11
  }
13
12
  declare class CountedOrderBookSide extends OrderBookSide {
14
- store(price: any, size: any, count: any): void;
13
+ store(price: any, size: any): void;
15
14
  storeArray(delta: any): void;
16
15
  }
17
- declare class IndexedOrderBookSide extends Array implements IOrderBookSide {
16
+ declare class IndexedOrderBookSide extends Array implements IOrderBookSide<any> {
18
17
  constructor(deltas?: any[], depth?: number);
19
- store(price: any, size: any, id: any): void;
18
+ store(price: any, size: any): void;
20
19
  storeArray(delta: any): void;
21
20
  limit(): void;
22
21
  }
@@ -101,8 +101,8 @@ class OrderBookSide extends Array {
101
101
  // or deletes price levels based on order counts (3rd value in a bidask delta)
102
102
  // this class stores vector arrays of values indexed by price
103
103
  class CountedOrderBookSide extends OrderBookSide {
104
- store(price, size, count) {
105
- this.storeArray([price, size, count]);
104
+ store(price, size) {
105
+ throw new Error('CountedOrderBookSide.store() is not supported, use storeArray([price, size, count]) instead');
106
106
  }
107
107
  storeArray(delta) {
108
108
  const price = delta[0];
@@ -166,8 +166,8 @@ class IndexedOrderBookSide extends Array {
166
166
  this.storeArray(deltas[i].slice()); // slice is muy importante
167
167
  }
168
168
  }
169
- store(price, size, id) {
170
- this.storeArray([price, size, id]);
169
+ store(price, size) {
170
+ throw new Error('IndexedOrderBook.store() is not supported, use storeArray([price, size, id]) instead');
171
171
  }
172
172
  storeArray(delta) {
173
173
  const price = delta[0];