ccxt 4.3.13 → 4.3.15

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 (61) hide show
  1. package/LICENSE.txt +1 -1
  2. package/README.md +3 -3
  3. package/dist/cjs/ccxt.js +2 -1
  4. package/dist/cjs/src/base/Exchange.js +14 -6
  5. package/dist/cjs/src/base/errors.js +8 -1
  6. package/dist/cjs/src/base/functions/misc.js +2 -2
  7. package/dist/cjs/src/base/ws/Client.js +2 -1
  8. package/dist/cjs/src/binance.js +106 -5
  9. package/dist/cjs/src/bingx.js +1 -0
  10. package/dist/cjs/src/bybit.js +105 -105
  11. package/dist/cjs/src/coinbase.js +103 -0
  12. package/dist/cjs/src/coinex.js +435 -423
  13. package/dist/cjs/src/cryptocom.js +2 -1
  14. package/dist/cjs/src/hitbtc.js +1 -0
  15. package/dist/cjs/src/luno.js +2 -0
  16. package/dist/cjs/src/okx.js +1 -1
  17. package/dist/cjs/src/phemex.js +1 -1
  18. package/dist/cjs/src/pro/hitbtc.js +1 -1
  19. package/dist/cjs/src/pro/independentreserve.js +3 -3
  20. package/dist/cjs/src/pro/poloniex.js +3 -3
  21. package/dist/cjs/src/pro/woo.js +147 -9
  22. package/js/ccxt.d.ts +3 -3
  23. package/js/ccxt.js +3 -3
  24. package/js/src/abstract/luno.d.ts +2 -0
  25. package/js/src/alpaca.d.ts +1 -1
  26. package/js/src/base/Exchange.d.ts +5 -5
  27. package/js/src/base/Exchange.js +14 -6
  28. package/js/src/base/errorHierarchy.d.ts +1 -0
  29. package/js/src/base/errorHierarchy.js +1 -0
  30. package/js/src/base/errors.d.ts +5 -1
  31. package/js/src/base/errors.js +8 -2
  32. package/js/src/base/functions/generic.d.ts +1 -1
  33. package/js/src/base/functions/misc.d.ts +5 -4
  34. package/js/src/base/functions/misc.js +2 -2
  35. package/js/src/base/functions/number.d.ts +5 -5
  36. package/js/src/base/functions/rsa.d.ts +2 -1
  37. package/js/src/base/functions/totp.d.ts +1 -1
  38. package/js/src/base/ws/Client.d.ts +8 -7
  39. package/js/src/base/ws/Client.js +2 -1
  40. package/js/src/binance.d.ts +14 -1
  41. package/js/src/binance.js +107 -6
  42. package/js/src/bingx.d.ts +1 -1
  43. package/js/src/bingx.js +1 -0
  44. package/js/src/bybit.js +105 -105
  45. package/js/src/coinbase.d.ts +5 -1
  46. package/js/src/coinbase.js +103 -0
  47. package/js/src/coinex.js +435 -423
  48. package/js/src/cryptocom.js +2 -1
  49. package/js/src/hitbtc.js +1 -0
  50. package/js/src/luno.js +2 -0
  51. package/js/src/okx.js +1 -1
  52. package/js/src/phemex.js +1 -1
  53. package/js/src/pro/hitbtc.js +1 -1
  54. package/js/src/pro/independentreserve.js +3 -3
  55. package/js/src/pro/poloniex.js +3 -3
  56. package/js/src/pro/woo.d.ts +2 -0
  57. package/js/src/pro/woo.js +147 -9
  58. package/js/src/upbit.d.ts +1 -1
  59. package/js/src/woo.d.ts +1 -1
  60. package/js/src/zonda.d.ts +1 -1
  61. package/package.json +1 -1
