ccxt 4.3.1 → 4.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -41,6 +41,7 @@ Current feature list:
41
41
  | [![bitmart](https://user-images.githubusercontent.com/1294454/129991357-8f47464b-d0f4-41d6-8a82-34122f0d1398.jpg)](http://www.bitmart.com/?r=rQCFLh) | bitmart | [BitMart](http://www.bitmart.com/?r=rQCFLh) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://developer-pro.bitmart.com/) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | [![Sign up with BitMart using CCXT's referral link for a 30% discount!](https://img.shields.io/static/v1?label=Fee&message=%2d30%25&color=orange)](http://www.bitmart.com/?r=rQCFLh) |
42
42
  | [![bitmex](https://github.com/ccxt/ccxt/assets/43336371/cea9cfe5-c57e-4b84-b2ac-77b960b04445)](https://www.bitmex.com/app/register/NZTR1q) | bitmex | [BitMEX](https://www.bitmex.com/app/register/NZTR1q) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://www.bitmex.com/app/apiOverview) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | [![Sign up with BitMEX using CCXT's referral link for a 10% discount!](https://img.shields.io/static/v1?label=Fee&message=%2d10%25&color=orange)](https://www.bitmex.com/app/register/NZTR1q) |
43
43
  | [![bybit](https://user-images.githubusercontent.com/51840849/76547799-daff5b80-649e-11ea-87fb-3be9bac08954.jpg)](https://www.bybit.com/register?affiliate_id=35953) | bybit | [Bybit](https://www.bybit.com/register?affiliate_id=35953) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://bybit-exchange.github.io/docs/inverse/) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | |
44
+ | [![coinbase](https://user-images.githubusercontent.com/1294454/40811661-b6eceae2-653a-11e8-829e-10bfadb078cf.jpg)](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | coinbase | [Coinbase Advanced](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://developers.coinbase.com/api/v2) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | |
44
45
  | [![coinbaseinternational](https://github.com/ccxt/ccxt/assets/43336371/866ae638-6ab5-4ebf-ab2c-cdcce9545625)](https://international.coinbase.com) | coinbaseinternational | [Coinbase International](https://international.coinbase.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.cloud.coinbase.com/intx/docs) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | |
45
46
  | [![coinex](https://user-images.githubusercontent.com/51840849/87182089-1e05fa00-c2ec-11ea-8da9-cc73b45abbbc.jpg)](https://www.coinex.com/register?refer_code=yw5fz) | coinex | [CoinEx](https://www.coinex.com/register?refer_code=yw5fz) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.coinex.com/api/v2) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | |
46
47
  | [![cryptocom](https://user-images.githubusercontent.com/1294454/147792121-38ed5e36-c229-48d6-b49a-48d05fc19ed4.jpeg)](https://crypto.com/exch/kdacthrnxt) | cryptocom | [Crypto.com](https://crypto.com/exch/kdacthrnxt) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) | [![Sign up with Crypto.com using CCXT's referral link for a 15% discount!](https://img.shields.io/static/v1?label=Fee&message=%2d15%25&color=orange)](https://crypto.com/exch/kdacthrnxt) |
@@ -93,9 +94,9 @@ The CCXT library currently supports the following 97 cryptocurrency exchange mar
93
94
  | [![btcturk](https://user-images.githubusercontent.com/51840849/87153926-efbef500-c2c0-11ea-9842-05b63612c4b9.jpg)](https://www.btcturk.com) | btcturk | [BTCTurk](https://www.btcturk.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://github.com/BTCTrader/broker-api-docs) | | |
94
95
  | [![bybit](https://user-images.githubusercontent.com/51840849/76547799-daff5b80-649e-11ea-87fb-3be9bac08954.jpg)](https://www.bybit.com/register?affiliate_id=35953) | bybit | [Bybit](https://www.bybit.com/register?affiliate_id=35953) | [![API Version 5](https://img.shields.io/badge/5-lightgray)](https://bybit-exchange.github.io/docs/inverse/) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
95
96
  | [![cex](https://user-images.githubusercontent.com/1294454/27766442-8ddc33b0-5ed8-11e7-8b98-f786aef0f3c9.jpg)](https://cex.io/r/0/up105393824/0/) | cex | [CEX.IO](https://cex.io/r/0/up105393824/0/) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://cex.io/cex-api) | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
96
- | [![coinbase](https://user-images.githubusercontent.com/1294454/40811661-b6eceae2-653a-11e8-829e-10bfadb078cf.jpg)](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | coinbase | [Coinbase](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://developers.coinbase.com/api/v2) | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
97
+ | [![coinbase](https://user-images.githubusercontent.com/1294454/40811661-b6eceae2-653a-11e8-829e-10bfadb078cf.jpg)](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | coinbase | [Coinbase Advanced](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | [![API Version 2](https://img.shields.io/badge/2-lightgray)](https://developers.coinbase.com/api/v2) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
97
98
  | [![coinbaseinternational](https://github.com/ccxt/ccxt/assets/43336371/866ae638-6ab5-4ebf-ab2c-cdcce9545625)](https://international.coinbase.com) | coinbaseinternational | [Coinbase International](https://international.coinbase.com) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.cloud.coinbase.com/intx/docs) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
98
- | [![coinbasepro](https://user-images.githubusercontent.com/1294454/41764625-63b7ffde-760a-11e8-996d-a6328fa9347a.jpg)](https://pro.coinbase.com/) | coinbasepro | [Coinbase Pro](https://pro.coinbase.com/) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://docs.pro.coinbase.com) | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
99
+ | [![coinbasepro](https://user-images.githubusercontent.com/1294454/41764625-63b7ffde-760a-11e8-996d-a6328fa9347a.jpg)](https://pro.coinbase.com/) | coinbasepro | [Coinbase Pro(Deprecated)](https://pro.coinbase.com/) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://docs.pro.coinbase.com) | | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
99
100
  | [![coincheck](https://user-images.githubusercontent.com/51840849/87182088-1d6d6380-c2ec-11ea-9c64-8ab9f9b289f5.jpg)](https://coincheck.com) | coincheck | [coincheck](https://coincheck.com) | [![API Version *](https://img.shields.io/badge/*-lightgray)](https://coincheck.com/documents/exchange/api) | | |
100
101
  | [![coinex](https://user-images.githubusercontent.com/51840849/87182089-1e05fa00-c2ec-11ea-8da9-cc73b45abbbc.jpg)](https://www.coinex.com/register?refer_code=yw5fz) | coinex | [CoinEx](https://www.coinex.com/register?refer_code=yw5fz) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://docs.coinex.com/api/v2) | [![CCXT Certified](https://img.shields.io/badge/CCXT-Certified-green.svg)](https://github.com/ccxt/ccxt/wiki/Certification) | [![CCXT Pro](https://img.shields.io/badge/CCXT-Pro-black)](https://ccxt.pro) |
101
102
  | [![coinlist](https://github-production-user-asset-6210df.s3.amazonaws.com/1294454/281108917-eff2ae1d-ce8a-4b2a-950d-8678b12da965.jpg)](https://coinlist.co) | coinlist | [Coinlist](https://coinlist.co) | [![API Version 1](https://img.shields.io/badge/1-lightgray)](https://trade-docs.coinlist.co) | | |
@@ -212,13 +213,13 @@ console.log(version, Object.keys(exchanges));
212
213
 
213
214
  All-in-one browser bundle (dependencies included), served from a CDN of your choice:
214
215
 
215
- * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.1/dist/ccxt.browser.js
216
- * unpkg: https://unpkg.com/ccxt@4.3.1/dist/ccxt.browser.js
216
+ * jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.2/dist/ccxt.browser.js
217
+ * unpkg: https://unpkg.com/ccxt@4.3.2/dist/ccxt.browser.js
217
218
 
218
219
  CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
219
220
 
220
221
  ```HTML
221
- <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.1/dist/ccxt.browser.js"></script>
222
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.2/dist/ccxt.browser.js"></script>
222
223
  ```
223
224
 
224
225
  Creates a global `ccxt` object:
package/dist/cjs/ccxt.js CHANGED
@@ -182,7 +182,7 @@ var woo$1 = require('./src/pro/woo.js');
182
182
 
183
183
  //-----------------------------------------------------------------------------
184
184
  // this is updated by vss.js when building
185
- const version = '4.3.1';
185
+ const version = '4.3.2';
186
186
  Exchange["default"].ccxtVersion = version;
187
187
  const exchanges = {
188
188
  'ace': ace,
@@ -4477,6 +4477,9 @@ class Exchange {
4477
4477
  async cancelAllOrders(symbol = undefined, params = {}) {
4478
4478
  throw new errors.NotSupported(this.id + ' cancelAllOrders() is not supported yet');
4479
4479
  }
4480
+ async cancelOrdersForSymbols(orders, params = {}) {
4481
+ throw new errors.NotSupported(this.id + ' cancelOrdersForSymbols() is not supported yet');
4482
+ }
4480
4483
  async cancelAllOrdersWs(symbol = undefined, params = {}) {
4481
4484
  throw new errors.NotSupported(this.id + ' cancelAllOrdersWs() is not supported yet');
4482
4485
  }
@@ -8650,6 +8650,8 @@ class bitget extends bitget$1 {
8650
8650
  //
8651
8651
  // spot
8652
8652
  //
8653
+ // {"code":"00000","msg":"success","requestTime":1713294492511,"data":[...]}"
8654
+ //
8653
8655
  // {"status":"fail","err_code":"01001","err_msg":"系统异常,请稍后重试"}
8654
8656
  // {"status":"error","ts":1595594160149,"err_code":"invalid-parameter","err_msg":"invalid size, valid range: [1,2000]"}
8655
8657
  // {"status":"error","ts":1595684716042,"err_code":"invalid-parameter","err_msg":"illegal sign invalid"}
@@ -8671,14 +8673,14 @@ class bitget extends bitget$1 {
8671
8673
  // {"code":"40108","msg":"","requestTime":1595885064600,"data":null}
8672
8674
  // {"order_id":"513468410013679613","client_oid":null,"symbol":"ethusd","result":false,"err_code":"order_no_exist_error","err_msg":"订单不存在!"}
8673
8675
  //
8674
- const message = this.safeString(response, 'err_msg');
8675
- const errorCode = this.safeString2(response, 'code', 'err_code');
8676
+ const message = this.safeString2(response, 'err_msg', 'msg');
8676
8677
  const feedback = this.id + ' ' + body;
8677
- const nonEmptyMessage = ((message !== undefined) && (message !== ''));
8678
+ const nonEmptyMessage = ((message !== undefined) && (message !== '') && (message !== 'success'));
8678
8679
  if (nonEmptyMessage) {
8679
8680
  this.throwExactlyMatchedException(this.exceptions['exact'], message, feedback);
8680
8681
  this.throwBroadlyMatchedException(this.exceptions['broad'], message, feedback);
8681
8682
  }
8683
+ const errorCode = this.safeString2(response, 'code', 'err_code');
8682
8684
  const nonZeroErrorCode = (errorCode !== undefined) && (errorCode !== '00000');
8683
8685
  if (nonZeroErrorCode) {
8684
8686
  this.throwExactlyMatchedException(this.exceptions['exact'], errorCode, feedback);
@@ -17,9 +17,10 @@ class coinbase extends coinbase$1 {
17
17
  describe() {
18
18
  return this.deepExtend(super.describe(), {
19
19
  'id': 'coinbase',
20
- 'name': 'Coinbase',
20
+ 'name': 'Coinbase Advanced',
21
21
  'countries': ['US'],
22
22
  'pro': true,
23
+ 'certified': true,
23
24
  // rate-limits:
24
25
  // ADVANCED API: https://docs.cloud.coinbase.com/advanced-trade-api/docs/rest-api-rate-limits
25
26
  // - max 30 req/second for private data, 10 req/s for public data
@@ -16,7 +16,7 @@ class coinbasepro extends coinbasepro$1 {
16
16
  describe() {
17
17
  return this.deepExtend(super.describe(), {
18
18
  'id': 'coinbasepro',
19
- 'name': 'Coinbase Pro',
19
+ 'name': 'Coinbase Pro(Deprecated)',
20
20
  'countries': ['US'],
21
21
  'rateLimit': 100,
22
22
  'userAgent': this.userAgents['chrome'],
@@ -812,65 +812,59 @@ class coinex extends coinex$1 {
812
812
  // Spot fetchTicker, fetchTickers
813
813
  //
814
814
  // {
815
- // "vol": "293.19415130",
816
- // "low": "38200.00",
817
- // "open": "39514.99",
818
- // "high": "39530.00",
819
- // "last": "38649.57",
820
- // "buy": "38640.20",
821
- // "buy_amount": "0.22800000",
822
- // "sell": "38640.21",
823
- // "sell_amount": "0.02828439"
815
+ // "close": "62393.47",
816
+ // "high": "64106.41",
817
+ // "last": "62393.47",
818
+ // "low": "59650.01",
819
+ // "market": "BTCUSDT",
820
+ // "open": "61616.15",
821
+ // "period": 86400,
822
+ // "value": "28711273.4065667262",
823
+ // "volume": "461.76557205",
824
+ // "volume_buy": "11.41506354",
825
+ // "volume_sell": "7.3240169"
824
826
  // }
825
827
  //
826
828
  // Swap fetchTicker, fetchTickers
827
829
  //
828
830
  // {
829
- // "vol": "7714.2175",
830
- // "low": "38200.00",
831
- // "open": "39569.23",
832
- // "high": "39569.23",
833
- // "last": "38681.37",
834
- // "buy": "38681.36",
831
+ // "close": "62480.08",
832
+ // "high": "64100",
833
+ // "index_price": "62443.05",
834
+ // "last": "62480.08",
835
+ // "low": "59600",
836
+ // "mark_price": "62443.05",
837
+ // "market": "BTCUSDT",
838
+ // "open": "61679.98",
835
839
  // "period": 86400,
836
- // "funding_time": 462,
837
- // "position_amount": "296.7552",
838
- // "funding_rate_last": "0.00009395",
839
- // "funding_rate_next": "0.00000649",
840
- // "funding_rate_predict": "-0.00007176",
841
- // "insurance": "16464465.09431942163278132918",
842
- // "sign_price": "38681.93",
843
- // "index_price": "38681.69500000",
844
- // "sell_total": "16.6039",
845
- // "buy_total": "19.8481",
846
- // "buy_amount": "4.6315",
847
- // "sell": "38681.37",
848
- // "sell_amount": "11.4044"
840
+ // "value": "180226025.69791713065326633165",
841
+ // "volume": "2900.2218",
842
+ // "volume_buy": "7.3847",
843
+ // "volume_sell": "6.1249"
849
844
  // }
850
845
  //
851
- const timestamp = this.safeInteger(ticker, 'date');
852
- const symbol = this.safeSymbol(undefined, market);
853
- ticker = this.safeValue(ticker, 'ticker', {});
854
- const last = this.safeString(ticker, 'last');
846
+ const marketType = ('mark_price' in ticker) ? 'swap' : 'spot';
847
+ const marketId = this.safeString(ticker, 'market');
848
+ const symbol = this.safeSymbol(marketId, market, undefined, marketType);
855
849
  return this.safeTicker({
856
850
  'symbol': symbol,
857
- 'timestamp': timestamp,
858
- 'datetime': this.iso8601(timestamp),
851
+ 'timestamp': undefined,
852
+ 'datetime': undefined,
859
853
  'high': this.safeString(ticker, 'high'),
860
854
  'low': this.safeString(ticker, 'low'),
861
- 'bid': this.safeString(ticker, 'buy'),
862
- 'bidVolume': this.safeString(ticker, 'buy_amount'),
863
- 'ask': this.safeString(ticker, 'sell'),
864
- 'askVolume': this.safeString(ticker, 'sell_amount'),
855
+ 'bid': undefined,
856
+ 'bidVolume': this.safeString(ticker, 'volume_buy'),
857
+ 'ask': undefined,
858
+ 'askVolume': this.safeString(ticker, 'volume_sell'),
865
859
  'vwap': undefined,
866
860
  'open': this.safeString(ticker, 'open'),
867
- 'close': last,
868
- 'last': last,
861
+ 'close': this.safeString(ticker, 'close'),
862
+ 'last': this.safeString(ticker, 'last'),
869
863
  'previousClose': undefined,
870
864
  'change': undefined,
871
865
  'percentage': undefined,
872
866
  'average': undefined,
873
- 'baseVolume': this.safeString2(ticker, 'vol', 'volume'),
867
+ 'baseVolume': this.safeString(ticker, 'volume'),
874
868
  'quoteVolume': undefined,
875
869
  'info': ticker,
876
870
  }, market);
@@ -880,8 +874,8 @@ class coinex extends coinex$1 {
880
874
  * @method
881
875
  * @name coinex#fetchTicker
882
876
  * @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
883
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market007_single_market_ticker
884
- * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http008_market_ticker
877
+ * @see https://docs.coinex.com/api/v2/spot/market/http/list-market-ticker
878
+ * @see https://docs.coinex.com/api/v2/futures/market/http/list-market-ticker
885
879
  * @param {string} symbol unified symbol of the market to fetch the ticker for
886
880
  * @param {object} [params] extra parameters specific to the exchange API endpoint
887
881
  * @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -893,30 +887,31 @@ class coinex extends coinex$1 {
893
887
  };
894
888
  let response = undefined;
895
889
  if (market['swap']) {
896
- response = await this.v1PerpetualPublicGetMarketTicker(this.extend(request, params));
890
+ response = await this.v2PublicGetFuturesTicker(this.extend(request, params));
897
891
  }
898
892
  else {
899
- response = await this.v1PublicGetMarketTicker(this.extend(request, params));
893
+ response = await this.v2PublicGetSpotTicker(this.extend(request, params));
900
894
  }
901
895
  //
902
896
  // Spot
903
897
  //
904
898
  // {
905
899
  // "code": 0,
906
- // "data": {
907
- // "date": 1651306913414,
908
- // "ticker": {
909
- // "vol": "293.19415130",
910
- // "low": "38200.00",
911
- // "open": "39514.99",
912
- // "high": "39530.00",
913
- // "last": "38649.57",
914
- // "buy": "38640.20",
915
- // "buy_amount": "0.22800000",
916
- // "sell": "38640.21",
917
- // "sell_amount": "0.02828439"
900
+ // "data": [
901
+ // {
902
+ // "close": "62393.47",
903
+ // "high": "64106.41",
904
+ // "last": "62393.47",
905
+ // "low": "59650.01",
906
+ // "market": "BTCUSDT",
907
+ // "open": "61616.15",
908
+ // "period": 86400,
909
+ // "value": "28711273.4065667262",
910
+ // "volume": "461.76557205",
911
+ // "volume_buy": "11.41506354",
912
+ // "volume_sell": "7.3240169"
918
913
  // }
919
- // },
914
+ // ],
920
915
  // "message": "OK"
921
916
  // }
922
917
  //
@@ -924,43 +919,37 @@ class coinex extends coinex$1 {
924
919
  //
925
920
  // {
926
921
  // "code": 0,
927
- // "data": {
928
- // "date": 1651306641500,
929
- // "ticker": {
930
- // "vol": "7714.2175",
931
- // "low": "38200.00",
932
- // "open": "39569.23",
933
- // "high": "39569.23",
934
- // "last": "38681.37",
935
- // "buy": "38681.36",
922
+ // "data": [
923
+ // {
924
+ // "close": "62480.08",
925
+ // "high": "64100",
926
+ // "index_price": "62443.05",
927
+ // "last": "62480.08",
928
+ // "low": "59600",
929
+ // "mark_price": "62443.05",
930
+ // "market": "BTCUSDT",
931
+ // "open": "61679.98",
936
932
  // "period": 86400,
937
- // "funding_time": 462,
938
- // "position_amount": "296.7552",
939
- // "funding_rate_last": "0.00009395",
940
- // "funding_rate_next": "0.00000649",
941
- // "funding_rate_predict": "-0.00007176",
942
- // "insurance": "16464465.09431942163278132918",
943
- // "sign_price": "38681.93",
944
- // "index_price": "38681.69500000",
945
- // "sell_total": "16.6039",
946
- // "buy_total": "19.8481",
947
- // "buy_amount": "4.6315",
948
- // "sell": "38681.37",
949
- // "sell_amount": "11.4044"
933
+ // "value": "180226025.69791713065326633165",
934
+ // "volume": "2900.2218",
935
+ // "volume_buy": "7.3847",
936
+ // "volume_sell": "6.1249"
950
937
  // }
951
- // },
938
+ // ],
952
939
  // "message": "OK"
953
940
  // }
954
941
  //
955
- return this.parseTicker(response['data'], market);
942
+ const data = this.safeList(response, 'data', []);
943
+ const result = this.safeDict(data, 0, {});
944
+ return this.parseTicker(result, market);
956
945
  }
957
946
  async fetchTickers(symbols = undefined, params = {}) {
958
947
  /**
959
948
  * @method
960
949
  * @name coinex#fetchTickers
961
950
  * @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
962
- * @see https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot001_market008_all_market_ticker
963
- * @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http009_market_ticker_all
951
+ * @see https://docs.coinex.com/api/v2/spot/market/http/list-market-ticker
952
+ * @see https://docs.coinex.com/api/v2/futures/market/http/list-market-ticker
964
953
  * @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
965
954
  * @param {object} [params] extra parameters specific to the exchange API endpoint
966
955
  * @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
@@ -975,86 +964,60 @@ class coinex extends coinex$1 {
975
964
  const [marketType, query] = this.handleMarketTypeAndParams('fetchTickers', market, params);
976
965
  let response = undefined;
977
966
  if (marketType === 'swap') {
978
- response = await this.v1PerpetualPublicGetMarketTickerAll(query);
967
+ response = await this.v2PublicGetFuturesTicker(query);
979
968
  }
980
969
  else {
981
- response = await this.v1PublicGetMarketTickerAll();
970
+ response = await this.v2PublicGetSpotTicker(query);
982
971
  }
983
972
  //
984
973
  // Spot
985
974
  //
986
975
  // {
987
976
  // "code": 0,
988
- // "data": {
989
- // "date": 1651519857284,
990
- // "ticker": {
991
- // "PSPUSDT": {
992
- // "vol": "127131.55227034",
993
- // "low": "0.0669",
994
- // "open": "0.0688",
995
- // "high": "0.0747",
996
- // "last": "0.0685",
997
- // "buy": "0.0676",
998
- // "buy_amount": "702.70117866",
999
- // "sell": "0.0690",
1000
- // "sell_amount": "686.76861562"
1001
- // },
977
+ // "data": [
978
+ // {
979
+ // "close": "62393.47",
980
+ // "high": "64106.41",
981
+ // "last": "62393.47",
982
+ // "low": "59650.01",
983
+ // "market": "BTCUSDT",
984
+ // "open": "61616.15",
985
+ // "period": 86400,
986
+ // "value": "28711273.4065667262",
987
+ // "volume": "461.76557205",
988
+ // "volume_buy": "11.41506354",
989
+ // "volume_sell": "7.3240169"
1002
990
  // }
1003
- // },
1004
- // "message": "Ok"
991
+ // ],
992
+ // "message": "OK"
1005
993
  // }
1006
994
  //
1007
995
  // Swap
1008
996
  //
1009
997
  // {
1010
998
  // "code": 0,
1011
- // "data": {
1012
- // "date": 1651520268644,
1013
- // "ticker": {
1014
- // "KAVAUSDT": {
1015
- // "vol": "834924",
1016
- // "low": "3.9418",
1017
- // "open": "4.1834",
1018
- // "high": "4.4328",
1019
- // "last": "4.0516",
1020
- // "buy": "4.0443",
1021
- // "period": 86400,
1022
- // "funding_time": 262,
1023
- // "position_amount": "16111",
1024
- // "funding_rate_last": "-0.00069514",
1025
- // "funding_rate_next": "-0.00061009",
1026
- // "funding_rate_predict": "-0.00055812",
1027
- // "insurance": "16532425.53026084124483989548",
1028
- // "sign_price": "4.0516",
1029
- // "index_price": "4.0530",
1030
- // "sell_total": "59446",
1031
- // "buy_total": "62423",
1032
- // "buy_amount": "959",
1033
- // "sell": "4.0466",
1034
- // "sell_amount": "141"
1035
- // },
999
+ // "data": [
1000
+ // {
1001
+ // "close": "62480.08",
1002
+ // "high": "64100",
1003
+ // "index_price": "62443.05",
1004
+ // "last": "62480.08",
1005
+ // "low": "59600",
1006
+ // "mark_price": "62443.05",
1007
+ // "market": "BTCUSDT",
1008
+ // "open": "61679.98",
1009
+ // "period": 86400,
1010
+ // "value": "180226025.69791713065326633165",
1011
+ // "volume": "2900.2218",
1012
+ // "volume_buy": "7.3847",
1013
+ // "volume_sell": "6.1249"
1036
1014
  // }
1037
- // },
1038
- // "message": "Ok"
1015
+ // ],
1016
+ // "message": "OK"
1039
1017
  // }
1040
1018
  //
1041
- const data = this.safeValue(response, 'data');
1042
- const timestamp = this.safeInteger(data, 'date');
1043
- const tickers = this.safeValue(data, 'ticker', {});
1044
- const marketIds = Object.keys(tickers);
1045
- const result = {};
1046
- for (let i = 0; i < marketIds.length; i++) {
1047
- const marketId = marketIds[i];
1048
- const marketInner = this.safeMarket(marketId, undefined, undefined, marketType);
1049
- const symbol = marketInner['symbol'];
1050
- const ticker = this.parseTicker({
1051
- 'date': timestamp,
1052
- 'ticker': tickers[marketId],
1053
- }, marketInner);
1054
- ticker['symbol'] = symbol;
1055
- result[symbol] = ticker;
1056
- }
1057
- return this.filterByArrayTickers(result, 'symbol', symbols);
1019
+ const data = this.safeList(response, 'data', []);
1020
+ return this.parseTickers(data, symbols);
1058
1021
  }
1059
1022
  async fetchTime(params = {}) {
1060
1023
  /**
@@ -1625,7 +1625,7 @@ class cryptocom extends cryptocom$1 {
1625
1625
  */
1626
1626
  [tag, params] = this.handleWithdrawTagAndParams(tag, params);
1627
1627
  await this.loadMarkets();
1628
- const currency = this.currency(code);
1628
+ const currency = this.safeCurrency(code); // for instance, USDC is not inferred from markets but it's still available
1629
1629
  const request = {
1630
1630
  'currency': currency['id'],
1631
1631
  'amount': amount,
@@ -1671,7 +1671,7 @@ class cryptocom extends cryptocom$1 {
1671
1671
  * @returns {object} a dictionary of [address structures]{@link https://docs.ccxt.com/#/?id=address-structure} indexed by the network
1672
1672
  */
1673
1673
  await this.loadMarkets();
1674
- const currency = this.currency(code);
1674
+ const currency = this.safeCurrency(code);
1675
1675
  const request = {
1676
1676
  'currency': currency['id'],
1677
1677
  };
@@ -1770,7 +1770,7 @@ class cryptocom extends cryptocom$1 {
1770
1770
  let currency = undefined;
1771
1771
  const request = {};
1772
1772
  if (code !== undefined) {
1773
- currency = this.currency(code);
1773
+ currency = this.safeCurrency(code);
1774
1774
  request['currency'] = currency['id'];
1775
1775
  }
1776
1776
  if (since !== undefined) {
@@ -1829,7 +1829,7 @@ class cryptocom extends cryptocom$1 {
1829
1829
  let currency = undefined;
1830
1830
  const request = {};
1831
1831
  if (code !== undefined) {
1832
- currency = this.currency(code);
1832
+ currency = this.safeCurrency(code);
1833
1833
  request['currency'] = currency['id'];
1834
1834
  }
1835
1835
  if (since !== undefined) {
@@ -2345,7 +2345,7 @@ class cryptocom extends cryptocom$1 {
2345
2345
  const request = {};
2346
2346
  let currency = undefined;
2347
2347
  if (code !== undefined) {
2348
- currency = this.currency(code);
2348
+ currency = this.safeCurrency(code);
2349
2349
  }
2350
2350
  if (since !== undefined) {
2351
2351
  request['start_time'] = since;
@@ -37,6 +37,7 @@ class hyperliquid extends hyperliquid$1 {
37
37
  'cancelAllOrders': false,
38
38
  'cancelOrder': true,
39
39
  'cancelOrders': true,
40
+ 'cancelOrdersForSymbols': true,
40
41
  'closeAllPositions': false,
41
42
  'closePosition': false,
42
43
  'createMarketBuyOrderWithCost': false,
@@ -1219,6 +1220,79 @@ class hyperliquid extends hyperliquid$1 {
1219
1220
  //
1220
1221
  return response;
1221
1222
  }
1223
+ async cancelOrdersForSymbols(orders, params = {}) {
1224
+ /**
1225
+ * @method
1226
+ * @name hyperliquid#cancelOrdersForSymbols
1227
+ * @description cancel multiple orders for multiple symbols
1228
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
1229
+ * @see https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
1230
+ * @param {CancellationRequest[]} orders each order should contain the parameters required by cancelOrder namely id and symbol
1231
+ * @param {object} [params] extra parameters specific to the exchange API endpoint
1232
+ * @param {string} [params.vaultAddress] the vault address
1233
+ * @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
1234
+ */
1235
+ this.checkRequiredCredentials();
1236
+ await this.loadMarkets();
1237
+ const nonce = this.milliseconds();
1238
+ const request = {
1239
+ 'nonce': nonce,
1240
+ // 'vaultAddress': vaultAddress,
1241
+ };
1242
+ const cancelReq = [];
1243
+ const cancelAction = {
1244
+ 'type': '',
1245
+ 'cancels': [],
1246
+ };
1247
+ let cancelByCloid = false;
1248
+ for (let i = 0; i < orders.length; i++) {
1249
+ const order = orders[i];
1250
+ const clientOrderId = this.safeString(order, 'clientOrderId');
1251
+ if (clientOrderId !== undefined) {
1252
+ cancelByCloid = true;
1253
+ }
1254
+ const id = this.safeString(order, 'id');
1255
+ const symbol = this.safeString(order, 'symbol');
1256
+ if (symbol === undefined) {
1257
+ throw new errors.ArgumentsRequired(this.id + ' cancelOrdersForSymbols() requires a symbol argument in each order');
1258
+ }
1259
+ if (id !== undefined && cancelByCloid) {
1260
+ throw new errors.BadRequest(this.id + ' cancelOrdersForSymbols() all orders must have either id or clientOrderId');
1261
+ }
1262
+ const assetKey = cancelByCloid ? 'asset' : 'a';
1263
+ const idKey = cancelByCloid ? 'cloid' : 'o';
1264
+ const market = this.market(symbol);
1265
+ const cancelObj = {};
1266
+ cancelObj[assetKey] = this.parseToNumeric(market['baseId']);
1267
+ cancelObj[idKey] = cancelByCloid ? clientOrderId : this.parseToNumeric(id);
1268
+ cancelReq.push(cancelObj);
1269
+ }
1270
+ cancelAction['type'] = cancelByCloid ? 'cancelByCloid' : 'cancel';
1271
+ cancelAction['cancels'] = cancelReq;
1272
+ const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
1273
+ const signature = this.signL1Action(cancelAction, nonce, vaultAddress);
1274
+ request['action'] = cancelAction;
1275
+ request['signature'] = signature;
1276
+ if (vaultAddress !== undefined) {
1277
+ params = this.omit(params, 'vaultAddress');
1278
+ request['vaultAddress'] = vaultAddress;
1279
+ }
1280
+ const response = await this.privatePostExchange(this.extend(request, params));
1281
+ //
1282
+ // {
1283
+ // "status":"ok",
1284
+ // "response":{
1285
+ // "type":"cancel",
1286
+ // "data":{
1287
+ // "statuses":[
1288
+ // "success"
1289
+ // ]
1290
+ // }
1291
+ // }
1292
+ // }
1293
+ //
1294
+ return response;
1295
+ }
1222
1296
  async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
1223
1297
  /**
1224
1298
  * @method