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 +6 -5
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +3 -0
- package/dist/cjs/src/bitget.js +5 -3
- package/dist/cjs/src/coinbase.js +2 -1
- package/dist/cjs/src/coinbasepro.js +1 -1
- package/dist/cjs/src/coinex.js +109 -146
- package/dist/cjs/src/cryptocom.js +5 -5
- package/dist/cjs/src/hyperliquid.js +74 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +2 -1
- package/js/src/base/Exchange.js +3 -0
- package/js/src/base/types.d.ts +5 -0
- package/js/src/bitget.js +5 -3
- package/js/src/coinbase.js +2 -1
- package/js/src/coinbasepro.d.ts +1 -1
- package/js/src/coinbasepro.js +1 -1
- package/js/src/coinex.js +109 -146
- package/js/src/cryptocom.js +5 -5
- package/js/src/hyperliquid.d.ts +2 -1
- package/js/src/hyperliquid.js +75 -1
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -41,6 +41,7 @@ Current feature list:
|
|
|
41
41
|
| [](http://www.bitmart.com/?r=rQCFLh) | bitmart | [BitMart](http://www.bitmart.com/?r=rQCFLh) | [](https://developer-pro.bitmart.com/) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) | [](http://www.bitmart.com/?r=rQCFLh) |
|
|
42
42
|
| [](https://www.bitmex.com/app/register/NZTR1q) | bitmex | [BitMEX](https://www.bitmex.com/app/register/NZTR1q) | [](https://www.bitmex.com/app/apiOverview) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) | [](https://www.bitmex.com/app/register/NZTR1q) |
|
|
43
43
|
| [](https://www.bybit.com/register?affiliate_id=35953) | bybit | [Bybit](https://www.bybit.com/register?affiliate_id=35953) | [](https://bybit-exchange.github.io/docs/inverse/) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) | |
|
|
44
|
+
| [](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | coinbase | [Coinbase Advanced](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | [](https://developers.coinbase.com/api/v2) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) | |
|
|
44
45
|
| [](https://international.coinbase.com) | coinbaseinternational | [Coinbase International](https://international.coinbase.com) | [](https://docs.cloud.coinbase.com/intx/docs) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) | |
|
|
45
46
|
| [](https://www.coinex.com/register?refer_code=yw5fz) | coinex | [CoinEx](https://www.coinex.com/register?refer_code=yw5fz) | [](https://docs.coinex.com/api/v2) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) | |
|
|
46
47
|
| [](https://crypto.com/exch/kdacthrnxt) | cryptocom | [Crypto.com](https://crypto.com/exch/kdacthrnxt) | [](https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) | [](https://crypto.com/exch/kdacthrnxt) |
|
|
@@ -93,9 +94,9 @@ The CCXT library currently supports the following 97 cryptocurrency exchange mar
|
|
|
93
94
|
| [](https://www.btcturk.com) | btcturk | [BTCTurk](https://www.btcturk.com) | [](https://github.com/BTCTrader/broker-api-docs) | | |
|
|
94
95
|
| [](https://www.bybit.com/register?affiliate_id=35953) | bybit | [Bybit](https://www.bybit.com/register?affiliate_id=35953) | [](https://bybit-exchange.github.io/docs/inverse/) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
|
95
96
|
| [](https://cex.io/r/0/up105393824/0/) | cex | [CEX.IO](https://cex.io/r/0/up105393824/0/) | [](https://cex.io/cex-api) | | [](https://ccxt.pro) |
|
|
96
|
-
| [](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | coinbase | [Coinbase](https://www.coinbase.com/join/58cbe25a355148797479dbd2)
|
|
97
|
+
| [](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | coinbase | [Coinbase Advanced](https://www.coinbase.com/join/58cbe25a355148797479dbd2) | [](https://developers.coinbase.com/api/v2) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
|
97
98
|
| [](https://international.coinbase.com) | coinbaseinternational | [Coinbase International](https://international.coinbase.com) | [](https://docs.cloud.coinbase.com/intx/docs) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
|
98
|
-
| [](https://pro.coinbase.com/) | coinbasepro | [Coinbase Pro](https://pro.coinbase.com/)
|
|
99
|
+
| [](https://pro.coinbase.com/) | coinbasepro | [Coinbase Pro(Deprecated)](https://pro.coinbase.com/) | [](https://docs.pro.coinbase.com) | | [](https://ccxt.pro) |
|
|
99
100
|
| [](https://coincheck.com) | coincheck | [coincheck](https://coincheck.com) | [](https://coincheck.com/documents/exchange/api) | | |
|
|
100
101
|
| [](https://www.coinex.com/register?refer_code=yw5fz) | coinex | [CoinEx](https://www.coinex.com/register?refer_code=yw5fz) | [](https://docs.coinex.com/api/v2) | [](https://github.com/ccxt/ccxt/wiki/Certification) | [](https://ccxt.pro) |
|
|
101
102
|
| [](https://coinlist.co) | coinlist | [Coinlist](https://coinlist.co) | [](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.
|
|
216
|
-
* unpkg: https://unpkg.com/ccxt@4.3.
|
|
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.
|
|
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.
|
|
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
|
}
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -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.
|
|
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);
|
package/dist/cjs/src/coinbase.js
CHANGED
|
@@ -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'],
|
package/dist/cjs/src/coinex.js
CHANGED
|
@@ -812,65 +812,59 @@ class coinex extends coinex$1 {
|
|
|
812
812
|
// Spot fetchTicker, fetchTickers
|
|
813
813
|
//
|
|
814
814
|
// {
|
|
815
|
-
// "
|
|
816
|
-
// "
|
|
817
|
-
// "
|
|
818
|
-
// "
|
|
819
|
-
// "
|
|
820
|
-
// "
|
|
821
|
-
// "
|
|
822
|
-
// "
|
|
823
|
-
// "
|
|
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
|
-
// "
|
|
830
|
-
// "
|
|
831
|
-
// "
|
|
832
|
-
// "
|
|
833
|
-
// "
|
|
834
|
-
// "
|
|
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
|
-
// "
|
|
837
|
-
// "
|
|
838
|
-
// "
|
|
839
|
-
// "
|
|
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
|
|
852
|
-
const
|
|
853
|
-
|
|
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':
|
|
858
|
-
'datetime':
|
|
851
|
+
'timestamp': undefined,
|
|
852
|
+
'datetime': undefined,
|
|
859
853
|
'high': this.safeString(ticker, 'high'),
|
|
860
854
|
'low': this.safeString(ticker, 'low'),
|
|
861
|
-
'bid':
|
|
862
|
-
'bidVolume': this.safeString(ticker, '
|
|
863
|
-
'ask':
|
|
864
|
-
'askVolume': this.safeString(ticker, '
|
|
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':
|
|
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.
|
|
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://
|
|
884
|
-
* @see https://
|
|
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.
|
|
890
|
+
response = await this.v2PublicGetFuturesTicker(this.extend(request, params));
|
|
897
891
|
}
|
|
898
892
|
else {
|
|
899
|
-
response = await this.
|
|
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
|
-
//
|
|
908
|
-
//
|
|
909
|
-
// "
|
|
910
|
-
// "
|
|
911
|
-
// "
|
|
912
|
-
// "
|
|
913
|
-
// "
|
|
914
|
-
// "
|
|
915
|
-
// "
|
|
916
|
-
// "
|
|
917
|
-
// "
|
|
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
|
-
//
|
|
929
|
-
//
|
|
930
|
-
// "
|
|
931
|
-
// "
|
|
932
|
-
// "
|
|
933
|
-
// "
|
|
934
|
-
// "
|
|
935
|
-
// "
|
|
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
|
-
// "
|
|
938
|
-
// "
|
|
939
|
-
// "
|
|
940
|
-
// "
|
|
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
|
-
|
|
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://
|
|
963
|
-
* @see https://
|
|
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.
|
|
967
|
+
response = await this.v2PublicGetFuturesTicker(query);
|
|
979
968
|
}
|
|
980
969
|
else {
|
|
981
|
-
response = await this.
|
|
970
|
+
response = await this.v2PublicGetSpotTicker(query);
|
|
982
971
|
}
|
|
983
972
|
//
|
|
984
973
|
// Spot
|
|
985
974
|
//
|
|
986
975
|
// {
|
|
987
976
|
// "code": 0,
|
|
988
|
-
// "data":
|
|
989
|
-
//
|
|
990
|
-
//
|
|
991
|
-
// "
|
|
992
|
-
//
|
|
993
|
-
//
|
|
994
|
-
//
|
|
995
|
-
//
|
|
996
|
-
//
|
|
997
|
-
//
|
|
998
|
-
//
|
|
999
|
-
//
|
|
1000
|
-
//
|
|
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": "
|
|
991
|
+
// ],
|
|
992
|
+
// "message": "OK"
|
|
1005
993
|
// }
|
|
1006
994
|
//
|
|
1007
995
|
// Swap
|
|
1008
996
|
//
|
|
1009
997
|
// {
|
|
1010
998
|
// "code": 0,
|
|
1011
|
-
// "data":
|
|
1012
|
-
//
|
|
1013
|
-
//
|
|
1014
|
-
// "
|
|
1015
|
-
//
|
|
1016
|
-
//
|
|
1017
|
-
//
|
|
1018
|
-
//
|
|
1019
|
-
//
|
|
1020
|
-
//
|
|
1021
|
-
//
|
|
1022
|
-
//
|
|
1023
|
-
//
|
|
1024
|
-
//
|
|
1025
|
-
//
|
|
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": "
|
|
1015
|
+
// ],
|
|
1016
|
+
// "message": "OK"
|
|
1039
1017
|
// }
|
|
1040
1018
|
//
|
|
1041
|
-
const data = this.
|
|
1042
|
-
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
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
|