ccxt 4.3.1 → 4.3.3

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 +6 -5
  2. package/dist/cjs/ccxt.js +1 -1
  3. package/dist/cjs/src/base/Exchange.js +25 -0
  4. package/dist/cjs/src/binance.js +320 -21
  5. package/dist/cjs/src/bingx.js +2 -2
  6. package/dist/cjs/src/bitget.js +81 -4
  7. package/dist/cjs/src/coinbase.js +11 -2
  8. package/dist/cjs/src/coinbasepro.js +1 -1
  9. package/dist/cjs/src/coinex.js +109 -146
  10. package/dist/cjs/src/cryptocom.js +5 -5
  11. package/dist/cjs/src/hyperliquid.js +161 -13
  12. package/dist/cjs/src/okx.js +116 -0
  13. package/dist/cjs/src/poloniexfutures.js +12 -2
  14. package/dist/cjs/src/pro/hyperliquid.js +8 -7
  15. package/dist/cjs/src/pro/kraken.js +1 -1
  16. package/dist/cjs/src/pro/wazirx.js +2 -1
  17. package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +27 -2
  18. package/dist/cjs/src/woo.js +110 -6
  19. package/js/ccxt.d.ts +1 -1
  20. package/js/ccxt.js +1 -1
  21. package/js/src/base/Exchange.d.ts +3 -1
  22. package/js/src/base/Exchange.js +25 -0
  23. package/js/src/base/types.d.ts +5 -0
  24. package/js/src/binance.d.ts +3 -0
  25. package/js/src/binance.js +320 -21
  26. package/js/src/bingx.js +3 -3
  27. package/js/src/bitget.d.ts +1 -0
  28. package/js/src/bitget.js +81 -4
  29. package/js/src/coinbase.js +11 -2
  30. package/js/src/coinbasepro.js +1 -1
  31. package/js/src/coinex.js +109 -146
  32. package/js/src/cryptocom.js +5 -5
  33. package/js/src/hyperliquid.d.ts +3 -1
  34. package/js/src/hyperliquid.js +162 -14
  35. package/js/src/okx.d.ts +2 -0
  36. package/js/src/okx.js +116 -0
  37. package/js/src/poloniexfutures.js +12 -2
  38. package/js/src/pro/hyperliquid.js +8 -7
  39. package/js/src/pro/kraken.js +1 -1
  40. package/js/src/pro/wazirx.js +2 -1
  41. package/js/src/static_dependencies/jsencrypt/JSEncryptRSAKey.d.ts +2 -2
  42. package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.d.ts +24 -357
  43. package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +27 -0
  44. package/js/src/woo.d.ts +2 -0
  45. package/js/src/woo.js +110 -6
  46. package/package.json +1 -1
package/js/src/bingx.js CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  // ---------------------------------------------------------------------------
8
8
  import Exchange from './abstract/bingx.js';
9
- import { AuthenticationError, PermissionDenied, AccountSuspended, ExchangeError, InsufficientFunds, BadRequest, OrderNotFound, DDoSProtection, BadSymbol, ArgumentsRequired, NotSupported, ExchangeNotAvailable } from './base/errors.js';
9
+ import { AuthenticationError, PermissionDenied, AccountSuspended, ExchangeError, InsufficientFunds, BadRequest, OrderNotFound, DDoSProtection, BadSymbol, ArgumentsRequired, NotSupported, OperationFailed } from './base/errors.js';
10
10
  import { Precise } from './base/Precise.js';
11
11
  import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
12
12
  import { DECIMAL_PLACES } from './base/functions/number.js';
@@ -387,7 +387,7 @@ export default class bingx extends Exchange {
387
387
  '100400': BadRequest,
388
388
  '100421': BadSymbol,
389
389
  '100440': ExchangeError,
390
- '100500': ExchangeNotAvailable,
390
+ '100500': OperationFailed,
391
391
  '100503': ExchangeError,
392
392
  '80001': BadRequest,
393
393
  '80012': InsufficientFunds,
@@ -397,7 +397,7 @@ export default class bingx extends Exchange {
397
397
  '100414': AccountSuspended,
398
398
  '100419': PermissionDenied,
399
399
  '100437': BadRequest,
400
- '101204': InsufficientFunds, // bingx {"code":101204,"msg":"","data":{}}
400
+ '101204': InsufficientFunds, // {"code":101204,"msg":"","data":{}}
401
401
  },
402
402
  'broad': {},
403
403
  },
