# Hyperliquid
Python SDK (sync and async) for Hyperliquid with Rest and WS capabilities.
You can check Hyperliquid's docs here: [Docs](https://hyperliquid.gitbook.io/hyperliquid-docs)
You can check the SDK docs here: [SDK](https://docs.ccxt.com/#/exchanges/hyperliquid)
## Installation
```
pip install hyperliquid
```
## Usage
### Async
```Python
from hyperliquid import HyperliquidAsync
async def main():
instance = HyperliquidAsync({})
order = await instance.create_limit_order("BTC/USDC:USDC", "limit", "buy", 1, 100000)
```
### Sync
```Python
from hyperliquid import HyperliquidSync
def main():
instance = HyperliquidSync({})
order = instance.create_limit_order("BTC/USDC:USDC", "limit", "buy", 1, 100000)
```
#### Raw call
You can also construct your requests from scrach.
```Python
request = {
'type': 'candleSnapshot',
'req': {
'coin': coin,
'interval': tf,
'startTime': since,
'endTime': until,
},
}
response = await instance.public_post_info(request)
```
### Websockets
```Python
from hyperliquid import HyperliquidWs
async def main():
instance = HyperliquidWs({})
while True:
orders = await instance.watch_orders(symbol)
```
## Available methods
### REST Unified
- `create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={})`
- `create_orders_request(self, orders, params={})`
- `create_orders(self, orders: List[OrderRequest], params={})`
- `fetch_balance(self, params={})`
- `fetch_canceled_and_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
- `fetch_canceled_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
- `fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
- `fetch_currencies(self, params={})`
- `fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={})`
- `fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
- `fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
- `fetch_funding_rates(self, symbols: Strings = None, params={})`
- `fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={})`
- `fetch_markets(self, params={})`
- `fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
- `fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={})`
- `fetch_open_interest(self, symbol: str, params={})`
- `fetch_open_interests(self, symbols: Strings = None, params={})`
- `fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
- `fetch_order_book(self, symbol: str, limit: Int = None, params={})`
- `fetch_order(self, id: str, symbol: Str = None, params={})`
- `fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
- `fetch_position(self, symbol: str, params={})`
- `fetch_positions(self, symbols: Strings = None, params={})`
- `fetch_spot_markets(self, params={})`
- `fetch_swap_markets(self, params={})`
- `fetch_tickers(self, symbols: Strings = None, params={})`
- `fetch_trades(self, symbol: Str, since: Int = None, limit: Int = None, params={})`
- `fetch_trading_fee(self, symbol: str, params={})`
- `fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={})`
- `action_hash(self, action, vaultAddress, nonce)`
- `add_margin(self, symbol: str, amount: float, params={})`
- `amount_to_precision(self, symbol, amount)`
- `build_usd_class_send_sig(self, message)`
- `build_usd_send_sig(self, message)`
- `build_withdraw_sig(self, message)`
- `calculate_price_precision(self, price: float, amountPrecision: float, maxDecimals: float)`
- `calculate_rate_limiter_cost(self, api, method, path, params, config={})`
- `cancel_all_orders_after(self, timeout: Int, params={})`
- `cancel_order(self, id: str, symbol: Str = None, params={})`
- `cancel_orders_for_symbols(self, orders: List[CancellationRequest], params={})`
- `cancel_orders(self, ids: List[str], symbol: Str = None, params={})`
- `coin_to_market_id(self, coin: Str)`
- `construct_phantom_agent(self, hash, isTestnet=True)`
- `describe(self)`
- `edit_order(self, id: str, symbol: str, type: str, side: str, amount: Num = None, price: Num = None, params={})`
- `edit_orders_request(self, orders, params={})`
- `edit_orders(self, orders: List[OrderRequest], params={})`
- `extract_type_from_delta(self, data=[])`
- `format_vault_address(self, address: Str = None)`
- `hash_message(self, message)`
- `modify_margin_helper(self, symbol: str, amount, type, params={})`
- `price_to_precision(self, symbol: str, price)`
- `reduce_margin(self, symbol: str, amount: float, params={})`
- `set_leverage(self, leverage: Int, symbol: Str = None, params={})`
- `set_margin_mode(self, marginMode: str, symbol: Str = None, params={})`
- `set_sandbox_mode(self, enabled)`
- `transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={})`
- `withdraw(self, code: str, amount: float, address: str, tag=None, params={})`
### REST Raw
- `public_post_info(request)`
- `private_post_exchange(request)`
### WS Unified
- `describe(self)`
- `create_orders_ws(self, orders: List[OrderRequest], params={})`
- `create_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={})`
- `edit_order_ws(self, id: str, symbol: str, type: str, side: str, amount: Num = None, price: Num = None, params={})`
- `watch_order_book(self, symbol: str, limit: Int = None, params={})`
- `un_watch_order_book(self, symbol: str, params={})`
- `watch_ticker(self, symbol: str, params={})`
- `watch_tickers(self, symbols: Strings = None, params={})`
- `un_watch_tickers(self, symbols: Strings = None, params={})`
- `watch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
- `watch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={})`
- `un_watch_trades(self, symbol: str, params={})`
- `watch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={})`
- `un_watch_ohlcv(self, symbol: str, timeframe='1m', params={})`
- `watch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`
- `wrap_as_post_action(self, request: dict)`
## Contribution
- Give us a star :star:
- Fork and Clone! Awesome
- Select existing issues or create a new issue.
Raw data
{
"_id": null,
"home_page": "https://ccxt.com",
"name": "hyperliquid",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "hyperliquid, cryptocurrency, trading, library, api, rest, websocket, exchange, ccxt",
"author": "Igor Kroitor",
"author_email": "igor.kroitor@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/9f/b6/ae052efd8252b7b78469e5eac09f52d88ccf3e292a98c02b172521e78602/hyperliquid-0.4.66.tar.gz",
"platform": null,
"description": "# Hyperliquid\nPython SDK (sync and async) for Hyperliquid with Rest and WS capabilities.\n\nYou can check Hyperliquid's docs here: [Docs](https://hyperliquid.gitbook.io/hyperliquid-docs)\n\n\nYou can check the SDK docs here: [SDK](https://docs.ccxt.com/#/exchanges/hyperliquid)\n\n\n## Installation\n\n```\npip install hyperliquid\n```\n\n## Usage\n\n### Async\n\n```Python\nfrom hyperliquid import HyperliquidAsync\n\nasync def main():\n instance = HyperliquidAsync({})\n order = await instance.create_limit_order(\"BTC/USDC:USDC\", \"limit\", \"buy\", 1, 100000)\n```\n\n### Sync\n\n```Python\nfrom hyperliquid import HyperliquidSync\n\ndef main():\n instance = HyperliquidSync({})\n order = instance.create_limit_order(\"BTC/USDC:USDC\", \"limit\", \"buy\", 1, 100000)\n```\n\n#### Raw call\n\nYou can also construct your requests from scrach.\n\n```Python\n request = {\n 'type': 'candleSnapshot',\n 'req': {\n 'coin': coin,\n 'interval': tf,\n 'startTime': since,\n 'endTime': until,\n },\n }\n response = await instance.public_post_info(request)\n```\n\n\n### Websockets\n\n```Python\nfrom hyperliquid import HyperliquidWs\n\nasync def main():\n instance = HyperliquidWs({})\n while True:\n orders = await instance.watch_orders(symbol)\n```\n\n## Available methods\n\n### REST Unified\n\n- `create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={})`\n- `create_orders_request(self, orders, params={})`\n- `create_orders(self, orders: List[OrderRequest], params={})`\n- `fetch_balance(self, params={})`\n- `fetch_canceled_and_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`\n- `fetch_canceled_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`\n- `fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`\n- `fetch_currencies(self, params={})`\n- `fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={})`\n- `fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`\n- `fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`\n- `fetch_funding_rates(self, symbols: Strings = None, params={})`\n- `fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={})`\n- `fetch_markets(self, params={})`\n- `fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`\n- `fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={})`\n- `fetch_open_interest(self, symbol: str, params={})`\n- `fetch_open_interests(self, symbols: Strings = None, params={})`\n- `fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`\n- `fetch_order_book(self, symbol: str, limit: Int = None, params={})`\n- `fetch_order(self, id: str, symbol: Str = None, params={})`\n- `fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`\n- `fetch_position(self, symbol: str, params={})`\n- `fetch_positions(self, symbols: Strings = None, params={})`\n- `fetch_spot_markets(self, params={})`\n- `fetch_swap_markets(self, params={})`\n- `fetch_tickers(self, symbols: Strings = None, params={})`\n- `fetch_trades(self, symbol: Str, since: Int = None, limit: Int = None, params={})`\n- `fetch_trading_fee(self, symbol: str, params={})`\n- `fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={})`\n- `action_hash(self, action, vaultAddress, nonce)`\n- `add_margin(self, symbol: str, amount: float, params={})`\n- `amount_to_precision(self, symbol, amount)`\n- `build_usd_class_send_sig(self, message)`\n- `build_usd_send_sig(self, message)`\n- `build_withdraw_sig(self, message)`\n- `calculate_price_precision(self, price: float, amountPrecision: float, maxDecimals: float)`\n- `calculate_rate_limiter_cost(self, api, method, path, params, config={})`\n- `cancel_all_orders_after(self, timeout: Int, params={})`\n- `cancel_order(self, id: str, symbol: Str = None, params={})`\n- `cancel_orders_for_symbols(self, orders: List[CancellationRequest], params={})`\n- `cancel_orders(self, ids: List[str], symbol: Str = None, params={})`\n- `coin_to_market_id(self, coin: Str)`\n- `construct_phantom_agent(self, hash, isTestnet=True)`\n- `describe(self)`\n- `edit_order(self, id: str, symbol: str, type: str, side: str, amount: Num = None, price: Num = None, params={})`\n- `edit_orders_request(self, orders, params={})`\n- `edit_orders(self, orders: List[OrderRequest], params={})`\n- `extract_type_from_delta(self, data=[])`\n- `format_vault_address(self, address: Str = None)`\n- `hash_message(self, message)`\n- `modify_margin_helper(self, symbol: str, amount, type, params={})`\n- `price_to_precision(self, symbol: str, price)`\n- `reduce_margin(self, symbol: str, amount: float, params={})`\n- `set_leverage(self, leverage: Int, symbol: Str = None, params={})`\n- `set_margin_mode(self, marginMode: str, symbol: Str = None, params={})`\n- `set_sandbox_mode(self, enabled)`\n- `transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={})`\n- `withdraw(self, code: str, amount: float, address: str, tag=None, params={})`\n\n### REST Raw\n\n- `public_post_info(request)`\n- `private_post_exchange(request)`\n\n### WS Unified\n\n- `describe(self)`\n- `create_orders_ws(self, orders: List[OrderRequest], params={})`\n- `create_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={})`\n- `edit_order_ws(self, id: str, symbol: str, type: str, side: str, amount: Num = None, price: Num = None, params={})`\n- `watch_order_book(self, symbol: str, limit: Int = None, params={})`\n- `un_watch_order_book(self, symbol: str, params={})`\n- `watch_ticker(self, symbol: str, params={})`\n- `watch_tickers(self, symbols: Strings = None, params={})`\n- `un_watch_tickers(self, symbols: Strings = None, params={})`\n- `watch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`\n- `watch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={})`\n- `un_watch_trades(self, symbol: str, params={})`\n- `watch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={})`\n- `un_watch_ohlcv(self, symbol: str, timeframe='1m', params={})`\n- `watch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={})`\n- `wrap_as_post_action(self, request: dict)`\n\n## Contribution\n- Give us a star :star:\n- Fork and Clone! Awesome\n- Select existing issues or create a new issue.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Python cryptocurrency trading library for hyperliquid",
"version": "0.4.66",
"project_urls": {
"Discord": "https://discord.gg/ccxt",
"Documentation": "https://github.com/ccxt/ccxt/wiki",
"Funding": "https://opencollective.com/ccxt",
"Homepage": "https://ccxt.com",
"Twitter": "https://twitter.com/ccxt_official"
},
"split_keywords": [
"hyperliquid",
" cryptocurrency",
" trading",
" library",
" api",
" rest",
" websocket",
" exchange",
" ccxt"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "15216354e63db0e3c013449e5c06b214ef203ff80dfc2b0e0a956f68df45dc57",
"md5": "2581fba6b7af0a046641446f6b5c2a59",
"sha256": "c57c7f1d3eccabcea27da6201fec854d7509a28f7d8e527e1efdc33f686d50cc"
},
"downloads": -1,
"filename": "hyperliquid-0.4.66-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2581fba6b7af0a046641446f6b5c2a59",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 623006,
"upload_time": "2025-03-11T16:08:43",
"upload_time_iso_8601": "2025-03-11T16:08:43.063643Z",
"url": "https://files.pythonhosted.org/packages/15/21/6354e63db0e3c013449e5c06b214ef203ff80dfc2b0e0a956f68df45dc57/hyperliquid-0.4.66-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "9fb6ae052efd8252b7b78469e5eac09f52d88ccf3e292a98c02b172521e78602",
"md5": "18f93dc0643d269df7b8fdde229d6461",
"sha256": "0c1a9d96c8a2d51367135f9756b0c52dd9e510736dc16f87135c855e709ca249"
},
"downloads": -1,
"filename": "hyperliquid-0.4.66.tar.gz",
"has_sig": false,
"md5_digest": "18f93dc0643d269df7b8fdde229d6461",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 520386,
"upload_time": "2025-03-11T16:08:44",
"upload_time_iso_8601": "2025-03-11T16:08:44.915350Z",
"url": "https://files.pythonhosted.org/packages/9f/b6/ae052efd8252b7b78469e5eac09f52d88ccf3e292a98c02b172521e78602/hyperliquid-0.4.66.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-03-11 16:08:44",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ccxt",
"github_project": "ccxt",
"travis_ci": true,
"coveralls": false,
"github_actions": true,
"lcname": "hyperliquid"
}