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.
- package/README.md +6 -5
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +25 -0
- package/dist/cjs/src/binance.js +320 -21
- package/dist/cjs/src/bingx.js +2 -2
- package/dist/cjs/src/bitget.js +81 -4
- package/dist/cjs/src/coinbase.js +11 -2
- 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 +161 -13
- package/dist/cjs/src/okx.js +116 -0
- package/dist/cjs/src/poloniexfutures.js +12 -2
- package/dist/cjs/src/pro/hyperliquid.js +8 -7
- package/dist/cjs/src/pro/kraken.js +1 -1
- package/dist/cjs/src/pro/wazirx.js +2 -1
- package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +27 -2
- package/dist/cjs/src/woo.js +110 -6
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +3 -1
- package/js/src/base/Exchange.js +25 -0
- package/js/src/base/types.d.ts +5 -0
- package/js/src/binance.d.ts +3 -0
- package/js/src/binance.js +320 -21
- package/js/src/bingx.js +3 -3
- package/js/src/bitget.d.ts +1 -0
- package/js/src/bitget.js +81 -4
- package/js/src/coinbase.js +11 -2
- 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 +3 -1
- package/js/src/hyperliquid.js +162 -14
- package/js/src/okx.d.ts +2 -0
- package/js/src/okx.js +116 -0
- package/js/src/poloniexfutures.js +12 -2
- package/js/src/pro/hyperliquid.js +8 -7
- package/js/src/pro/kraken.js +1 -1
- package/js/src/pro/wazirx.js +2 -1
- package/js/src/static_dependencies/jsencrypt/JSEncryptRSAKey.d.ts +2 -2
- package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.d.ts +24 -357
- package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +27 -0
- package/js/src/woo.d.ts +2 -0
- package/js/src/woo.js +110 -6
- 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,
|
|
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':
|
|
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, //
|
|
400
|
+
'101204': InsufficientFunds, // {"code":101204,"msg":"","data":{}}
|
|
401
401
|
},
|
|
402
402
|
'broad': {},
|
|
403
403
|
},
|
package/js/src/bitget.d.ts
CHANGED
|
@@ -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.
|
|
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.
|
|
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);
|
package/js/src/coinbase.js
CHANGED
|
@@ -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': {
|
package/js/src/coinbasepro.js
CHANGED
|
@@ -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
|
-
// "
|
|
819
|
-
// "
|
|
820
|
-
// "
|
|
821
|
-
// "
|
|
822
|
-
// "
|
|
823
|
-
// "
|
|
824
|
-
// "
|
|
825
|
-
// "
|
|
826
|
-
// "
|
|
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
|
-
// "
|
|
833
|
-
// "
|
|
834
|
-
// "
|
|
835
|
-
// "
|
|
836
|
-
// "
|
|
837
|
-
// "
|
|
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
|
-
// "
|
|
840
|
-
// "
|
|
841
|
-
// "
|
|
842
|
-
// "
|
|
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
|
|
855
|
-
const
|
|
856
|
-
|
|
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':
|
|
861
|
-
'datetime':
|
|
854
|
+
'timestamp': undefined,
|
|
855
|
+
'datetime': undefined,
|
|
862
856
|
'high': this.safeString(ticker, 'high'),
|
|
863
857
|
'low': this.safeString(ticker, 'low'),
|
|
864
|
-
'bid':
|
|
865
|
-
'bidVolume': this.safeString(ticker, '
|
|
866
|
-
'ask':
|
|
867
|
-
'askVolume': this.safeString(ticker, '
|
|
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':
|
|
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.
|
|
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://
|
|
887
|
-
* @see https://
|
|
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.
|
|
893
|
+
response = await this.v2PublicGetFuturesTicker(this.extend(request, params));
|
|
900
894
|
}
|
|
901
895
|
else {
|
|
902
|
-
response = await this.
|
|
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
|
-
//
|
|
911
|
-
//
|
|
912
|
-
// "
|
|
913
|
-
// "
|
|
914
|
-
// "
|
|
915
|
-
// "
|
|
916
|
-
// "
|
|
917
|
-
// "
|
|
918
|
-
// "
|
|
919
|
-
// "
|
|
920
|
-
// "
|
|
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
|
-
//
|
|
932
|
-
//
|
|
933
|
-
// "
|
|
934
|
-
// "
|
|
935
|
-
// "
|
|
936
|
-
// "
|
|
937
|
-
// "
|
|
938
|
-
// "
|
|
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
|
-
// "
|
|
941
|
-
// "
|
|
942
|
-
// "
|
|
943
|
-
// "
|
|
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
|
-
|
|
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://
|
|
966
|
-
* @see https://
|
|
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.
|
|
970
|
+
response = await this.v2PublicGetFuturesTicker(query);
|
|
982
971
|
}
|
|
983
972
|
else {
|
|
984
|
-
response = await this.
|
|
973
|
+
response = await this.v2PublicGetSpotTicker(query);
|
|
985
974
|
}
|
|
986
975
|
//
|
|
987
976
|
// Spot
|
|
988
977
|
//
|
|
989
978
|
// {
|
|
990
979
|
// "code": 0,
|
|
991
|
-
// "data":
|
|
992
|
-
//
|
|
993
|
-
//
|
|
994
|
-
// "
|
|
995
|
-
//
|
|
996
|
-
//
|
|
997
|
-
//
|
|
998
|
-
//
|
|
999
|
-
//
|
|
1000
|
-
//
|
|
1001
|
-
//
|
|
1002
|
-
//
|
|
1003
|
-
//
|
|
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": "
|
|
994
|
+
// ],
|
|
995
|
+
// "message": "OK"
|
|
1008
996
|
// }
|
|
1009
997
|
//
|
|
1010
998
|
// Swap
|
|
1011
999
|
//
|
|
1012
1000
|
// {
|
|
1013
1001
|
// "code": 0,
|
|
1014
|
-
// "data":
|
|
1015
|
-
//
|
|
1016
|
-
//
|
|
1017
|
-
// "
|
|
1018
|
-
//
|
|
1019
|
-
//
|
|
1020
|
-
//
|
|
1021
|
-
//
|
|
1022
|
-
//
|
|
1023
|
-
//
|
|
1024
|
-
//
|
|
1025
|
-
//
|
|
1026
|
-
//
|
|
1027
|
-
//
|
|
1028
|
-
//
|
|
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": "
|
|
1018
|
+
// ],
|
|
1019
|
+
// "message": "OK"
|
|
1042
1020
|
// }
|
|
1043
1021
|
//
|
|
1044
|
-
const data = this.
|
|
1045
|
-
|
|
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
|
/**
|
package/js/src/cryptocom.js
CHANGED
|
@@ -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.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
2351
|
+
currency = this.safeCurrency(code);
|
|
2352
2352
|
}
|
|
2353
2353
|
if (since !== undefined) {
|
|
2354
2354
|
request['start_time'] = since;
|
package/js/src/hyperliquid.d.ts
CHANGED
|
@@ -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;
|