@@ -284,6 +284,7 @@ export default class bitget extends Exchange {
284
284
  parseMarginMode(marginMode: any, market?: any): MarginMode;
285
285
  fetchConvertQuote(fromCode: string, toCode: string, amount?: Num, params?: {}): Promise<Conversion>;
286
286
  createConvertTrade(id: string, fromCode: string, toCode: string, amount?: Num, params?: {}): Promise<Conversion>;
287
+ fetchConvertTradeHistory(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Conversion[]>;
287
288
  parseConversion(conversion: any, fromCurrency?: Currency, toCurrency?: Currency): Conversion;
288
289
  fetchConvertCurrencies(params?: {}): Promise<Currencies>;
289
290
  handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
package/js/src/bitget.js CHANGED
@@ -69,6 +69,8 @@ export default class bitget extends Exchange {
69
69
  'fetchClosedOrders': true,
70
70
  'fetchConvertCurrencies': true,
71
71
  'fetchConvertQuote': true,
72
+ 'fetchConvertTrade': false,
73
+ 'fetchConvertTradeHistory': true,
72
74
  'fetchCrossBorrowRate': true,
73
75
  'fetchCrossBorrowRates': false,
74
76
  'fetchCurrencies': true,
@@ -8542,6 +8544,66 @@ export default class bitget extends Exchange {
8542
8544
  const toCurrency = this.currency(toCurrencyId);
8543
8545
  return this.parseConversion(data, undefined, toCurrency);
8544
8546
  }
8547
+ async fetchConvertTradeHistory(code = undefined, since = undefined, limit = undefined, params = {}) {
8548
+ /**
8549
+ * @method
8550
+ * @name bitget#fetchConvertTradeHistory
8551
+ * @description fetch the users history of conversion trades
8552
+ * @see https://www.bitget.com/api-doc/common/convert/Get-Convert-Record
8553
+ * @param {string} [code] the unified currency code
8554
+ * @param {int} [since] the earliest time in ms to fetch conversions for
8555
+ * @param {int} [limit] the maximum number of conversion structures to retrieve
8556
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
8557
+ * @returns {object[]} a list of [conversion structures]{@link https://docs.ccxt.com/#/?id=conversion-structure}
8558
+ */
8559
+ await this.loadMarkets();
8560
+ const request = {};
8561
+ const msInDay = 86400000;
8562
+ const now = this.milliseconds();
8563
+ if (since !== undefined) {
8564
+ request['startTime'] = since;
8565
+ }
8566
+ else {
8567
+ request['startTime'] = now - msInDay;
8568
+ }
8569
+ const endTime = this.safeString2(params, 'endTime', 'until');
8570
+ if (endTime !== undefined) {
8571
+ request['endTime'] = endTime;
8572
+ }
8573
+ else {
8574
+ request['endTime'] = now;
8575
+ }
8576
+ if (limit !== undefined) {
8577
+ request['limit'] = limit;
8578
+ }
8579
+ params = this.omit(params, 'until');
8580
+ const response = await this.privateConvertGetV2ConvertConvertRecord(this.extend(request, params));
8581
+ //
8582
+ // {
8583
+ // "code": "00000",
8584
+ // "msg": "success",
8585
+ // "requestTime": 1712124371799,
8586
+ // "data": {
8587
+ // "dataList": [
8588
+ // {
8589
+ // "id": "1159296505255219205",
8590
+ // "fromCoin": "USDT",
8591
+ // "fromCoinSize": "5",
8592
+ // "cnvtPrice": "0.99940076",
8593
+ // "toCoin": "USDC",
8594
+ // "toCoinSize": "4.99700379",
8595
+ // "ts": "1712123746217",
8596
+ // "fee": "0"
8597
+ // }
8598
+ // ],
8599
+ // "endId": "1159296505255219205"
8600
+ // }
8601
+ // }
8602
+ //
8603
+ const data = this.safeDict(response, 'data', {});
8604
+ const dataList = this.safeList(data, 'dataList', []);
8605
+ return this.parseConversions(dataList, 'fromCoin', 'toCoin', since, limit);
8606
+ }
8545
8607
  parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
8546
8608
  //
8547
8609
  // fetchConvertQuote
@@ -8565,6 +8627,19 @@ export default class bitget extends Exchange {
8565
8627
  // "ts": "1712123746217"
8566
8628
  // }
8567
8629
  //
8630
+ // fetchConvertTradeHistory
8631
+ //
8632
+ // {
8633
+ // "id": "1159296505255219205",
8634
+ // "fromCoin": "USDT",
8635
+ // "fromCoinSize": "5",
8636
+ // "cnvtPrice": "0.99940076",
8637
+ // "toCoin": "USDC",
8638
+ // "toCoinSize": "4.99700379",
8639
+ // "ts": "1712123746217",
8640
+ // "fee": "0"
8641
+ // }
8642
+ //
8568
8643
  const timestamp = this.safeInteger(conversion, 'ts');
8569
8644
  const fromCoin = this.safeString(conversion, 'fromCoin');
8570
8645
  const fromCode = this.safeCurrencyCode(fromCoin, fromCurrency);
@@ -8574,7 +8649,7 @@ export default class bitget extends Exchange {
8574
8649
  'info': conversion,
8575
8650
  'timestamp': timestamp,
8576
8651
  'datetime': this.iso8601(timestamp),
8577
- 'id': this.safeString(conversion, 'traceId'),
8652
+ 'id': this.safeString2(conversion, 'id', 'traceId'),
8578
8653
  'fromCurrency': fromCode,
8579
8654
  'fromAmount': this.safeNumber(conversion, 'fromCoinSize'),
8580
8655
  'toCurrency': toCode,
@@ -8653,6 +8728,8 @@ export default class bitget extends Exchange {
8653
8728
  //
8654
8729
  // spot
8655
8730
  //
8731
+ // {"code":"00000","msg":"success","requestTime":1713294492511,"data":[...]}"
8732
+ //
8656
8733
  // {"status":"fail","err_code":"01001","err_msg":"系统异常,请稍后重试"}
8657
8734
  // {"status":"error","ts":1595594160149,"err_code":"invalid-parameter","err_msg":"invalid size, valid range: [1,2000]"}
8658
8735
  // {"status":"error","ts":1595684716042,"err_code":"invalid-parameter","err_msg":"illegal sign invalid"}
@@ -8674,14 +8751,14 @@ export default class bitget extends Exchange {
8674
8751
  // {"code":"40108","msg":"","requestTime":1595885064600,"data":null}
8675
8752
  // {"order_id":"513468410013679613","client_oid":null,"symbol":"ethusd","result":false,"err_code":"order_no_exist_error","err_msg":"订单不存在!"}
8676
8753
  //
8677
- const message = this.safeString(response, 'err_msg');
8678
- const errorCode = this.safeString2(response, 'code', 'err_code');
8754
+ const message = this.safeString2(response, 'err_msg', 'msg');
8679
8755
  const feedback = this.id + ' ' + body;
8680
- const nonEmptyMessage = ((message !== undefined) && (message !== ''));
8756
+ const nonEmptyMessage = ((message !== undefined) && (message !== '') && (message !== 'success'));
8681
8757
  if (nonEmptyMessage) {
8682
8758
  this.throwExactlyMatchedException(this.exceptions['exact'], message, feedback);
8683
8759
  this.throwBroadlyMatchedException(this.exceptions['broad'], message, feedback);
8684
8760
  }
8761
+ const errorCode = this.safeString2(response, 'code', 'err_code');
8685
8762
  const nonZeroErrorCode = (errorCode !== undefined) && (errorCode !== '00000');
8686
8763
  if (nonZeroErrorCode) {
8687
8764
  this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);
@@ -20,9 +20,10 @@ export default class coinbase extends Exchange {
20
20
  describe() {
21
21
  return this.deepExtend(super.describe(), {
22
22
  'id': 'coinbase',
23
- 'name': 'Coinbase',
23
+ 'name': 'Coinbase Advanced',
24
24
  'countries': ['US'],
25
25
  'pro': true,
26
+ 'certified': true,
26
27
  // rate-limits:
27
28
  // ADVANCED API: https://docs.cloud.coinbase.com/advanced-trade-api/docs/rest-api-rate-limits
28
29
  // - max 30 req/second for private data, 10 req/s for public data
@@ -2591,7 +2592,7 @@ export default class coinbase extends Exchange {
2591
2592
  * @param {float} [params.stopLossPrice] price to trigger stop-loss orders
2592
2593
  * @param {float} [params.takeProfitPrice] price to trigger take-profit orders
2593
2594
  * @param {bool} [params.postOnly] true or false
2594
- * @param {string} [params.timeInForce] 'GTC', 'IOC', 'GTD' or 'PO'
2595
+ * @param {string} [params.timeInForce] 'GTC', 'IOC', 'GTD' or 'PO', 'FOK'
2595
2596
  * @param {string} [params.stop_direction] 'UNKNOWN_STOP_DIRECTION', 'STOP_DIRECTION_STOP_UP', 'STOP_DIRECTION_STOP_DOWN' the direction the stopPrice is triggered from
2596
2597
  * @param {string} [params.end_time] '2023-05-25T17:01:05.092Z' for 'GTD' orders
2597
2598
  * @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
@@ -2696,6 +2697,14 @@ export default class coinbase extends Exchange {
2696
2697
  },
2697
2698
  };
2698
2699
  }
2700
+ else if (timeInForce === 'FOK') {
2701
+ request['order_configuration'] = {
2702
+ 'limit_limit_fok': {
2703
+ 'base_size': this.amountToPrecision(symbol, amount),
2704
+ 'limit_price': this.priceToPrecision(symbol, price),
2705
+ },
2706
+ };
2707
+ }
2699
2708
  else {
2700
2709
  request['order_configuration'] = {
2701
2710
  'limit_limit_gtc': {
@@ -19,7 +19,7 @@ export default class coinbasepro extends Exchange {
19
19
  describe() {
20
20
  return this.deepExtend(super.describe(), {
21
21
  'id': 'coinbasepro',
22
- 'name': 'Coinbase Pro',
22
+ 'name': 'Coinbase Pro(Deprecated)',
23
23
  'countries': ['US'],
24
24
  'rateLimit': 100,
25
25
  'userAgent': this.userAgents['chrome'],
package/js/src/coinex.js CHANGED
@@ -815,65 +815,59 @@ export default class coinex extends Exchange {
815
815
  // Spot fetchTicker, fetchTickers
816
816
  //
817
817
  // {
818
- // "vol": "293.19415130",
819
- // "low": "38200.00",
820
- // "open": "39514.99",
821
- // "high": "39530.00",
822
- // "last": "38649.57",
823
- // "buy": "38640.20",
824
- // "buy_amount": "0.22800000",
825
- // "sell": "38640.21",
826
- // "sell_amount": "0.02828439"
818
+ // "close": "62393.47",
819
+ // "high": "64106.41",
820
+ // "last": "62393.47",
821
+ // "low": "59650.01",
822
+ // "market": "BTCUSDT",
823
+ // "open": "61616.15",
824
+ // "period": 86400,
825
+ // "value": "28711273.4065667262",
826
+ // "volume": "461.76557205",
827
+ // "volume_buy": "11.41506354",
828
+ // "volume_sell": "7.3240169"
827
829
  // }
828
830
  //
829
831
  // Swap fetchTicker, fetchTickers
830
832
  //
831
833
  // {
832
- // "vol": "7714.2175",
833
- // "low": "38200.00",
834
- // "open": "39569.23",
835
- // "high": "39569.23",
836
- // "last": "38681.37",
837
- // "buy": "38681.36",
834
+ // "close": "62480.08",
835
+ // "high": "64100",
836
+ // "index_price": "62443.05",
837
+ // "last": "62480.08",
838
+ // "low": "59600",
839
+ // "mark_price": "62443.05",
840
+ // "market": "BTCUSDT",
841
+ // "open": "61679.98",
838
842
  // "period": 86400,
839
- // "funding_time": 462,
840
- // "position_amount": "296.7552",
841
- // "funding_rate_last": "0.00009395",
842
- // "funding_rate_next": "0.00000649",
843
- // "funding_rate_predict": "-0.00007176",
844
- // "insurance": "16464465.09431942163278132918",
845
- // "sign_price": "38681.93",
846
- // "index_price": "38681.69500000",
847
- // "sell_total": "16.6039",
848
- // "buy_total": "19.8481",
849
- // "buy_amount": "4.6315",
850
- // "sell": "38681.37",
851
- // "sell_amount": "11.4044"
843
+ // "value": "180226025.69791713065326633165",
844
+ // "volume": "2900.2218",
845
+ // "volume_buy": "7.3847",
846
+ // "volume_sell": "6.1249"
852
847
  // }
853
848
  //
854
- const timestamp = this.safeInteger(ticker, 'date');
855
- const symbol = this.safeSymbol(undefined, market);
856
- ticker = this.safeValue(ticker, 'ticker', {});
857
- const last = this.safeString(ticker, 'last');
849
+ const marketType = ('mark_price' in ticker) ? 'swap' : 'spot';
850
+ const marketId = this.safeString(ticker, 'market');
851
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
858
852
  return this.safeTicker({
859
853
  'symbol': symbol,
860
- 'timestamp': timestamp,
861
- 'datetime': this.iso8601(timestamp),
854
+ 'timestamp': undefined,
855
+ 'datetime': undefined,
862
856
  'high': this.safeString(ticker, 'high'),
863
857
  'low': this.safeString(ticker, 'low'),
864
- 'bid': this.safeString(ticker, 'buy'),
865
- 'bidVolume': this.safeString(ticker, 'buy_amount'),
866
- 'ask': this.safeString(ticker, 'sell'),
867
- 'askVolume': this.safeString(ticker, 'sell_amount'),
858
+ 'bid': undefined,
859
+ 'bidVolume': this.safeString(ticker, 'volume_buy'),
860
+ 'ask': undefined,
861
+ 'askVolume': this.safeString(ticker, 'volume_sell'),
868
862
  'vwap': undefined,
869
863
  'open': this.safeString(ticker, 'open'),
870
- 'close': last,
871
- 'last': last,
864
+ 'close': this.safeString(ticker, 'close'),
865
+ 'last': this.safeString(ticker, 'last'),
872
866
  'previousClose': undefined,
873
867
  'change': undefined,
874
868
  'percentage': undefined,
875
869
  'average': undefined,
876
- 'baseVolume': this.safeString2(ticker, 'vol', 'volume'),
870
+ 'baseVolume': this.safeString(ticker, 'volume'),
877
871
  'quoteVolume': undefined,
878
872
  'info': ticker,
879
873
  }, market);
@@ -883,8 +877,8 @@ export default class coinex extends Exchange {
883
877
  * @method
884
878
  * @name coinex#fetchTicker
885
879
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
886
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market007_single_market_ticker
887
- * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http008_market_ticker
880
+ * @see https://docs.coinex.com/api/v2/spot/market/http/list-market-ticker
881
+ * @see https://docs.coinex.com/api/v2/futures/market/http/list-market-ticker
888
882
  * @param {string} symbol unified symbol of the market to fetch the ticker for
889
883
  * @param {object} [params] extra parameters specific to the exchange API endpoint
890
884
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -896,30 +890,31 @@ export default class coinex extends Exchange {
896
890
  };
897
891
  let response = undefined;
898
892
  if (market['swap']) {
899
- response = await this.v1PerpetualPublicGetMarketTicker(this.extend(request, params));
893
+ response = await this.v2PublicGetFuturesTicker(this.extend(request, params));
900
894
  }
901
895
  else {
902
- response = await this.v1PublicGetMarketTicker(this.extend(request, params));
896
+ response = await this.v2PublicGetSpotTicker(this.extend(request, params));
903
897
  }
904
898
  //
905
899
  // Spot
906
900
  //
907
901
  // {
908
902
  // "code": 0,
909
- // "data": {
910
- // "date": 1651306913414,
911
- // "ticker": {
912
- // "vol": "293.19415130",
913
- // "low": "38200.00",
914
- // "open": "39514.99",
915
- // "high": "39530.00",
916
- // "last": "38649.57",
917
- // "buy": "38640.20",
918
- // "buy_amount": "0.22800000",
919
- // "sell": "38640.21",
920
- // "sell_amount": "0.02828439"
903
+ // "data": [
904
+ // {
905
+ // "close": "62393.47",
906
+ // "high": "64106.41",
907
+ // "last": "62393.47",
908
+ // "low": "59650.01",
909
+ // "market": "BTCUSDT",
910
+ // "open": "61616.15",
911
+ // "period": 86400,
912
+ // "value": "28711273.4065667262",
913
+ // "volume": "461.76557205",
914
+ // "volume_buy": "11.41506354",
915
+ // "volume_sell": "7.3240169"
921
916
  // }
922
- // },
917
+ // ],
923
918
  // "message": "OK"
924
919
  // }
925
920
  //
@@ -927,43 +922,37 @@ export default class coinex extends Exchange {
927
922
  //
928
923
  // {
929
924
  // "code": 0,
930
- // "data": {
931
- // "date": 1651306641500,
932
- // "ticker": {
933
- // "vol": "7714.2175",
934
- // "low": "38200.00",
935
- // "open": "39569.23",
936
- // "high": "39569.23",
937
- // "last": "38681.37",
938
- // "buy": "38681.36",
925
+ // "data": [
926
+ // {
927
+ // "close": "62480.08",
928
+ // "high": "64100",
929
+ // "index_price": "62443.05",
930
+ // "last": "62480.08",
931
+ // "low": "59600",
932
+ // "mark_price": "62443.05",
933
+ // "market": "BTCUSDT",
934
+ // "open": "61679.98",
939
935
  // "period": 86400,
940
- // "funding_time": 462,
941
- // "position_amount": "296.7552",
942
- // "funding_rate_last": "0.00009395",
943
- // "funding_rate_next": "0.00000649",
944
- // "funding_rate_predict": "-0.00007176",
945
- // "insurance": "16464465.09431942163278132918",
946
- // "sign_price": "38681.93",
947
- // "index_price": "38681.69500000",
948
- // "sell_total": "16.6039",
949
- // "buy_total": "19.8481",
950
- // "buy_amount": "4.6315",
951
- // "sell": "38681.37",
952
- // "sell_amount": "11.4044"
936
+ // "value": "180226025.69791713065326633165",
937
+ // "volume": "2900.2218",
938
+ // "volume_buy": "7.3847",
939
+ // "volume_sell": "6.1249"
953
940
  // }
954
- // },
941
+ // ],
955
942
  // "message": "OK"
956
943
  // }
957
944
  //
958
- return this.parseTicker(response['data'], market);
945
+ const data = this.safeList(response, 'data', []);
946
+ const result = this.safeDict(data, 0, {});
947
+ return this.parseTicker(result, market);
959
948
  }
960
949
  async fetchTickers(symbols = undefined, params = {}) {
961
950
  /**
962
951
  * @method
963
952
  * @name coinex#fetchTickers
964
953
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
965
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market008_all_market_ticker
966
- * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http009_market_ticker_all
954
+ * @see https://docs.coinex.com/api/v2/spot/market/http/list-market-ticker
955
+ * @see https://docs.coinex.com/api/v2/futures/market/http/list-market-ticker
967
956
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
968
957
  * @param {object} [params] extra parameters specific to the exchange API endpoint
969
958
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -978,86 +967,60 @@ export default class coinex extends Exchange {
978
967
  const [marketType, query] = this.handleMarketTypeAndParams('fetchTickers', market, params);
979
968
  let response = undefined;
980
969
  if (marketType === 'swap') {
981
- response = await this.v1PerpetualPublicGetMarketTickerAll(query);
970
+ response = await this.v2PublicGetFuturesTicker(query);
982
971
  }
983
972
  else {
984
- response = await this.v1PublicGetMarketTickerAll();
973
+ response = await this.v2PublicGetSpotTicker(query);
985
974
  }
986
975
  //
987
976
  // Spot
988
977
  //
989
978
  // {
990
979
  // "code": 0,
991
- // "data": {
992
- // "date": 1651519857284,
993
- // "ticker": {
994
- // "PSPUSDT": {
995
- // "vol": "127131.55227034",
996
- // "low": "0.0669",
997
- // "open": "0.0688",
998
- // "high": "0.0747",
999
- // "last": "0.0685",
1000
- // "buy": "0.0676",
1001
- // "buy_amount": "702.70117866",
1002
- // "sell": "0.0690",
1003
- // "sell_amount": "686.76861562"
1004
- // },
980
+ // "data": [
981
+ // {
982
+ // "close": "62393.47",
983
+ // "high": "64106.41",
984
+ // "last": "62393.47",
985
+ // "low": "59650.01",
986
+ // "market": "BTCUSDT",
987
+ // "open": "61616.15",
988
+ // "period": 86400,
989
+ // "value": "28711273.4065667262",
990
+ // "volume": "461.76557205",
991
+ // "volume_buy": "11.41506354",
992
+ // "volume_sell": "7.3240169"
1005
993
  // }
1006
- // },
1007
- // "message": "Ok"
994
+ // ],
995
+ // "message": "OK"
1008
996
  // }
1009
997
  //
1010
998
  // Swap
1011
999
  //
1012
1000
  // {
1013
1001
  // "code": 0,
1014
- // "data": {
1015
- // "date": 1651520268644,
1016
- // "ticker": {
1017
- // "KAVAUSDT": {
1018
- // "vol": "834924",
1019
- // "low": "3.9418",
1020
- // "open": "4.1834",
1021
- // "high": "4.4328",
1022
- // "last": "4.0516",
1023
- // "buy": "4.0443",
1024
- // "period": 86400,
1025
- // "funding_time": 262,
1026
- // "position_amount": "16111",
1027
- // "funding_rate_last": "-0.00069514",
1028
- // "funding_rate_next": "-0.00061009",
1029
- // "funding_rate_predict": "-0.00055812",
1030
- // "insurance": "16532425.53026084124483989548",
1031
- // "sign_price": "4.0516",
1032
- // "index_price": "4.0530",
1033
- // "sell_total": "59446",
1034
- // "buy_total": "62423",
1035
- // "buy_amount": "959",
1036
- // "sell": "4.0466",
1037
- // "sell_amount": "141"
1038
- // },
1002
+ // "data": [
1003
+ // {
1004
+ // "close": "62480.08",
1005
+ // "high": "64100",
1006
+ // "index_price": "62443.05",
1007
+ // "last": "62480.08",
1008
+ // "low": "59600",
1009
+ // "mark_price": "62443.05",
1010
+ // "market": "BTCUSDT",
1011
+ // "open": "61679.98",
1012
+ // "period": 86400,
1013
+ // "value": "180226025.69791713065326633165",
1014
+ // "volume": "2900.2218",
1015
+ // "volume_buy": "7.3847",
1016
+ // "volume_sell": "6.1249"
1039
1017
  // }
1040
- // },
1041
- // "message": "Ok"
1018
+ // ],
1019
+ // "message": "OK"
1042
1020
  // }
1043
1021
  //
1044
- const data = this.safeValue(response, 'data');
1045
- const timestamp = this.safeInteger(data, 'date');
1046
- const tickers = this.safeValue(data, 'ticker', {});
1047
- const marketIds = Object.keys(tickers);
1048
- const result = {};
1049
- for (let i = 0; i < marketIds.length; i++) {
1050
- const marketId = marketIds[i];
1051
- const marketInner = this.safeMarket(marketId, undefined, undefined, marketType);
1052
- const symbol = marketInner['symbol'];
1053
- const ticker = this.parseTicker({
1054
- 'date': timestamp,
1055
- 'ticker': tickers[marketId],
1056
- }, marketInner);
1057
- ticker['symbol'] = symbol;
1058
- result[symbol] = ticker;
1059
- }
1060
- return this.filterByArrayTickers(result, 'symbol', symbols);
1022
+ const data = this.safeList(response, 'data', []);
1023
+ return this.parseTickers(data, symbols);
1061
1024
  }
1062
1025
  async fetchTime(params = {}) {
1063
1026
  /**
@@ -1628,7 +1628,7 @@ export default class cryptocom extends Exchange {
1628
1628
  */
1629
1629
  [tag, params] = this.handleWithdrawTagAndParams(tag, params);
1630
1630
  await this.loadMarkets();
1631
- const currency = this.currency(code);
1631
+ const currency = this.safeCurrency(code); // for instance, USDC is not inferred from markets but it's still available
1632
1632
  const request = {
1633
1633
  'currency': currency['id'],
1634
1634
  'amount': amount,
@@ -1674,7 +1674,7 @@ export default class cryptocom extends Exchange {
1674
1674
  * @returns {object} a dictionary of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure} indexed by the network
1675
1675
  */
1676
1676
  await this.loadMarkets();
1677
- const currency = this.currency(code);
1677
+ const currency = this.safeCurrency(code);
1678
1678
  const request = {
1679
1679
  'currency': currency['id'],
1680
1680
  };
@@ -1773,7 +1773,7 @@ export default class cryptocom extends Exchange {
1773
1773
  let currency = undefined;
1774
1774
  const request = {};
1775
1775
  if (code !== undefined) {
1776
- currency = this.currency(code);
1776
+ currency = this.safeCurrency(code);
1777
1777
  request['currency'] = currency['id'];
1778
1778
  }
1779
1779
  if (since !== undefined) {
@@ -1832,7 +1832,7 @@ export default class cryptocom extends Exchange {
1832
1832
  let currency = undefined;
1833
1833
  const request = {};
1834
1834
  if (code !== undefined) {
1835
- currency = this.currency(code);
1835
+ currency = this.safeCurrency(code);
1836
1836
  request['currency'] = currency['id'];
1837
1837
  }
1838
1838
  if (since !== undefined) {
@@ -2348,7 +2348,7 @@ export default class cryptocom extends Exchange {
2348
2348
  const request = {};
2349
2349
  let currency = undefined;
2350
2350
  if (code !== undefined) {
2351
- currency = this.currency(code);
2351
+ currency = this.safeCurrency(code);
2352
2352
  }
2353
2353
  if (since !== undefined) {
2354
2354
  request['start_time'] = since;
@@ -1,5 +1,5 @@
1
1
  import Exchange from './abstract/hyperliquid.js';
2
- import type { Market, TransferEntry, Balances, Int, OrderBook, OHLCV, Str, FundingRateHistory, Order, OrderType, OrderSide, Trade, Strings, Position, OrderRequest, Dict, Num, MarginModification, Currencies } from './base/types.js';
2
+ import type { Market, TransferEntry, Balances, Int, OrderBook, OHLCV, Str, FundingRateHistory, Order, OrderType, OrderSide, Trade, Strings, Position, OrderRequest, Dict, Num, MarginModification, Currencies, CancellationRequest } from './base/types.js';
3
3
  /**
4
4
  * @class hyperliquid
5
5
  * @augments Exchange
@@ -55,6 +55,7 @@ export default class hyperliquid extends Exchange {
55
55
  createOrders(orders: OrderRequest[], params?: {}): Promise<Order[]>;
56
56
  cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
57
57
  cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<any>;
58
+ cancelOrdersForSymbols(orders: CancellationRequest[], params?: {}): Promise<any>;
58
59
  editOrder(id: string, symbol: string, type: string, side: string, amount?: Num, price?: Num, params?: {}): Promise<Order>;
59
60
  fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
60
61
  fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
@@ -78,6 +79,7 @@ export default class hyperliquid extends Exchange {
78
79
  withdraw(code: string, amount: any, address: any, tag?: any, params?: {}): Promise<any>;
79
80
  formatVaultAddress(address?: Str): string;
80
81
  handlePublicAddress(methodName: string, params: Dict): any[];
82
+ coinToMarketId(coin: Str): string;
81
83
  handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
82
84
  sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
83
85
  url: string;