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/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages, Option, OptionChain, Conversion } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.3.
|
|
7
|
+
declare const version = "4.3.1";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, AuthenticationError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, OperationRejected, NoChange, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, AddressPending, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, ContractUnavailable, NotSupported, ProxyError, ExchangeClosedByUser, OperationFailed, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.3.
|
|
41
|
+
const version = '4.3.2';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -3,7 +3,7 @@ import { // eslint-disable-line object-curly-newline
|
|
|
3
3
|
ExchangeError, AuthenticationError, DDoSProtection, RequestTimeout, ExchangeNotAvailable, RateLimitExceeded } from "./errors.js";
|
|
4
4
|
import WsClient from './ws/WsClient.js';
|
|
5
5
|
import { OrderBook as WsOrderBook, IndexedOrderBook, CountedOrderBook } from './ws/OrderBook.js';
|
|
6
|
-
import type { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRate, DepositWithdrawFeeNetwork, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Option, OptionChain, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account, Strings, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion } from './types.js';
|
|
6
|
+
import type { Market, Trade, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, FundingRate, DepositWithdrawFeeNetwork, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Option, OptionChain, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account, Strings, MarginModification, TradingFeeInterface, Currencies, TradingFees, Conversion, CancellationRequest } from './types.js';
|
|
7
7
|
export type { Market, Trade, Fee, Ticker, OHLCV, OHLCVC, Order, OrderBook, Balance, Balances, Dictionary, Transaction, DepositAddressResponse, Currency, MinMax, IndexType, Int, OrderType, OrderSide, Position, LedgerEntry, BorrowInterest, OpenInterest, LeverageTier, TransferEntry, BorrowRate, FundingRateHistory, Liquidation, FundingHistory, OrderRequest, MarginMode, Tickers, Greeks, Option, OptionChain, Str, Num, MarketInterface, CurrencyInterface, BalanceAccount, MarginModes, MarketType, Leverage, Leverages, LastPrice, LastPrices, Account, Strings, Conversion } from './types.js';
|
|
8
8
|
import { ArrayCache, ArrayCacheByTimestamp } from './ws/Cache.js';
|
|
9
9
|
import { OrderBook as Ob } from './ws/OrderBook.js';
|
|
@@ -894,6 +894,7 @@ export default class Exchange {
|
|
|
894
894
|
cancelOrderWs(id: string, symbol?: Str, params?: {}): Promise<{}>;
|
|
895
895
|
cancelOrdersWs(ids: string[], symbol?: Str, params?: {}): Promise<{}>;
|
|
896
896
|
cancelAllOrders(symbol?: Str, params?: {}): Promise<{}>;
|
|
897
|
+
cancelOrdersForSymbols(orders: CancellationRequest[], params?: {}): Promise<{}>;
|
|
897
898
|
cancelAllOrdersWs(symbol?: Str, params?: {}): Promise<{}>;
|
|
898
899
|
cancelUnifiedOrder(order: any, params?: {}): Promise<{}>;
|
|
899
900
|
fetchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -4464,6 +4464,9 @@ export default class Exchange {
|
|
|
4464
4464
|
async cancelAllOrders(symbol = undefined, params = {}) {
|
|
4465
4465
|
throw new NotSupported(this.id + ' cancelAllOrders() is not supported yet');
|
|
4466
4466
|
}
|
|
4467
|
+
async cancelOrdersForSymbols(orders, params = {}) {
|
|
4468
|
+
throw new NotSupported(this.id + ' cancelOrdersForSymbols() is not supported yet');
|
|
4469
|
+
}
|
|
4467
4470
|
async cancelAllOrdersWs(symbol = undefined, params = {}) {
|
|
4468
4471
|
throw new NotSupported(this.id + ' cancelAllOrdersWs() is not supported yet');
|
|
4469
4472
|
}
|
package/js/src/base/types.d.ts
CHANGED
|
@@ -393,6 +393,11 @@ export interface OrderRequest {
|
|
|
393
393
|
price?: number | undefined;
|
|
394
394
|
params?: any;
|
|
395
395
|
}
|
|
396
|
+
export interface CancellationRequest {
|
|
397
|
+
id: string;
|
|
398
|
+
clientOrderId?: string;
|
|
399
|
+
symbol: string;
|
|
400
|
+
}
|
|
396
401
|
export interface FundingHistory {
|
|
397
402
|
info: any;
|
|
398
403
|
symbol: string;
|
package/js/src/bitget.js
CHANGED
|
@@ -8653,6 +8653,8 @@ export default class bitget extends Exchange {
|
|
|
8653
8653
|
//
|
|
8654
8654
|
// spot
|
|
8655
8655
|
//
|
|
8656
|
+
// {"code":"00000","msg":"success","requestTime":1713294492511,"data":[...]}"
|
|
8657
|
+
//
|
|
8656
8658
|
// {"status":"fail","err_code":"01001","err_msg":"系统异常,请稍后重试"}
|
|
8657
8659
|
// {"status":"error","ts":1595594160149,"err_code":"invalid-parameter","err_msg":"invalid size, valid range: [1,2000]"}
|
|
8658
8660
|
// {"status":"error","ts":1595684716042,"err_code":"invalid-parameter","err_msg":"illegal sign invalid"}
|
|
@@ -8674,14 +8676,14 @@ export default class bitget extends Exchange {
|
|
|
8674
8676
|
// {"code":"40108","msg":"","requestTime":1595885064600,"data":null}
|
|
8675
8677
|
// {"order_id":"513468410013679613","client_oid":null,"symbol":"ethusd","result":false,"err_code":"order_no_exist_error","err_msg":"订单不存在!"}
|
|
8676
8678
|
//
|
|
8677
|
-
const message = this.
|
|
8678
|
-
const errorCode = this.safeString2(response, 'code', 'err_code');
|
|
8679
|
+
const message = this.safeString2(response, 'err_msg', 'msg');
|
|
8679
8680
|
const feedback = this.id + ' ' + body;
|
|
8680
|
-
const nonEmptyMessage = ((message !== undefined) && (message !== ''));
|
|
8681
|
+
const nonEmptyMessage = ((message !== undefined) && (message !== '') && (message !== 'success'));
|
|
8681
8682
|
if (nonEmptyMessage) {
|
|
8682
8683
|
this.throwExactlyMatchedException(this.exceptions['exact'], message, feedback);
|
|
8683
8684
|
this.throwBroadlyMatchedException(this.exceptions['broad'], message, feedback);
|
|
8684
8685
|
}
|
|
8686
|
+
const errorCode = this.safeString2(response, 'code', 'err_code');
|
|
8685
8687
|
const nonZeroErrorCode = (errorCode !== undefined) && (errorCode !== '00000');
|
|
8686
8688
|
if (nonZeroErrorCode) {
|
|
8687
8689
|
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
|
package/js/src/coinbasepro.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export default class coinbasepro extends Exchange {
|
|
|
62
62
|
fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
63
63
|
fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
64
64
|
fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
65
|
-
parseTransactionStatus(transaction: any): "ok" | "
|
|
65
|
+
parseTransactionStatus(transaction: any): "ok" | "failed" | "canceled" | "pending";
|
|
66
66
|
parseTransaction(transaction: any, currency?: Currency): Transaction;
|
|
67
67
|
createDepositAddress(code: string, params?: {}): Promise<{
|
|
68
68
|
currency: string;
|
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[]>;
|