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/async_support/huobijp.py
CHANGED
@@ -1117,6 +1117,7 @@ class huobijp(Exchange, ImplicitAPI):
|
|
1117
1117
|
async 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>`
|
@@ -6,7 +6,8 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.hyperliquid import ImplicitAPI
|
8
8
|
import asyncio
|
9
|
-
|
9
|
+
import math
|
10
|
+
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
|
10
11
|
from typing import List
|
11
12
|
from ccxt.base.errors import ExchangeError
|
12
13
|
from ccxt.base.errors import ArgumentsRequired
|
@@ -75,7 +76,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
75
76
|
'fetchFundingHistory': False,
|
76
77
|
'fetchFundingRate': False,
|
77
78
|
'fetchFundingRateHistory': True,
|
78
|
-
'fetchFundingRates':
|
79
|
+
'fetchFundingRates': True,
|
79
80
|
'fetchIndexOHLCV': False,
|
80
81
|
'fetchIsolatedBorrowRate': False,
|
81
82
|
'fetchIsolatedBorrowRates': False,
|
@@ -131,12 +132,12 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
131
132
|
'1h': '1h',
|
132
133
|
'2h': '2h',
|
133
134
|
'4h': '4h',
|
134
|
-
'
|
135
|
+
'8h': '8h',
|
135
136
|
'12h': '12h',
|
136
137
|
'1d': '1d',
|
137
138
|
'3d': '3d',
|
138
139
|
'1w': '1w',
|
139
|
-
'1M': '
|
140
|
+
'1M': '1M',
|
140
141
|
},
|
141
142
|
'hostname': 'hyperliquid.xyz',
|
142
143
|
'urls': {
|
@@ -228,7 +229,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
228
229
|
async def fetch_currencies(self, params={}) -> Currencies:
|
229
230
|
"""
|
230
231
|
fetches all available currencies on an exchange
|
231
|
-
|
232
|
+
|
233
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-metadata
|
234
|
+
|
232
235
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
233
236
|
:returns dict: an associative dictionary of currencies
|
234
237
|
"""
|
@@ -284,8 +287,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
284
287
|
async def fetch_markets(self, params={}) -> List[Market]:
|
285
288
|
"""
|
286
289
|
retrieves data on all markets for hyperliquid
|
287
|
-
|
288
|
-
|
290
|
+
|
291
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc
|
292
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-asset-contexts
|
293
|
+
|
289
294
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
290
295
|
:returns dict[]: an array of objects representing market data
|
291
296
|
"""
|
@@ -301,7 +306,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
301
306
|
async def fetch_swap_markets(self, params={}) -> List[Market]:
|
302
307
|
"""
|
303
308
|
retrieves data on all swap markets for hyperliquid
|
304
|
-
|
309
|
+
|
310
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc
|
311
|
+
|
305
312
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
306
313
|
:returns dict[]: an array of objects representing market data
|
307
314
|
"""
|
@@ -356,7 +363,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
356
363
|
async def fetch_spot_markets(self, params={}) -> List[Market]:
|
357
364
|
"""
|
358
365
|
retrieves data on all spot markets for hyperliquid
|
359
|
-
|
366
|
+
|
367
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-asset-contexts
|
368
|
+
|
360
369
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
361
370
|
:returns dict[]: an array of objects representing market data
|
362
371
|
"""
|
@@ -415,7 +424,8 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
415
424
|
markets = []
|
416
425
|
for i in range(0, len(meta)):
|
417
426
|
market = self.safe_dict(meta, i, {})
|
418
|
-
|
427
|
+
index = self.safe_integer(market, 'index')
|
428
|
+
extraData = self.safe_dict(second, index, {})
|
419
429
|
marketName = self.safe_string(market, 'name')
|
420
430
|
# if marketName.find('/') < 0:
|
421
431
|
# # there are some weird spot markets in testnet, eg @2
|
@@ -588,8 +598,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
588
598
|
async def fetch_balance(self, params={}) -> Balances:
|
589
599
|
"""
|
590
600
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
591
|
-
|
592
|
-
|
601
|
+
|
602
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-a-users-token-balances
|
603
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-perpetuals-account-summary
|
604
|
+
|
593
605
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
594
606
|
:param str [params.user]: user address, will default to self.walletAddress if not provided
|
595
607
|
:param str [params.type]: wallet type, ['spot', 'swap'], defaults to swap
|
@@ -670,7 +682,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
670
682
|
async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
671
683
|
"""
|
672
684
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
673
|
-
|
685
|
+
|
686
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#l2-book-snapshot
|
687
|
+
|
674
688
|
:param str symbol: unified symbol of the market to fetch the order book for
|
675
689
|
:param int [limit]: the maximum amount of order book entries to return
|
676
690
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -716,8 +730,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
716
730
|
async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
717
731
|
"""
|
718
732
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
719
|
-
|
720
|
-
|
733
|
+
|
734
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc
|
735
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/spot#retrieve-spot-asset-contexts
|
736
|
+
|
721
737
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
722
738
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
723
739
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -736,6 +752,113 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
736
752
|
result[symbol] = ticker
|
737
753
|
return self.filter_by_array_tickers(result, 'symbol', symbols)
|
738
754
|
|
755
|
+
async def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
756
|
+
"""
|
757
|
+
retrieves data on all swap markets for hyperliquid
|
758
|
+
|
759
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-perpetuals-asset-contexts-includes-mark-price-current-funding-open-interest-etc
|
760
|
+
|
761
|
+
:param str[] [symbols]: list of unified market symbols
|
762
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
763
|
+
:returns dict[]: an array of objects representing market data
|
764
|
+
"""
|
765
|
+
request: dict = {
|
766
|
+
'type': 'metaAndAssetCtxs',
|
767
|
+
}
|
768
|
+
response = await self.publicPostInfo(self.extend(request, params))
|
769
|
+
#
|
770
|
+
# [
|
771
|
+
# {
|
772
|
+
# "universe": [
|
773
|
+
# {
|
774
|
+
# "maxLeverage": 50,
|
775
|
+
# "name": "SOL",
|
776
|
+
# "onlyIsolated": False,
|
777
|
+
# "szDecimals": 2
|
778
|
+
# }
|
779
|
+
# ]
|
780
|
+
# },
|
781
|
+
# [
|
782
|
+
# {
|
783
|
+
# "dayNtlVlm": "9450588.2273",
|
784
|
+
# "funding": "0.0000198",
|
785
|
+
# "impactPxs": [
|
786
|
+
# "108.04",
|
787
|
+
# "108.06"
|
788
|
+
# ],
|
789
|
+
# "markPx": "108.04",
|
790
|
+
# "midPx": "108.05",
|
791
|
+
# "openInterest": "10764.48",
|
792
|
+
# "oraclePx": "107.99",
|
793
|
+
# "premium": "0.00055561",
|
794
|
+
# "prevDayPx": "111.81"
|
795
|
+
# }
|
796
|
+
# ]
|
797
|
+
# ]
|
798
|
+
#
|
799
|
+
#
|
800
|
+
meta = self.safe_dict(response, 0, {})
|
801
|
+
universe = self.safe_list(meta, 'universe', [])
|
802
|
+
assetCtxs = self.safe_list(response, 1, [])
|
803
|
+
result = []
|
804
|
+
for i in range(0, len(universe)):
|
805
|
+
data = self.extend(
|
806
|
+
self.safe_dict(universe, i, {}),
|
807
|
+
self.safe_dict(assetCtxs, i, {})
|
808
|
+
)
|
809
|
+
result.append(data)
|
810
|
+
funding_rates = self.parse_funding_rates(result)
|
811
|
+
return self.filter_by_array(funding_rates, 'symbol', symbols)
|
812
|
+
|
813
|
+
def parse_funding_rate(self, info, market: Market = None) -> FundingRate:
|
814
|
+
#
|
815
|
+
# {
|
816
|
+
# "maxLeverage": "50",
|
817
|
+
# "name": "ETH",
|
818
|
+
# "onlyIsolated": False,
|
819
|
+
# "szDecimals": "4",
|
820
|
+
# "dayNtlVlm": "1709813.11535",
|
821
|
+
# "funding": "0.00004807",
|
822
|
+
# "impactPxs": [
|
823
|
+
# "2369.3",
|
824
|
+
# "2369.6"
|
825
|
+
# ],
|
826
|
+
# "markPx": "2369.6",
|
827
|
+
# "midPx": "2369.45",
|
828
|
+
# "openInterest": "1815.4712",
|
829
|
+
# "oraclePx": "2367.3",
|
830
|
+
# "premium": "0.00090821",
|
831
|
+
# "prevDayPx": "2381.5"
|
832
|
+
# }
|
833
|
+
#
|
834
|
+
base = self.safe_string(info, 'name')
|
835
|
+
marketId = self.coin_to_market_id(base)
|
836
|
+
symbol = self.safe_symbol(marketId, market)
|
837
|
+
funding = self.safe_number(info, 'funding')
|
838
|
+
markPx = self.safe_number(info, 'markPx')
|
839
|
+
oraclePx = self.safe_number(info, 'oraclePx')
|
840
|
+
fundingTimestamp = (int(math.floor(self.milliseconds()) / 60 / 60 / 1000) + 1) * 60 * 60 * 1000
|
841
|
+
return {
|
842
|
+
'info': info,
|
843
|
+
'symbol': symbol,
|
844
|
+
'markPrice': markPx,
|
845
|
+
'indexPrice': oraclePx,
|
846
|
+
'interestRate': None,
|
847
|
+
'estimatedSettlePrice': None,
|
848
|
+
'timestamp': None,
|
849
|
+
'datetime': None,
|
850
|
+
'fundingRate': funding,
|
851
|
+
'fundingTimestamp': fundingTimestamp,
|
852
|
+
'fundingDatetime': self.iso8601(fundingTimestamp),
|
853
|
+
'nextFundingRate': None,
|
854
|
+
'nextFundingTimestamp': None,
|
855
|
+
'nextFundingDatetime': None,
|
856
|
+
'previousFundingRate': None,
|
857
|
+
'previousFundingTimestamp': None,
|
858
|
+
'previousFundingDatetime': None,
|
859
|
+
'interval': '1h',
|
860
|
+
}
|
861
|
+
|
739
862
|
def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
|
740
863
|
#
|
741
864
|
# {
|
@@ -768,7 +891,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
768
891
|
async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
769
892
|
"""
|
770
893
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
771
|
-
|
894
|
+
|
895
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#candle-snapshot
|
896
|
+
|
772
897
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
773
898
|
:param str timeframe: the length of time each candle represents, support '1m', '15m', '1h', '1d'
|
774
899
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
@@ -795,7 +920,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
795
920
|
'type': 'candleSnapshot',
|
796
921
|
'req': {
|
797
922
|
'coin': market['base'] if market['swap'] else market['id'],
|
798
|
-
'interval': timeframe,
|
923
|
+
'interval': self.safe_string(self.timeframes, timeframe, timeframe),
|
799
924
|
'startTime': since,
|
800
925
|
'endTime': until,
|
801
926
|
},
|
@@ -846,8 +971,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
846
971
|
async def fetch_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
847
972
|
"""
|
848
973
|
get the list of most recent trades for a particular symbol
|
849
|
-
|
850
|
-
|
974
|
+
|
975
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills
|
976
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills-by-time
|
977
|
+
|
851
978
|
:param str symbol: unified market symbol
|
852
979
|
:param int [since]: the earliest time in ms to fetch trades for
|
853
980
|
:param int [limit]: the maximum number of trades structures to retrieve
|
@@ -1022,7 +1149,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1022
1149
|
async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
1023
1150
|
"""
|
1024
1151
|
create a trade order
|
1025
|
-
|
1152
|
+
|
1153
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
|
1154
|
+
|
1026
1155
|
:param str symbol: unified symbol of the market to create an order in
|
1027
1156
|
:param str type: 'market' or 'limit'
|
1028
1157
|
:param str side: 'buy' or 'sell'
|
@@ -1046,8 +1175,11 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1046
1175
|
async def create_orders(self, orders: List[OrderRequest], params={}):
|
1047
1176
|
"""
|
1048
1177
|
create a list of trade orders
|
1049
|
-
|
1178
|
+
|
1179
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
|
1180
|
+
|
1050
1181
|
: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
|
1182
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1051
1183
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1052
1184
|
"""
|
1053
1185
|
await self.load_markets()
|
@@ -1078,7 +1210,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1078
1210
|
def create_orders_request(self, orders, params={}) -> dict:
|
1079
1211
|
"""
|
1080
1212
|
create a list of trade orders
|
1081
|
-
|
1213
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#place-an-order
|
1082
1214
|
: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
|
1083
1215
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1084
1216
|
"""
|
@@ -1190,8 +1322,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1190
1322
|
async def cancel_order(self, id: str, symbol: Str = None, params={}):
|
1191
1323
|
"""
|
1192
1324
|
cancels an open order
|
1193
|
-
|
1194
|
-
|
1325
|
+
|
1326
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
|
1327
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
|
1328
|
+
|
1195
1329
|
:param str id: order id
|
1196
1330
|
:param str symbol: unified symbol of the market the order was made in
|
1197
1331
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1205,8 +1339,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1205
1339
|
async def cancel_orders(self, ids: List[str], symbol: Str = None, params={}):
|
1206
1340
|
"""
|
1207
1341
|
cancel multiple orders
|
1208
|
-
|
1209
|
-
|
1342
|
+
|
1343
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
|
1344
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
|
1345
|
+
|
1210
1346
|
:param str[] ids: order ids
|
1211
1347
|
:param str [symbol]: unified market symbol
|
1212
1348
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1285,8 +1421,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1285
1421
|
async def cancel_orders_for_symbols(self, orders: List[CancellationRequest], params={}):
|
1286
1422
|
"""
|
1287
1423
|
cancel multiple orders for multiple symbols
|
1288
|
-
|
1289
|
-
|
1424
|
+
|
1425
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s
|
1426
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#cancel-order-s-by-cloid
|
1427
|
+
|
1290
1428
|
: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"}]
|
1291
1429
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1292
1430
|
:param str [params.vaultAddress]: the vault address
|
@@ -1469,8 +1607,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1469
1607
|
async def edit_order(self, id: str, symbol: str, type: str, side: str, amount: Num = None, price: Num = None, params={}):
|
1470
1608
|
"""
|
1471
1609
|
edit a trade order
|
1472
|
-
|
1473
|
-
|
1610
|
+
|
1611
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-an-order
|
1612
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#modify-multiple-orders
|
1613
|
+
|
1474
1614
|
:param str id: cancel order id
|
1475
1615
|
:param str symbol: unified symbol of the market to create an order in
|
1476
1616
|
:param str type: 'market' or 'limit'
|
@@ -1534,7 +1674,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1534
1674
|
async def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1535
1675
|
"""
|
1536
1676
|
fetches historical funding rate prices
|
1537
|
-
|
1677
|
+
|
1678
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-historical-funding-rates
|
1679
|
+
|
1538
1680
|
:param str symbol: unified symbol of the market to fetch the funding rate history for
|
1539
1681
|
:param int [since]: timestamp in ms of the earliest funding rate to fetch
|
1540
1682
|
:param int [limit]: the maximum amount of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>` to fetch
|
@@ -1585,7 +1727,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1585
1727
|
async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
1586
1728
|
"""
|
1587
1729
|
fetch all unfilled currently open orders
|
1588
|
-
|
1730
|
+
|
1731
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-open-orders
|
1732
|
+
|
1589
1733
|
:param str symbol: unified market symbol
|
1590
1734
|
:param int [since]: the earliest time in ms to fetch open orders for
|
1591
1735
|
:param int [limit]: the maximum number of open orders structures to retrieve
|
@@ -1709,7 +1853,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1709
1853
|
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
1710
1854
|
"""
|
1711
1855
|
fetches information on an order made by the user
|
1712
|
-
|
1856
|
+
|
1857
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#query-order-status-by-oid-or-cloid
|
1858
|
+
|
1859
|
+
:param str id: order id
|
1713
1860
|
:param str symbol: unified symbol of the market the order was made in
|
1714
1861
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1715
1862
|
:param str [params.user]: user address, will default to self.walletAddress if not provided
|
@@ -1915,8 +2062,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
1915
2062
|
async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1916
2063
|
"""
|
1917
2064
|
fetch all trades made by the user
|
1918
|
-
|
1919
|
-
|
2065
|
+
|
2066
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills
|
2067
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint#retrieve-a-users-fills-by-time
|
2068
|
+
|
1920
2069
|
:param str symbol: unified market symbol
|
1921
2070
|
:param int [since]: the earliest time in ms to fetch trades for
|
1922
2071
|
:param int [limit]: the maximum number of trades structures to retrieve
|
@@ -2018,7 +2167,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2018
2167
|
async def fetch_position(self, symbol: str, params={}):
|
2019
2168
|
"""
|
2020
2169
|
fetch data on an open position
|
2021
|
-
|
2170
|
+
|
2171
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-perpetuals-account-summary
|
2172
|
+
|
2022
2173
|
:param str symbol: unified market symbol of the market the position is held in
|
2023
2174
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2024
2175
|
:param str [params.user]: user address, will default to self.walletAddress if not provided
|
@@ -2030,7 +2181,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2030
2181
|
async def fetch_positions(self, symbols: Strings = None, params={}):
|
2031
2182
|
"""
|
2032
2183
|
fetch all open positions
|
2033
|
-
|
2184
|
+
|
2185
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/info-endpoint/perpetuals#retrieve-users-perpetuals-account-summary
|
2186
|
+
|
2034
2187
|
:param str[] [symbols]: list of unified market symbols
|
2035
2188
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2036
2189
|
:param str [params.user]: user address, will default to self.walletAddress if not provided
|
@@ -2267,7 +2420,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2267
2420
|
async def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
2268
2421
|
"""
|
2269
2422
|
add margin
|
2270
|
-
|
2423
|
+
|
2424
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-isolated-margin
|
2425
|
+
|
2271
2426
|
:param str symbol: unified market symbol
|
2272
2427
|
:param float amount: amount of margin to add
|
2273
2428
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2277,7 +2432,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2277
2432
|
|
2278
2433
|
async def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
2279
2434
|
"""
|
2280
|
-
|
2435
|
+
|
2436
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-isolated-margin
|
2437
|
+
|
2281
2438
|
remove margin from a position
|
2282
2439
|
:param str symbol: unified market symbol
|
2283
2440
|
:param float amount: the amount of margin to remove
|
@@ -2346,7 +2503,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2346
2503
|
async def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
|
2347
2504
|
"""
|
2348
2505
|
transfer currency internally between wallets on the same account
|
2349
|
-
|
2506
|
+
|
2507
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#l1-usdc-transfer
|
2508
|
+
|
2350
2509
|
:param str code: unified currency code
|
2351
2510
|
:param float amount: amount to transfer
|
2352
2511
|
:param str fromAccount: account to transfer from *spot, swap*
|
@@ -2414,8 +2573,10 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2414
2573
|
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
|
2415
2574
|
"""
|
2416
2575
|
make a withdrawal(only support USDC)
|
2417
|
-
|
2418
|
-
|
2576
|
+
|
2577
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#initiate-a-withdrawal-request
|
2578
|
+
https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#deposit-or-withdraw-from-a-vault
|
2579
|
+
|
2419
2580
|
:param str code: unified currency code
|
2420
2581
|
:param float amount: the amount to withdraw
|
2421
2582
|
:param str address: the address to withdraw to
|