@@ -496,7 +496,8 @@ class cryptocom extends cryptocom$1 {
496
496
  const strike = this.safeString(market, 'strike');
497
497
  const marginBuyEnabled = this.safeValue(market, 'margin_buy_enabled');
498
498
  const marginSellEnabled = this.safeValue(market, 'margin_sell_enabled');
499
- const expiry = this.omitZero(this.safeInteger(market, 'expiry_timestamp_ms'));
499
+ const expiryString = this.omitZero(this.safeString(market, 'expiry_timestamp_ms'));
500
+ const expiry = (expiryString !== undefined) ? parseInt(expiryString) : undefined;
500
501
  let symbol = base + '/' + quote;
501
502
  let type = undefined;
502
503
  let contract = undefined;
@@ -615,6 +615,7 @@ class hitbtc extends hitbtc$1 {
615
615
  'accountsByType': {
616
616
  'spot': 'spot',
617
617
  'funding': 'wallet',
618
+ 'swap': 'derivatives',
618
619
  'future': 'derivatives',
619
620
  },
620
621
  'withdraw': {
@@ -147,6 +147,7 @@ class luno extends luno$1 {
147
147
  'withdrawals': 1,
148
148
  'send': 1,
149
149
  'oauth2/grant': 1,
150
+ 'beneficiaries': 1,
150
151
  // POST /api/exchange/1/move
151
152
  },
152
153
  'put': {
@@ -154,6 +155,7 @@ class luno extends luno$1 {
154
155
  },
155
156
  'delete': {
156
157
  'withdrawals/{id}': 1,
158
+ 'beneficiaries/{id}': 1,
157
159
  },
158
160
  },
159
161
  },
@@ -5575,7 +5575,7 @@ class okx extends okx$1 {
5575
5575
  // }
5576
5576
  //
5577
5577
  const marketId = this.safeString(position, 'instId');
5578
- market = this.safeMarket(marketId, market);
5578
+ market = this.safeMarket(marketId, market, undefined, 'contract');
5579
5579
  const symbol = market['symbol'];
5580
5580
  const pos = this.safeString(position, 'pos'); // 'pos' field: One way mode: 0 if position is not open, 1 if open | Two way (hedge) mode: -1 if short, 1 if long, 0 if position is not open
5581
5581
  const contractsAbs = Precise["default"].stringAbs(pos);
@@ -2380,7 +2380,7 @@ class phemex extends phemex$1 {
2380
2380
  lastTradeTimestamp = undefined;
2381
2381
  }
2382
2382
  const timeInForce = this.parseTimeInForce(this.safeString(order, 'timeInForce'));
2383
- const stopPrice = this.omitZero(this.safeNumber2(order, 'stopPx', 'stopPxRp'));
2383
+ const stopPrice = this.omitZero(this.safeString2(order, 'stopPx', 'stopPxRp'));
2384
2384
  const postOnly = (timeInForce === 'PO');
2385
2385
  let reduceOnly = this.safeValue(order, 'reduceOnly');
2386
2386
  const execInst = this.safeString(order, 'execInst');
@@ -1195,7 +1195,7 @@ class hitbtc extends hitbtc$1 {
1195
1195
  // "id": 1700233093414
1196
1196
  // }
1197
1197
  //
1198
- const messageHash = this.safeInteger(message, 'id');
1198
+ const messageHash = this.safeString(message, 'id');
1199
1199
  const result = this.safeValue(message, 'result', {});
1200
1200
  if (Array.isArray(result)) {
1201
1201
  const parsedOrders = [];
@@ -132,9 +132,9 @@ class independentreserve extends independentreserve$1 {
132
132
  if (limit === undefined) {
133
133
  limit = 100;
134
134
  }
135
- limit = this.numberToString(limit);
136
- const url = this.urls['api']['ws'] + '/orderbook/' + limit + '?subscribe=' + market['base'] + '-' + market['quote'];
137
- const messageHash = 'orderbook:' + symbol + ':' + limit;
135
+ const limitString = this.numberToString(limit);
136
+ const url = this.urls['api']['ws'] + '/orderbook/' + limitString + '?subscribe=' + market['base'] + '-' + market['quote'];
137
+ const messageHash = 'orderbook:' + symbol + ':' + limitString;
138
138
  const subscription = {
139
139
  'receivedSnapshot': false,
140
140
  };
@@ -314,7 +314,7 @@ class poloniex extends poloniex$1 {
314
314
  // }]
315
315
  // }
316
316
  //
317
- const messageHash = this.safeInteger(message, 'id');
317
+ const messageHash = this.safeString(message, 'id');
318
318
  const data = this.safeValue(message, 'data', []);
319
319
  const orders = [];
320
320
  for (let i = 0; i < data.length; i++) {
@@ -652,8 +652,8 @@ class poloniex extends poloniex$1 {
652
652
  'type': this.safeStringLower(trade, 'type'),
653
653
  'side': this.safeStringLower2(trade, 'takerSide', 'side'),
654
654
  'takerOrMaker': takerMaker,
655
- 'price': this.omitZero(this.safeNumber2(trade, 'tradePrice', 'price')),
656
- 'amount': this.omitZero(this.safeNumber2(trade, 'filledQuantity', 'quantity')),
655
+ 'price': this.omitZero(this.safeString2(trade, 'tradePrice', 'price')),
656
+ 'amount': this.omitZero(this.safeString2(trade, 'filledQuantity', 'quantity')),
657
657
  'cost': this.safeString2(trade, 'amount', 'filledAmount'),
658
658
  'fee': {
659
659
  'rate': undefined,
@@ -14,7 +14,7 @@ class woo extends woo$1 {
14
14
  'has': {
15
15
  'ws': true,
16
16
  'watchBalance': true,
17
- 'watchMyTrades': false,
17
+ 'watchMyTrades': true,
18
18
  'watchOHLCV': true,
19
19
  'watchOrderBook': true,
20
20
  'watchOrders': true,
@@ -84,6 +84,7 @@ class woo extends woo$1 {
84
84
  /**
85
85
  * @method
86
86
  * @name woo#watchOrderBook
87
+ * @see https://docs.woo.org/#orderbook
87
88
  * @description watches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
88
89
  * @param {string} symbol unified symbol of the market to fetch the order book for
89
90
  * @param {int} [limit] the maximum amount of order book entries to return.
@@ -228,6 +229,7 @@ class woo extends woo$1 {
228
229
  /**
229
230
  * @method
230
231
  * @name woo#watchTickers
232
+ * @see https://docs.woo.org/#24h-tickers
231
233
  * @description watches a price ticker, a statistical calculation with the information calculated over the past 24 hours for all markets of a specific list
232
234
  * @param {string[]} symbols unified symbol of the market to fetch the ticker for
233
235
  * @param {object} [params] extra parameters specific to the exchange API endpoint
@@ -289,6 +291,18 @@ class woo extends woo$1 {
289
291
  client.resolve(result, topic);
290
292
  }
291
293
  async watchOHLCV(symbol, timeframe = '1m', since = undefined, limit = undefined, params = {}) {
294
+ /**
295
+ * @method
296
+ * @name woo#watchOHLCV
297
+ * @description watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
298
+ * @see https://docs.woo.org/#k-line
299
+ * @param {string} symbol unified symbol of the market to fetch OHLCV data for
300
+ * @param {string} timeframe the length of time each candle represents
301
+ * @param {int} [since] timestamp in ms of the earliest candle to fetch
302
+ * @param {int} [limit] the maximum amount of candles to fetch
303
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
304
+ * @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
305
+ */
292
306
  await this.loadMarkets();
293
307
  if ((timeframe !== '1m') && (timeframe !== '5m') && (timeframe !== '15m') && (timeframe !== '30m') && (timeframe !== '1h') && (timeframe !== '1d') && (timeframe !== '1w') && (timeframe !== '1M')) {
294
308
  throw new errors.ExchangeError(this.id + ' watchOHLCV timeframe argument must be 1m, 5m, 15m, 30m, 1h, 1d, 1w, 1M');
@@ -357,6 +371,7 @@ class woo extends woo$1 {
357
371
  * @method
358
372
  * @name woo#watchTrades
359
373
  * @description watches information on multiple trades made in a market
374
+ * @see https://docs.woo.org/#trade
360
375
  * @param {string} symbol unified market symbol of the market trades were made in
361
376
  * @param {int} [since] the earliest time in ms to fetch trades for
362
377
  * @param {int} [limit] the maximum number of trade structures to retrieve
@@ -418,17 +433,60 @@ class woo extends woo$1 {
418
433
  // "side":"BUY",
419
434
  // "source":0
420
435
  // }
436
+ // private trade
437
+ // {
438
+ // "msgType": 0, // execution report
439
+ // "symbol": "SPOT_BTC_USDT",
440
+ // "clientOrderId": 0,
441
+ // "orderId": 54774393,
442
+ // "type": "MARKET",
443
+ // "side": "BUY",
444
+ // "quantity": 0.0,
445
+ // "price": 0.0,
446
+ // "tradeId": 56201985,
447
+ // "executedPrice": 23534.06,
448
+ // "executedQuantity": 0.00040791,
449
+ // "fee": 2.1E-7,
450
+ // "feeAsset": "BTC",
451
+ // "totalExecutedQuantity": 0.00040791,
452
+ // "avgPrice": 23534.06,
453
+ // "status": "FILLED",
454
+ // "reason": "",
455
+ // "orderTag": "default",
456
+ // "totalFee": 2.1E-7,
457
+ // "feeCurrency": "BTC",
458
+ // "totalRebate": 0,
459
+ // "rebateCurrency": "USDT",
460
+ // "visible": 0.0,
461
+ // "timestamp": 1675406261689,
462
+ // "reduceOnly": false,
463
+ // "maker": false
464
+ // }
421
465
  //
422
466
  const marketId = this.safeString(trade, 'symbol');
423
467
  market = this.safeMarket(marketId, market);
424
468
  const symbol = market['symbol'];
425
- const price = this.safeString(trade, 'price');
426
- const amount = this.safeString(trade, 'size');
469
+ const price = this.safeString(trade, 'executedPrice', 'price');
470
+ const amount = this.safeString2(trade, 'executedQuantity', 'size');
427
471
  const cost = Precise["default"].stringMul(price, amount);
428
472
  const side = this.safeStringLower(trade, 'side');
429
473
  const timestamp = this.safeInteger(trade, 'timestamp');
474
+ const maker = this.safeBool(trade, 'marker');
475
+ let takerOrMaker = undefined;
476
+ if (maker !== undefined) {
477
+ takerOrMaker = maker ? 'maker' : 'taker';
478
+ }
479
+ const type = this.safeStringLower(trade, 'type');
480
+ let fee = undefined;
481
+ const feeCost = this.safeNumber(trade, 'fee');
482
+ if (feeCost !== undefined) {
483
+ fee = {
484
+ 'cost': feeCost,
485
+ 'currency': this.safeCurrencyCode(this.safeString(trade, 'feeCurrency')),
486
+ };
487
+ }
430
488
  return this.safeTrade({
431
- 'id': undefined,
489
+ 'id': this.safeString(trade, 'tradeId'),
432
490
  'timestamp': timestamp,
433
491
  'datetime': this.iso8601(timestamp),
434
492
  'symbol': symbol,
@@ -436,10 +494,10 @@ class woo extends woo$1 {
436
494
  'price': price,
437
495
  'amount': amount,
438
496
  'cost': cost,
439
- 'order': undefined,
440
- 'takerOrMaker': undefined,
441
- 'type': undefined,
442
- 'fee': undefined,
497
+ 'order': this.safeString(trade, 'orderId'),
498
+ 'takerOrMaker': takerOrMaker,
499
+ 'type': type,
500
+ 'fee': fee,
443
501
  'info': trade,
444
502
  }, market);
445
503
  }
@@ -493,6 +551,8 @@ class woo extends woo$1 {
493
551
  /**
494
552
  * @method
495
553
  * @name woo#watchOrders
554
+ * @see https://docs.woo.org/#executionreport
555
+ * @see https://docs.woo.org/#algoexecutionreportv2
496
556
  * @description watches information on multiple orders made by the user
497
557
  * @param {string} symbol unified market symbol of the market orders were made in
498
558
  * @param {int} [since] the earliest time in ms to fetch orders for
@@ -519,6 +579,37 @@ class woo extends woo$1 {
519
579
  }
520
580
  return this.filterBySymbolSinceLimit(orders, symbol, since, limit, true);
521
581
  }
582
+ async watchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
583
+ /**
584
+ * @method
585
+ * @name woo#watchOrders
586
+ * @see https://docs.woo.org/#executionreport
587
+ * @description watches information on multiple trades made by the user
588
+ * @param {string} symbol unified market symbol of the market orders were made in
589
+ * @param {int} [since] the earliest time in ms to fetch orders for
590
+ * @param {int} [limit] the maximum number of order structures to retrieve
591
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
592
+ * @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
593
+ */
594
+ await this.loadMarkets();
595
+ const topic = 'executionreport';
596
+ let messageHash = 'myTrades';
597
+ if (symbol !== undefined) {
598
+ const market = this.market(symbol);
599
+ symbol = market['symbol'];
600
+ messageHash += ':' + symbol;
601
+ }
602
+ const request = {
603
+ 'event': 'subscribe',
604
+ 'topic': topic,
605
+ };
606
+ const message = this.extend(request, params);
607
+ const trades = await this.watchPrivate(messageHash, message);
608
+ if (this.newUpdates) {
609
+ limit = trades.getLimit(symbol, limit);
610
+ }
611
+ return this.filterBySymbolSinceLimit(trades, symbol, since, limit, true);
612
+ }
522
613
  parseWsOrder(order, market = undefined) {
523
614
  //
524
615
  // {
@@ -627,7 +718,11 @@ class woo extends woo$1 {
627
718
  // }
628
719
  // }
629
720
  //
630
- const order = this.safeValue(message, 'data');
721
+ const order = this.safeDict(message, 'data');
722
+ const tradeId = this.safeString(order, 'tradeId');
723
+ if ((tradeId !== undefined) && (tradeId !== '0')) {
724
+ this.handleMyTrade(client, order);
725
+ }
631
726
  this.handleOrder(client, order);
632
727
  }
633
728
  handleOrder(client, message) {
@@ -662,6 +757,49 @@ class woo extends woo$1 {
662
757
  client.resolve(this.orders, messageHashSymbol);
663
758
  }
664
759
  }
760
+ handleMyTrade(client, message) {
761
+ //
762
+ // {
763
+ // "msgType": 0, // execution report
764
+ // "symbol": "SPOT_BTC_USDT",
765
+ // "clientOrderId": 0,
766
+ // "orderId": 54774393,
767
+ // "type": "MARKET",
768
+ // "side": "BUY",
769
+ // "quantity": 0.0,
770
+ // "price": 0.0,
771
+ // "tradeId": 56201985,
772
+ // "executedPrice": 23534.06,
773
+ // "executedQuantity": 0.00040791,
774
+ // "fee": 2.1E-7,
775
+ // "feeAsset": "BTC",
776
+ // "totalExecutedQuantity": 0.00040791,
777
+ // "avgPrice": 23534.06,
778
+ // "status": "FILLED",
779
+ // "reason": "",
780
+ // "orderTag": "default",
781
+ // "totalFee": 2.1E-7,
782
+ // "feeCurrency": "BTC",
783
+ // "totalRebate": 0,
784
+ // "rebateCurrency": "USDT",
785
+ // "visible": 0.0,
786
+ // "timestamp": 1675406261689,
787
+ // "reduceOnly": false,
788
+ // "maker": false
789
+ // }
790
+ //
791
+ let myTrades = this.myTrades;
792
+ if (myTrades === undefined) {
793
+ const limit = this.safeInteger(this.options, 'tradesLimit', 1000);
794
+ myTrades = new Cache.ArrayCacheBySymbolById(limit);
795
+ }
796
+ const trade = this.parseWsTrade(message);
797
+ myTrades.append(trade);
798
+ let messageHash = 'myTrades:' + trade['symbol'];
799
+ client.resolve(myTrades, messageHash);
800
+ messageHash = 'myTrades';
801
+ client.resolve(myTrades, messageHash);
802
+ }
665
803
  async watchPositions(symbols = undefined, since = undefined, limit = undefined, params = {}) {
666
804
  /**
667
805
  * @method
package/js/ccxt.d.ts CHANGED
@@ -3,8 +3,8 @@ import { Precise } from './src/base/Precise.js';
3
3
  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
- import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, 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.12";
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.14";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
@@ -519,5 +519,5 @@ declare const ccxt: {
519
519
  zaif: typeof zaif;
520
520
  zonda: typeof zonda;
521
521
  } & typeof functions & typeof errors;
522
- export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, 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, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseinternational, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, tradeogre, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
522
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, 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, 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, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseinternational, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, tradeogre, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
523
523
  export default ccxt;
package/js/ccxt.js CHANGED
@@ -35,10 +35,10 @@ import { Exchange } from './src/base/Exchange.js';
35
35
  import { Precise } from './src/base/Precise.js';
36
36
  import * as functions from './src/base/functions.js';
37
37
  import * as errors from './src/base/errors.js';
38
- import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, 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';
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.13';
41
+ const version = '4.3.15';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -392,6 +392,6 @@ pro.exchanges = Object.keys(pro);
392
392
  pro['Exchange'] = Exchange; // now the same for rest and ts
393
393
  //-----------------------------------------------------------------------------
394
394
  const ccxt = Object.assign({ version, Exchange, Precise, 'exchanges': Object.keys(exchanges), 'pro': pro }, exchanges, functions, errors);
395
- export { version, Exchange, exchanges, pro, Precise, functions, errors, BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseinternational, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, tradeogre, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
395
+ export { version, Exchange, exchanges, pro, Precise, functions, errors, 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, ace, alpaca, ascendex, bequant, bigone, binance, binancecoinm, binanceus, binanceusdm, bingx, bit2c, bitbank, bitbay, bitbns, bitcoincom, bitfinex, bitfinex2, bitflyer, bitget, bithumb, bitmart, bitmex, bitopro, bitpanda, bitrue, bitso, bitstamp, bitteam, bitvavo, bl3p, blockchaincom, blofin, btcalpha, btcbox, btcmarkets, btcturk, bybit, cex, coinbase, coinbaseinternational, coinbasepro, coincheck, coinex, coinlist, coinmate, coinmetro, coinone, coinsph, coinspot, cryptocom, currencycom, delta, deribit, digifinex, exmo, fmfwio, gate, gateio, gemini, hitbtc, hitbtc3, hollaex, htx, huobi, huobijp, hyperliquid, idex, independentreserve, indodax, kraken, krakenfutures, kucoin, kucoinfutures, kuna, latoken, lbank, luno, lykke, mercado, mexc, ndax, novadax, oceanex, okcoin, okx, onetrading, p2b, paymium, phemex, poloniex, poloniexfutures, probit, timex, tokocrypto, tradeogre, upbit, wavesexchange, wazirx, whitebit, woo, yobit, zaif, zonda, };
396
396
  export default ccxt;
397
397
  //-----------------------------------------------------------------------------
@@ -30,8 +30,10 @@ interface Exchange {
30
30
  privatePostWithdrawals(params?: {}): Promise<implicitReturnType>;
31
31
  privatePostSend(params?: {}): Promise<implicitReturnType>;
32
32
  privatePostOauth2Grant(params?: {}): Promise<implicitReturnType>;
33
+ privatePostBeneficiaries(params?: {}): Promise<implicitReturnType>;
33
34
  privatePutAccountsIdName(params?: {}): Promise<implicitReturnType>;
34
35
  privateDeleteWithdrawalsId(params?: {}): Promise<implicitReturnType>;
36
+ privateDeleteBeneficiariesId(params?: {}): Promise<implicitReturnType>;
35
37
  }
36
38
  declare abstract class Exchange extends _Exchange {
37
39
  }
@@ -25,7 +25,7 @@ export default class alpaca extends Exchange {
25
25
  parseTimeInForce(timeInForce: any): string;
26
26
  parseTrade(trade: any, market?: Market): Trade;
27
27
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
28
- url: any;
28
+ url: string;
29
29
  method: string;
30
30
  body: any;
31
31
  headers: any;
@@ -200,13 +200,13 @@ export default class Exchange {
200
200
  numberToBE: (n: number, padding: number) => Uint8Array;
201
201
  base16ToBinary: (str: string) => Uint8Array;
202
202
  iso8601: (timestamp: any) => string;
203
- omit: (x: Dictionary<any>, ...args: any[]) => any;
203
+ omit: (x: Dictionary<any>, ...args: any) => any;
204
204
  isJsonEncodedObject: (object: any) => boolean;
205
205
  safeInteger: (o: any, k: IndexType, $default?: number) => number;
206
206
  sum: (...xs: any[]) => any;
207
207
  omitZero: typeof functions.omitZero;
208
- implodeParams: (string: any, params: any) => any;
209
- extractParams: (string: any) => any[];
208
+ implodeParams: (string: string, params: any[] | Dictionary<any>) => string;
209
+ extractParams: (string: string) => string[];
210
210
  json: (data: any, params?: any) => string;
211
211
  vwap: typeof functions.vwap;
212
212
  merge: (target: Dictionary<any>, ...args: any) => Dictionary<any>;
@@ -993,7 +993,7 @@ export default class Exchange {
993
993
  amountToPrecision(symbol: string, amount: any): any;
994
994
  feeToPrecision(symbol: string, fee: any): any;
995
995
  currencyToPrecision(code: string, fee: any, networkCode?: any): any;
996
- forceString(value: any): any;
996
+ forceString(value: any): string;
997
997
  isTickPrecision(): boolean;
998
998
  isDecimalPrecision(): boolean;
999
999
  isSignificantPrecision(): boolean;
@@ -1002,7 +1002,7 @@ export default class Exchange {
1002
1002
  parsePrecision(precision?: string): string;
1003
1003
  integerPrecisionToAmount(precision: Str): string;
1004
1004
  loadTimeDifference(params?: {}): Promise<any>;
1005
- implodeHostname(url: string): any;
1005
+ implodeHostname(url: string): string;
1006
1006
  fetchMarketLeverageTiers(symbol: string, params?: {}): Promise<any>;
1007
1007
  createPostOnlyOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
1008
1008
  createPostOnlyOrderWs(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
@@ -332,6 +332,10 @@ export default class Exchange {
332
332
  }
333
333
  this.newUpdates = (this.options.newUpdates !== undefined) ? this.options.newUpdates : true;
334
334
  this.afterConstruct();
335
+ const isSandbox = this.safeBool2(this.options, 'sandbox', 'testnet', false);
336
+ if (isSandbox) {
337
+ this.setSandboxMode(isSandbox);
338
+ }
335
339
  }
336
340
  describe() {
337
341
  return {
@@ -785,6 +789,10 @@ export default class Exchange {
785
789
  }
786
790
  setProxyAgents(httpProxy, httpsProxy, socksProxy) {
787
791
  let chosenAgent = undefined;
792
+ // in browser-side, proxy modules are not supported in 'fetch/ws' methods
793
+ if (!isNode && (httpProxy || httpsProxy || socksProxy)) {
794
+ throw new NotSupported(this.id + ' - proxies in browser-side projects are not supported. You have several choices: [A] Use `exchange.proxyUrl` property to redirect requests through local/remote cors-proxy server (find sample file named "sample-local-proxy-server-with-cors" in https://github.com/ccxt/ccxt/tree/master/examples/ folder, which can be used for REST requests only) [B] override `exchange.fetch` && `exchange.watch` methods to send requests through your custom proxy');
795
+ }
788
796
  if (httpProxy) {
789
797
  if (this.httpProxyAgentModule === undefined) {
790
798
  throw new NotSupported(this.id + ' you need to load JS proxy modules with `.loadProxyModules()` method at first to use proxies');
@@ -3037,15 +3045,15 @@ export default class Exchange {
3037
3045
  // timestamp and symbol operations don't belong in safeTicker
3038
3046
  // they should be done in the derived classes
3039
3047
  return this.extend(ticker, {
3040
- 'bid': this.parseNumber(this.omitZero(this.safeNumber(ticker, 'bid'))),
3048
+ 'bid': this.parseNumber(this.omitZero(this.safeString(ticker, 'bid'))),
3041
3049
  'bidVolume': this.safeNumber(ticker, 'bidVolume'),
3042
- 'ask': this.parseNumber(this.omitZero(this.safeNumber(ticker, 'ask'))),
3050
+ 'ask': this.parseNumber(this.omitZero(this.safeString(ticker, 'ask'))),
3043
3051
  'askVolume': this.safeNumber(ticker, 'askVolume'),
3044
3052
  'high': this.parseNumber(this.omitZero(this.safeString(ticker, 'high'))),
3045
- 'low': this.parseNumber(this.omitZero(this.safeNumber(ticker, 'low'))),
3046
- 'open': this.parseNumber(this.omitZero(this.parseNumber(open))),
3047
- 'close': this.parseNumber(this.omitZero(this.parseNumber(close))),
3048
- 'last': this.parseNumber(this.omitZero(this.parseNumber(last))),
3053
+ 'low': this.parseNumber(this.omitZero(this.safeString(ticker, 'low'))),
3054
+ 'open': this.parseNumber(this.omitZero(open)),
3055
+ 'close': this.parseNumber(this.omitZero(close)),
3056
+ 'last': this.parseNumber(this.omitZero(last)),
3049
3057
  'change': this.parseNumber(change),
3050
3058
  'percentage': this.parseNumber(percentage),
3051
3059
  'average': this.parseNumber(average),
@@ -15,6 +15,7 @@ declare const errorHierarchy: {
15
15
  NoChange: {
16
16
  MarginModeAlreadySet: {};
17
17
  };
18
+ MarketClosed: {};
18
19
  };
19
20
  BadResponse: {
20
21
  NullResponse: {};
@@ -21,6 +21,7 @@ const errorHierarchy = {
21
21
  'NoChange': {
22
22
  'MarginModeAlreadySet': {},
23
23
  },
24
+ 'MarketClosed': {},
24
25
  },
25
26
  'BadResponse': {
26
27
  'NullResponse': {},
@@ -34,6 +34,9 @@ declare class NoChange extends OperationRejected {
34
34
  declare class MarginModeAlreadySet extends NoChange {
35
35
  constructor(message: any);
36
36
  }
37
+ declare class MarketClosed extends OperationRejected {
38
+ constructor(message: any);
39
+ }
37
40
  declare class BadResponse extends ExchangeError {
38
41
  constructor(message: any);
39
42
  }
@@ -106,7 +109,7 @@ declare class InvalidNonce extends NetworkError {
106
109
  declare class RequestTimeout extends NetworkError {
107
110
  constructor(message: any);
108
111
  }
109
- export { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout };
112
+ export { 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 };
110
113
  declare const _default: {
111
114
  BaseError: typeof BaseError;
112
115
  ExchangeError: typeof ExchangeError;
@@ -120,6 +123,7 @@ declare const _default: {
120
123
  OperationRejected: typeof OperationRejected;
121
124
  NoChange: typeof NoChange;
122
125
  MarginModeAlreadySet: typeof MarginModeAlreadySet;
126
+ MarketClosed: typeof MarketClosed;
123
127
  BadResponse: typeof BadResponse;
124
128
  NullResponse: typeof NullResponse;
125
129
  InsufficientFunds: typeof InsufficientFunds;
@@ -77,6 +77,12 @@ class MarginModeAlreadySet extends NoChange {
77
77
  this.name = 'MarginModeAlreadySet';
78
78
  }
79
79
  }
80
+ class MarketClosed extends OperationRejected {
81
+ constructor(message) {
82
+ super(message);
83
+ this.name = 'MarketClosed';
84
+ }
85
+ }
80
86
  class BadResponse extends ExchangeError {
81
87
  constructor(message) {
82
88
  super(message);
@@ -221,5 +227,5 @@ class RequestTimeout extends NetworkError {
221
227
  this.name = 'RequestTimeout';
222
228
  }
223
229
  }
224
- export { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout };
225
- export default { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout };
230
+ export { 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 };
231
+ export default { 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 };
@@ -21,7 +21,7 @@ declare const sortBy: (array: any[], key: IndexType, descending?: boolean, defau
21
21
  declare const sortBy2: (array: any[], key1: IndexType, key2: IndexType, descending?: boolean, direction?: number) => any[];
22
22
  declare const flatten: (x: any[], out?: any[]) => any[];
23
23
  declare const pluck: (x: Dictionary<any>, k: any) => any[];
24
- declare const omit: (x: Dictionary<any>, ...args: any[]) => any;
24
+ declare const omit: (x: Dictionary<any>, ...args: any) => any;
25
25
  declare const sum: (...xs: any[]) => any;
26
26
  declare const deepExtend: (...xs: any) => any;
27
27
  declare const merge: (target: Dictionary<any>, ...args: any) => Dictionary<any>;
@@ -1,7 +1,8 @@
1
+ import { Dictionary, Num } from '../types.js';
1
2
  declare const parseTimeframe: (timeframe: string) => number;
2
- declare const roundTimeframe: (timeframe: any, timestamp: any, direction?: number) => number;
3
- declare const extractParams: (string: any) => any[];
4
- declare const implodeParams: (string: any, params: any) => any;
5
- declare function vwap(baseVolume: any, quoteVolume: any): number;
3
+ declare const roundTimeframe: (timeframe: string, timestamp: number, direction?: number) => number;
4
+ declare const extractParams: (string: string) => string[];
5
+ declare const implodeParams: (string: string, params: Dictionary<any> | any[]) => string;
6
+ declare function vwap(baseVolume: number, quoteVolume: number): Num;
6
7
  declare function aggregate(bidasks: any): number[][];
7
8
  export { aggregate, parseTimeframe, roundTimeframe, implodeParams, extractParams, vwap, };
@@ -82,10 +82,10 @@ function aggregate(bidasks) {
82
82
  for (let i = 0; i < bidasks.length; i++) {
83
83
  const [price, volume] = bidasks[i];
84
84
  if (volume > 0) {
85
- result[price] = (result[price] || 0) + volume;
85
+ result[price] = (result[price] || 0) + volume; // TODO: Element implicitly has an 'any' type because expression of type 'any' can't be used to index type '{}'.ts(7053)
86
86
  }
87
87
  }
88
- return Object.keys(result).map((price) => [parseFloat(price), parseFloat(result[price])]);
88
+ return Object.keys(result).map((price) => [parseFloat(price), parseFloat(result[price])]); // TODO: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}', No index signature with a parameter of type 'string' was found on type '{}'.ts(7053)
89
89
  }
90
90
  export { aggregate, parseTimeframe, roundTimeframe, implodeParams, extractParams, vwap, };
91
91
  /* ------------------------------------------------------------------------ */
@@ -18,10 +18,10 @@ declare const precisionConstants: {
18
18
  NO_PADDING: number;
19
19
  PAD_WITH_ZERO: number;
20
20
  };
21
- declare function numberToString(x: any): any;
22
- declare const truncate_to_string: (num: any, precision?: number) => any;
23
- declare const truncate: (num: any, precision?: number) => number;
24
- declare function precisionFromString(str: any): any;
21
+ declare function numberToString(x: any): string | undefined;
22
+ declare const truncate_to_string: (num: number | string, precision?: number) => string;
23
+ declare const truncate: (num: number | string, precision?: number) => number;
24
+ declare function precisionFromString(str: string): number;
25
25
  declare const decimalToPrecision: (x: any, roundingMode: any, numPrecisionDigits: any, countingMode?: number, paddingMode?: number) => any;
26
- declare function omitZero(stringNumber: any): any;
26
+ declare function omitZero(stringNumber: string): string;
27
27
  export { numberToString, precisionFromString, decimalToPrecision, truncate_to_string, truncate, omitZero, precisionConstants, ROUND, TRUNCATE, ROUND_UP, ROUND_DOWN, DECIMAL_PLACES, SIGNIFICANT_DIGITS, TICK_SIZE, NO_PADDING, PAD_WITH_ZERO, };