ccxt 4.4.29__py2.py3-none-any.whl → 4.4.31__py2.py3-none-any.whl
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.
- ccxt/__init__.py +1 -1
- ccxt/abstract/alpaca.py +1 -0
- ccxt/abstract/binance.py +9 -0
- ccxt/abstract/binancecoinm.py +9 -0
- ccxt/abstract/binanceus.py +9 -0
- ccxt/abstract/binanceusdm.py +9 -0
- ccxt/ace.py +36 -12
- ccxt/alpaca.py +113 -28
- ccxt/ascendex.py +65 -30
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ace.py +36 -12
- ccxt/async_support/alpaca.py +113 -28
- ccxt/async_support/ascendex.py +65 -30
- ccxt/async_support/base/exchange.py +3 -3
- ccxt/async_support/bigone.py +71 -27
- ccxt/async_support/binance.py +564 -323
- ccxt/async_support/bingx.py +208 -108
- ccxt/async_support/bit2c.py +34 -12
- ccxt/async_support/bitbank.py +42 -14
- ccxt/async_support/bitbns.py +29 -21
- ccxt/async_support/bitfinex.py +77 -33
- ccxt/async_support/bitfinex2.py +116 -44
- ccxt/async_support/bitflyer.py +54 -18
- ccxt/async_support/bitget.py +277 -145
- ccxt/async_support/bithumb.py +39 -14
- ccxt/async_support/bitmart.py +198 -132
- ccxt/async_support/bitmex.py +90 -30
- ccxt/async_support/bitopro.py +66 -22
- ccxt/async_support/bitrue.py +109 -57
- ccxt/async_support/bitso.py +55 -19
- ccxt/async_support/bitstamp.py +84 -36
- ccxt/async_support/bitteam.py +51 -17
- ccxt/async_support/bitvavo.py +57 -19
- ccxt/async_support/bl3p.py +26 -10
- ccxt/async_support/blockchaincom.py +63 -21
- ccxt/async_support/blofin.py +95 -38
- ccxt/async_support/btcalpha.py +48 -16
- ccxt/async_support/btcbox.py +27 -9
- ccxt/async_support/btcmarkets.py +57 -19
- ccxt/async_support/btcturk.py +36 -12
- ccxt/async_support/bybit.py +251 -95
- ccxt/async_support/cex.py +65 -22
- ccxt/async_support/coinbase.py +138 -56
- ccxt/async_support/coinbaseexchange.py +76 -28
- ccxt/async_support/coinbaseinternational.py +75 -27
- ccxt/async_support/coincatch.py +191 -97
- ccxt/async_support/coincheck.py +33 -11
- ccxt/async_support/coinex.py +212 -101
- ccxt/async_support/coinlist.py +87 -30
- ccxt/async_support/coinmate.py +55 -24
- ccxt/async_support/coinmetro.py +52 -18
- ccxt/async_support/coinone.py +27 -10
- ccxt/async_support/coinsph.py +73 -27
- ccxt/async_support/coinspot.py +25 -9
- ccxt/async_support/cryptocom.py +103 -38
- ccxt/async_support/currencycom.py +70 -23
- ccxt/async_support/delta.py +90 -30
- ccxt/async_support/deribit.py +138 -53
- ccxt/async_support/digifinex.py +114 -51
- ccxt/async_support/exmo.py +104 -45
- ccxt/async_support/gate.py +298 -155
- ccxt/async_support/gemini.py +57 -20
- ccxt/async_support/hashkey.py +151 -66
- ccxt/async_support/hitbtc.py +156 -73
- ccxt/async_support/hollaex.py +76 -25
- ccxt/async_support/htx.py +297 -240
- ccxt/async_support/huobijp.py +1 -0
- ccxt/async_support/hyperliquid.py +203 -42
- ccxt/async_support/idex.py +73 -24
- ccxt/async_support/independentreserve.py +12 -5
- ccxt/async_support/indodax.py +53 -16
- ccxt/async_support/kraken.py +107 -35
- ccxt/async_support/krakenfutures.py +88 -34
- ccxt/async_support/kucoin.py +211 -109
- ccxt/async_support/kucoinfutures.py +119 -42
- ccxt/async_support/kuna.py +80 -39
- ccxt/async_support/latoken.py +70 -33
- ccxt/async_support/lbank.py +90 -39
- ccxt/async_support/luno.py +54 -19
- ccxt/async_support/lykke.py +54 -19
- ccxt/async_support/mercado.py +1 -0
- ccxt/async_support/mexc.py +226 -108
- ccxt/async_support/ndax.py +58 -19
- ccxt/async_support/novadax.py +67 -22
- ccxt/async_support/oceanex.py +58 -19
- ccxt/async_support/okcoin.py +81 -38
- ccxt/async_support/okx.py +270 -109
- ccxt/async_support/onetrading.py +3 -1
- ccxt/async_support/oxfun.py +95 -36
- ccxt/async_support/p2b.py +49 -23
- ccxt/async_support/paradex.py +75 -27
- ccxt/async_support/paymium.py +31 -11
- ccxt/async_support/phemex.py +91 -41
- ccxt/async_support/poloniex.py +80 -30
- ccxt/async_support/poloniexfutures.py +72 -30
- ccxt/async_support/probit.py +64 -22
- ccxt/async_support/timex.py +58 -19
- ccxt/async_support/tokocrypto.py +63 -22
- ccxt/async_support/tradeogre.py +7 -2
- ccxt/async_support/upbit.py +72 -25
- ccxt/async_support/vertex.py +74 -28
- ccxt/async_support/wavesexchange.py +29 -8
- ccxt/async_support/wazirx.py +51 -17
- ccxt/async_support/whitebit.py +105 -41
- ccxt/async_support/woo.py +162 -65
- ccxt/async_support/woofipro.py +118 -49
- ccxt/async_support/xt.py +150 -73
- ccxt/async_support/yobit.py +49 -16
- ccxt/async_support/zaif.py +30 -10
- ccxt/async_support/zonda.py +46 -16
- ccxt/base/exchange.py +34 -34
- ccxt/base/types.py +1 -0
- ccxt/bigone.py +71 -27
- ccxt/binance.py +564 -323
- ccxt/bingx.py +208 -108
- ccxt/bit2c.py +34 -12
- ccxt/bitbank.py +42 -14
- ccxt/bitbns.py +29 -21
- ccxt/bitfinex.py +77 -33
- ccxt/bitfinex2.py +116 -44
- ccxt/bitflyer.py +54 -18
- ccxt/bitget.py +277 -145
- ccxt/bithumb.py +39 -14
- ccxt/bitmart.py +198 -132
- ccxt/bitmex.py +90 -30
- ccxt/bitopro.py +66 -22
- ccxt/bitrue.py +109 -57
- ccxt/bitso.py +55 -19
- ccxt/bitstamp.py +84 -36
- ccxt/bitteam.py +51 -17
- ccxt/bitvavo.py +57 -19
- ccxt/bl3p.py +26 -10
- ccxt/blockchaincom.py +63 -21
- ccxt/blofin.py +95 -38
- ccxt/btcalpha.py +48 -16
- ccxt/btcbox.py +27 -9
- ccxt/btcmarkets.py +57 -19
- ccxt/btcturk.py +36 -12
- ccxt/bybit.py +251 -95
- ccxt/cex.py +65 -22
- ccxt/coinbase.py +138 -56
- ccxt/coinbaseexchange.py +76 -28
- ccxt/coinbaseinternational.py +75 -27
- ccxt/coincatch.py +191 -97
- ccxt/coincheck.py +33 -11
- ccxt/coinex.py +212 -101
- ccxt/coinlist.py +87 -30
- ccxt/coinmate.py +55 -24
- ccxt/coinmetro.py +52 -18
- ccxt/coinone.py +27 -10
- ccxt/coinsph.py +73 -27
- ccxt/coinspot.py +25 -9
- ccxt/cryptocom.py +103 -38
- ccxt/currencycom.py +70 -23
- ccxt/delta.py +90 -30
- ccxt/deribit.py +138 -53
- ccxt/digifinex.py +114 -51
- ccxt/exmo.py +104 -45
- ccxt/gate.py +298 -155
- ccxt/gemini.py +57 -20
- ccxt/hashkey.py +151 -66
- ccxt/hitbtc.py +156 -73
- ccxt/hollaex.py +76 -25
- ccxt/htx.py +297 -240
- ccxt/huobijp.py +1 -0
- ccxt/hyperliquid.py +203 -42
- ccxt/idex.py +73 -24
- ccxt/independentreserve.py +12 -5
- ccxt/indodax.py +53 -16
- ccxt/kraken.py +107 -35
- ccxt/krakenfutures.py +88 -34
- ccxt/kucoin.py +211 -109
- ccxt/kucoinfutures.py +119 -42
- ccxt/kuna.py +80 -39
- ccxt/latoken.py +70 -33
- ccxt/lbank.py +90 -39
- ccxt/luno.py +54 -19
- ccxt/lykke.py +54 -19
- ccxt/mercado.py +1 -0
- ccxt/mexc.py +226 -108
- ccxt/ndax.py +58 -19
- ccxt/novadax.py +67 -22
- ccxt/oceanex.py +58 -19
- ccxt/okcoin.py +81 -38
- ccxt/okx.py +270 -109
- ccxt/onetrading.py +3 -1
- ccxt/oxfun.py +95 -36
- ccxt/p2b.py +49 -23
- ccxt/paradex.py +75 -27
- ccxt/paymium.py +31 -11
- ccxt/phemex.py +91 -41
- ccxt/poloniex.py +80 -30
- ccxt/poloniexfutures.py +72 -30
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/alpaca.py +15 -5
- ccxt/pro/ascendex.py +18 -6
- ccxt/pro/binance.py +200 -119
- ccxt/pro/bingx.py +44 -24
- ccxt/pro/bitfinex.py +13 -5
- ccxt/pro/bitget.py +75 -36
- ccxt/pro/bithumb.py +12 -4
- ccxt/pro/bitmart.py +44 -20
- ccxt/pro/bitmex.py +42 -14
- ccxt/pro/bitopro.py +15 -5
- ccxt/pro/bitrue.py +7 -3
- ccxt/pro/bitvavo.py +51 -17
- ccxt/pro/blockchaincom.py +18 -6
- ccxt/pro/blofin.py +38 -13
- ccxt/pro/bybit.py +100 -42
- ccxt/pro/cex.py +48 -16
- ccxt/pro/coinbase.py +32 -12
- ccxt/pro/coinbaseexchange.py +1 -1
- ccxt/pro/coinbaseinternational.py +34 -14
- ccxt/pro/coincatch.py +54 -19
- ccxt/pro/coincheck.py +6 -2
- ccxt/pro/coinex.py +40 -20
- ccxt/pro/coinone.py +9 -3
- ccxt/pro/cryptocom.py +70 -26
- ccxt/pro/deribit.py +36 -12
- ccxt/pro/exmo.py +10 -4
- ccxt/pro/gate.py +64 -30
- ccxt/pro/gemini.py +21 -7
- ccxt/pro/hashkey.py +26 -8
- ccxt/pro/hitbtc.py +61 -37
- ccxt/pro/hollaex.py +15 -5
- ccxt/pro/htx.py +39 -21
- ccxt/pro/hyperliquid.py +41 -14
- ccxt/pro/kraken.py +49 -17
- ccxt/pro/krakenfutures.py +47 -24
- ccxt/pro/kucoin.py +60 -31
- ccxt/pro/kucoinfutures.py +41 -19
- ccxt/pro/lbank.py +27 -9
- ccxt/pro/luno.py +3 -1
- ccxt/pro/mexc.py +35 -17
- ccxt/pro/ndax.py +12 -4
- ccxt/pro/okcoin.py +18 -6
- ccxt/pro/okx.py +76 -28
- ccxt/pro/onetrading.py +21 -7
- ccxt/pro/oxfun.py +54 -20
- ccxt/pro/p2b.py +23 -11
- ccxt/pro/paradex.py +12 -4
- ccxt/pro/phemex.py +31 -19
- ccxt/pro/poloniex.py +50 -22
- ccxt/pro/poloniexfutures.py +17 -7
- ccxt/pro/probit.py +18 -6
- ccxt/pro/upbit.py +25 -9
- ccxt/pro/vertex.py +20 -6
- ccxt/pro/wazirx.py +21 -7
- ccxt/pro/whitebit.py +25 -9
- ccxt/pro/woo.py +32 -12
- ccxt/pro/woofipro.py +35 -13
- ccxt/pro/xt.py +46 -26
- ccxt/probit.py +64 -22
- ccxt/test/tests_helpers.py +2 -2
- ccxt/timex.py +58 -19
- ccxt/tokocrypto.py +63 -22
- ccxt/tradeogre.py +7 -2
- ccxt/upbit.py +72 -25
- ccxt/vertex.py +74 -28
- ccxt/wavesexchange.py +29 -8
- ccxt/wazirx.py +51 -17
- ccxt/whitebit.py +105 -41
- ccxt/woo.py +162 -65
- ccxt/woofipro.py +118 -49
- ccxt/xt.py +150 -73
- ccxt/yobit.py +49 -16
- ccxt/zaif.py +30 -10
- ccxt/zonda.py +46 -16
- {ccxt-4.4.29.dist-info → ccxt-4.4.31.dist-info}/METADATA +5 -5
- {ccxt-4.4.29.dist-info → ccxt-4.4.31.dist-info}/RECORD +273 -273
- {ccxt-4.4.29.dist-info → ccxt-4.4.31.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.29.dist-info → ccxt-4.4.31.dist-info}/WHEEL +0 -0
- {ccxt-4.4.29.dist-info → ccxt-4.4.31.dist-info}/top_level.txt +0 -0
ccxt/huobijp.py
CHANGED
@@ -1117,6 +1117,7 @@ class huobijp(Exchange, ImplicitAPI):
|
|
1117
1117
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
1118
1118
|
"""
|
1119
1119
|
fetches information on an order made by the user
|
1120
|
+
:param str id: order id
|
1120
1121
|
:param str symbol: unified symbol of the market the order was made in
|
1121
1122
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1122
1123
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
ccxt/hyperliquid.py
CHANGED
@@ -5,7 +5,8 @@
|
|
5
5
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.hyperliquid import ImplicitAPI
|
8
|
-
|
8
|
+
import math
|
9
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, LedgerEntry, MarginModification, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, Transaction, TransferEntry
|
9
10
|
from typing import List
|
10
11
|
from ccxt.base.errors import ExchangeError
|
11
12
|
from ccxt.base.errors import ArgumentsRequired
|
@@ -74,7 +75,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
74
75
|
'fetchFundingHistory': False,
|
75
76
|
'fetchFundingRate': False,
|
76
77
|
'fetchFundingRateHistory': True,
|
77
|
-
'fetchFundingRates':
|
78
|
+
'fetchFundingRates': True,
|
78
79
|
'fetchIndexOHLCV': False,
|
79
80
|
'fetchIsolatedBorrowRate': False,
|
80
81
|
'fetchIsolatedBorrowRates': False,
|
@@ -130,12 +131,12 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
130
131
|
'1h': '1h',
|
131
132
|
'2h': '2h',
|
132
133
|
'4h': '4h',
|
133
|
-
'
|
134
|
+
'8h': '8h',
|
134
135
|
'12h': '12h',
|
135
136
|
'1d': '1d',
|
136
137
|
'3d': '3d',
|
137
138
|
'1w': '1w',
|
138
|
-
'1M': '
|
139
|
+
'1M': '1M',
|
139
140
|
},
|
140
141
|
'hostname': 'hyperliquid.xyz',
|
141
142
|
'urls': {
|
@@ -227,7 +228,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
227
228
|
def fetch_currencies(self, params={}) -> Currencies:
|
228
229
|
"""
|
229
230
|
fetches all available currencies on an exchange
|
230
|
-
|
231
|
+
|
232
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-metadata
|
233
|
+
|
231
234
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
232
235
|
:returns dict: an associative dictionary of currencies
|
233
236
|
"""
|
@@ -283,8 +286,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
283
286
|
def fetch_markets(self, params={}) -> List[Market]:
|
284
287
|
"""
|
285
288
|
retrieves data on all markets for hyperliquid
|
286
|
-
|
287
|
-
|
289
|
+
|
290
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc
|
291
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-asset-contexts
|
292
|
+
|
288
293
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
289
294
|
:returns dict[]: an array of objects representing market data
|
290
295
|
"""
|
@@ -300,7 +305,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
300
305
|
def fetch_swap_markets(self, params={}) -> List[Market]:
|
301
306
|
"""
|
302
307
|
retrieves data on all swap markets for hyperliquid
|
303
|
-
|
308
|
+
|
309
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc
|
310
|
+
|
304
311
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
305
312
|
:returns dict[]: an array of objects representing market data
|
306
313
|
"""
|
@@ -355,7 +362,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
355
362
|
def fetch_spot_markets(self, params={}) -> List[Market]:
|
356
363
|
"""
|
357
364
|
retrieves data on all spot markets for hyperliquid
|
358
|
-
|
365
|
+
|
366
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-asset-contexts
|
367
|
+
|
359
368
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
360
369
|
:returns dict[]: an array of objects representing market data
|
361
370
|
"""
|
@@ -414,7 +423,8 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
414
423
|
markets = []
|
415
424
|
for i in range(0, len(meta)):
|
416
425
|
market = self.safe_dict(meta, i, {})
|
417
|
-
|
426
|
+
index = self.safe_integer(market, 'index')
|
427
|
+
extraData = self.safe_dict(second, index, {})
|
418
428
|
marketName = self.safe_string(market, 'name')
|
419
429
|
# if marketName.find('/') < 0:
|
420
430
|
# # there are some weird spot markets in testnet, eg @2
|
@@ -587,8 +597,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
587
597
|
def fetch_balance(self, params={}) -> Balances:
|
588
598
|
"""
|
589
599
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
590
|
-
|
591
|
-
|
600
|
+
|
601
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-a-users-token-balances
|
602
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-perpetuals-account-summary
|
603
|
+
|
592
604
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
593
605
|
:param str [params.user]: user address, will default to self.walletAddress if not provided
|
594
606
|
:param str [params.type]: wallet type, ['spot', 'swap'], defaults to swap
|
@@ -669,7 +681,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
669
681
|
def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
670
682
|
"""
|
671
683
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
672
|
-
|
684
|
+
|
685
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#l2-book-snapshot
|
686
|
+
|
673
687
|
:param str symbol: unified symbol of the market to fetch the order book for
|
674
688
|
:param int [limit]: the maximum amount of order book entries to return
|
675
689
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -715,8 +729,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
715
729
|
def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
716
730
|
"""
|
717
731
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
718
|
-
|
719
|
-
|
732
|
+
|
733
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc
|
734
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-asset-contexts
|
735
|
+
|
720
736
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
721
737
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
722
738
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -735,6 +751,113 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
735
751
|
result[symbol] = ticker
|
736
752
|
return self.filter_by_array_tickers(result, 'symbol', symbols)
|
737
753
|
|
754
|
+
def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
755
|
+
"""
|
756
|
+
retrieves data on all swap markets for hyperliquid
|
757
|
+
|
758
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc
|
759
|
+
|
760
|
+
:param str[] [symbols]: list of unified market symbols
|
761
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
762
|
+
:returns dict[]: an array of objects representing market data
|
763
|
+
"""
|
764
|
+
request: dict = {
|
765
|
+
'type': 'metaAndAssetCtxs',
|
766
|
+
}
|
767
|
+
response = self.publicPostInfo(self.extend(request, params))
|
768
|
+
#
|
769
|
+
# [
|
770
|
+
# {
|
771
|
+
# "universe": [
|
772
|
+
# {
|
773
|
+
# "maxLeverage": 50,
|
774
|
+
# "name": "SOL",
|
775
|
+
# "onlyIsolated": False,
|
776
|
+
# "szDecimals": 2
|
777
|
+
# }
|
778
|
+
# ]
|
779
|
+
# },
|
780
|
+
# [
|
781
|
+
# {
|
782
|
+
# "dayNtlVlm": "9450588.2273",
|
783
|
+
# "funding": "0.0000198",
|
784
|
+
# "impactPxs": [
|
785
|
+
# "108.04",
|
786
|
+
# "108.06"
|
787
|
+
# ],
|
788
|
+
# "markPx": "108.04",
|
789
|
+
# "midPx": "108.05",
|
790
|
+
# "openInterest": "10764.48",
|
791
|
+
# "oraclePx": "107.99",
|
792
|
+
# "premium": "0.00055561",
|
793
|
+
# "prevDayPx": "111.81"
|
794
|
+
# }
|
795
|
+
# ]
|
796
|
+
# ]
|
797
|
+
#
|
798
|
+
#
|
799
|
+
meta = self.safe_dict(response, 0, {})
|
800
|
+
universe = self.safe_list(meta, 'universe', [])
|
801
|
+
assetCtxs = self.safe_list(response, 1, [])
|
802
|
+
result = []
|
803
|
+
for i in range(0, len(universe)):
|
804
|
+
data = self.extend(
|
805
|
+
self.safe_dict(universe, i, {}),
|
806
|
+
self.safe_dict(assetCtxs, i, {})
|
807
|
+
)
|
808
|
+
result.append(data)
|
809
|
+
funding_rates = self.parse_funding_rates(result)
|
810
|
+
return self.filter_by_array(funding_rates, 'symbol', symbols)
|
811
|
+
|
812
|
+
def parse_funding_rate(self, info, market: Market = None) -> FundingRate:
|
813
|
+
#
|
814
|
+
# {
|
815
|
+
# "maxLeverage": "50",
|
816
|
+
# "name": "ETH",
|
817
|
+
# "onlyIsolated": False,
|
818
|
+
# "szDecimals": "4",
|
819
|
+
# "dayNtlVlm": "1709813.11535",
|
820
|
+
# "funding": "0.00004807",
|
821
|
+
# "impactPxs": [
|
822
|
+
# "2369.3",
|
823
|
+
# "2369.6"
|
824
|
+
# ],
|
825
|
+
# "markPx": "2369.6",
|
826
|
+
# "midPx": "2369.45",
|
827
|
+
# "openInterest": "1815.4712",
|
828
|
+
# "oraclePx": "2367.3",
|
829
|
+
# "premium": "0.00090821",
|
830
|
+
# "prevDayPx": "2381.5"
|
831
|
+
# }
|
832
|
+
#
|
833
|
+
base = self.safe_string(info, 'name')
|
834
|
+
marketId = self.coin_to_market_id(base)
|
835
|
+
symbol = self.safe_symbol(marketId, market)
|
836
|
+
funding = self.safe_number(info, 'funding')
|
837
|
+
markPx = self.safe_number(info, 'markPx')
|
838
|
+
oraclePx = self.safe_number(info, 'oraclePx')
|
839
|
+
fundingTimestamp = (int(math.floor(self.milliseconds()) / 60 / 60 / 1000) + 1) * 60 * 60 * 1000
|
840
|
+
return {
|
841
|
+
'info': info,
|
842
|
+
'symbol': symbol,
|
843
|
+
'markPrice': markPx,
|
844
|
+
'indexPrice': oraclePx,
|
845
|
+
'interestRate': None,
|
846
|
+
'estimatedSettlePrice': None,
|
847
|
+
'timestamp': None,
|
848
|
+
'datetime': None,
|
849
|
+
'fundingRate': funding,
|
850
|
+
'fundingTimestamp': fundingTimestamp,
|
851
|
+
'fundingDatetime': self.iso8601(fundingTimestamp),
|
852
|
+
'nextFundingRate': None,
|
853
|
+
'nextFundingTimestamp': None,
|
854
|
+
'nextFundingDatetime': None,
|
855
|
+
'previousFundingRate': None,
|
856
|
+
'previousFundingTimestamp': None,
|
857
|
+
'previousFundingDatetime': None,
|
858
|
+
'interval': '1h',
|
859
|
+
}
|
860
|
+
|
738
861
|
def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
|
739
862
|
#
|
740
863
|
# {
|
@@ -767,7 +890,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
767
890
|
def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
768
891
|
"""
|
769
892
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
770
|
-
|
893
|
+
|
894
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#candle-snapshot
|
895
|
+
|
771
896
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
772
897
|
:param str timeframe: the length of time each candle represents, support '1m', '15m', '1h', '1d'
|
773
898
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
@@ -794,7 +919,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
794
919
|
'type': 'candleSnapshot',
|
795
920
|
'req': {
|
796
921
|
'coin': market['base'] if market['swap'] else market['id'],
|
797
|
-
'interval': timeframe,
|
922
|
+
'interval': self.safe_string(self.timeframes, timeframe, timeframe),
|
798
923
|
'startTime': since,
|
799
924
|
'endTime': until,
|
800
925
|
},
|
@@ -845,8 +970,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
845
970
|
def fetch_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
846
971
|
"""
|
847
972
|
get the list of most recent trades for a particular symbol
|
848
|
-
|
849
|
-
|
973
|
+
|
974
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills
|
975
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills-by-time
|
976
|
+
|
850
977
|
:param str symbol: unified market symbol
|
851
978
|
:param int [since]: the earliest time in ms to fetch trades for
|
852
979
|
:param int [limit]: the maximum number of trades structures to retrieve
|
@@ -1021,7 +1148,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1021
1148
|
def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
1022
1149
|
"""
|
1023
1150
|
create a trade order
|
1024
|
-
|
1151
|
+
|
1152
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
|
1153
|
+
|
1025
1154
|
:param str symbol: unified symbol of the market to create an order in
|
1026
1155
|
:param str type: 'market' or 'limit'
|
1027
1156
|
:param str side: 'buy' or 'sell'
|
@@ -1045,8 +1174,11 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1045
1174
|
def create_orders(self, orders: List[OrderRequest], params={}):
|
1046
1175
|
"""
|
1047
1176
|
create a list of trade orders
|
1048
|
-
|
1177
|
+
|
1178
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
|
1179
|
+
|
1049
1180
|
:param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
1181
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1050
1182
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1051
1183
|
"""
|
1052
1184
|
self.load_markets()
|
@@ -1077,7 +1209,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1077
1209
|
def create_orders_request(self, orders, params={}) -> dict:
|
1078
1210
|
"""
|
1079
1211
|
create a list of trade orders
|
1080
|
-
|
1212
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
|
1081
1213
|
:param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
1082
1214
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1083
1215
|
"""
|
@@ -1189,8 +1321,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1189
1321
|
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
1190
1322
|
"""
|
1191
1323
|
cancels an open order
|
1192
|
-
|
1193
|
-
|
1324
|
+
|
1325
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
|
1326
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
|
1327
|
+
|
1194
1328
|
:param str id: order id
|
1195
1329
|
:param str symbol: unified symbol of the market the order was made in
|
1196
1330
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1204,8 +1338,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1204
1338
|
def cancel_orders(self, ids: List[str], symbol: Str = None, params={}):
|
1205
1339
|
"""
|
1206
1340
|
cancel multiple orders
|
1207
|
-
|
1208
|
-
|
1341
|
+
|
1342
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
|
1343
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
|
1344
|
+
|
1209
1345
|
:param str[] ids: order ids
|
1210
1346
|
:param str [symbol]: unified market symbol
|
1211
1347
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1284,8 +1420,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1284
1420
|
def cancel_orders_for_symbols(self, orders: List[CancellationRequest], params={}):
|
1285
1421
|
"""
|
1286
1422
|
cancel multiple orders for multiple symbols
|
1287
|
-
|
1288
|
-
|
1423
|
+
|
1424
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
|
1425
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
|
1426
|
+
|
1289
1427
|
:param CancellationRequest[] orders: each order should contain the parameters required by cancelOrder namely id and symbol, example [{"id": "a", "symbol": "BTC/USDT"}, {"id": "b", "symbol": "ETH/USDT"}]
|
1290
1428
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1291
1429
|
:param str [params.vaultAddress]: the vault address
|
@@ -1468,8 +1606,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1468
1606
|
def edit_order(self, id: str, symbol: str, type: str, side: str, amount: Num = None, price: Num = None, params={}):
|
1469
1607
|
"""
|
1470
1608
|
edit a trade order
|
1471
|
-
|
1472
|
-
|
1609
|
+
|
1610
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
|
1611
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
|
1612
|
+
|
1473
1613
|
:param str id: cancel order id
|
1474
1614
|
:param str symbol: unified symbol of the market to create an order in
|
1475
1615
|
:param str type: 'market' or 'limit'
|
@@ -1533,7 +1673,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1533
1673
|
def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1534
1674
|
"""
|
1535
1675
|
fetches historical funding rate prices
|
1536
|
-
|
1676
|
+
|
1677
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-historical-funding-rates
|
1678
|
+
|
1537
1679
|
:param str symbol: unified symbol of the market to fetch the funding rate history for
|
1538
1680
|
:param int [since]: timestamp in ms of the earliest funding rate to fetch
|
1539
1681
|
:param int [limit]: the maximum amount of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>` to fetch
|
@@ -1584,7 +1726,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1584
1726
|
def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
1585
1727
|
"""
|
1586
1728
|
fetch all unfilled currently open orders
|
1587
|
-
|
1729
|
+
|
1730
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-open-orders
|
1731
|
+
|
1588
1732
|
:param str symbol: unified market symbol
|
1589
1733
|
:param int [since]: the earliest time in ms to fetch open orders for
|
1590
1734
|
:param int [limit]: the maximum number of open orders structures to retrieve
|
@@ -1708,7 +1852,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1708
1852
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
1709
1853
|
"""
|
1710
1854
|
fetches information on an order made by the user
|
1711
|
-
|
1855
|
+
|
1856
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-order-status-by-oid-or-cloid
|
1857
|
+
|
1858
|
+
:param str id: order id
|
1712
1859
|
:param str symbol: unified symbol of the market the order was made in
|
1713
1860
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1714
1861
|
:param str [params.user]: user address, will default to self.walletAddress if not provided
|
@@ -1914,8 +2061,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1914
2061
|
def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1915
2062
|
"""
|
1916
2063
|
fetch all trades made by the user
|
1917
|
-
|
1918
|
-
|
2064
|
+
|
2065
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills
|
2066
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills-by-time
|
2067
|
+
|
1919
2068
|
:param str symbol: unified market symbol
|
1920
2069
|
:param int [since]: the earliest time in ms to fetch trades for
|
1921
2070
|
:param int [limit]: the maximum number of trades structures to retrieve
|
@@ -2017,7 +2166,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2017
2166
|
def fetch_position(self, symbol: str, params={}):
|
2018
2167
|
"""
|
2019
2168
|
fetch data on an open position
|
2020
|
-
|
2169
|
+
|
2170
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-perpetuals-account-summary
|
2171
|
+
|
2021
2172
|
:param str symbol: unified market symbol of the market the position is held in
|
2022
2173
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2023
2174
|
:param str [params.user]: user address, will default to self.walletAddress if not provided
|
@@ -2029,7 +2180,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2029
2180
|
def fetch_positions(self, symbols: Strings = None, params={}):
|
2030
2181
|
"""
|
2031
2182
|
fetch all open positions
|
2032
|
-
|
2183
|
+
|
2184
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-perpetuals-account-summary
|
2185
|
+
|
2033
2186
|
:param str[] [symbols]: list of unified market symbols
|
2034
2187
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2035
2188
|
:param str [params.user]: user address, will default to self.walletAddress if not provided
|
@@ -2266,7 +2419,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2266
2419
|
def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
2267
2420
|
"""
|
2268
2421
|
add margin
|
2269
|
-
|
2422
|
+
|
2423
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-isolated-margin
|
2424
|
+
|
2270
2425
|
:param str symbol: unified market symbol
|
2271
2426
|
:param float amount: amount of margin to add
|
2272
2427
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2276,7 +2431,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2276
2431
|
|
2277
2432
|
def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
2278
2433
|
"""
|
2279
|
-
|
2434
|
+
|
2435
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-isolated-margin
|
2436
|
+
|
2280
2437
|
remove margin from a position
|
2281
2438
|
:param str symbol: unified market symbol
|
2282
2439
|
:param float amount: the amount of margin to remove
|
@@ -2345,7 +2502,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2345
2502
|
def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
|
2346
2503
|
"""
|
2347
2504
|
transfer currency internally between wallets on the same account
|
2348
|
-
|
2505
|
+
|
2506
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#l1-usdc-transfer
|
2507
|
+
|
2349
2508
|
:param str code: unified currency code
|
2350
2509
|
:param float amount: amount to transfer
|
2351
2510
|
:param str fromAccount: account to transfer from *spot, swap*
|
@@ -2413,8 +2572,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2413
2572
|
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
|
2414
2573
|
"""
|
2415
2574
|
make a withdrawal(only support USDC)
|
2416
|
-
|
2417
|
-
|
2575
|
+
|
2576
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#initiate-a-withdrawal-request
|
2577
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-or-withdraw-from-a-vault
|
2578
|
+
|
2418
2579
|
:param str code: unified currency code
|
2419
2580
|
:param float amount: the amount to withdraw
|
2420
2581
|
:param str address: the address to withdraw to
|