{"id":13633113,"url":"https://github.com/sometastycake/asynchuobi","last_synced_at":"2026-01-02T10:00:04.355Z","repository":{"id":65177592,"uuid":"546747745","full_name":"sometastycake/asynchuobi","owner":"sometastycake","description":"Unofficial python SDK for Huobi API","archived":false,"fork":false,"pushed_at":"2023-02-08T12:49:15.000Z","size":241,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-23T03:49:48.848Z","etag":null,"topics":["api","asynchronous","crypto","cryptocurrency","exchange","huobi","huobi-api","huobi-api-python","huobi-python","huobi-websocket","huobitrade","python","sdk","sdk-python","spot","trading"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/asynchuobi/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sometastycake.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-06T15:22:27.000Z","updated_at":"2025-02-19T09:25:00.000Z","dependencies_parsed_at":"2024-05-20T21:15:47.329Z","dependency_job_id":null,"html_url":"https://github.com/sometastycake/asynchuobi","commit_stats":{"total_commits":217,"total_committers":1,"mean_commits":217.0,"dds":0.0,"last_synced_commit":"8a651fb497eb2cc6f052546eb4943d3f6904d349"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/sometastycake/asynchuobi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sometastycake%2Fasynchuobi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sometastycake%2Fasynchuobi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sometastycake%2Fasynchuobi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sometastycake%2Fasynchuobi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sometastycake","download_url":"https://codeload.github.com/sometastycake/asynchuobi/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sometastycake%2Fasynchuobi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28171918,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2026-01-02T02:00:06.235Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","asynchronous","crypto","cryptocurrency","exchange","huobi","huobi-api","huobi-api-python","huobi-python","huobi-websocket","huobitrade","python","sdk","sdk-python","spot","trading"],"created_at":"2024-08-01T23:00:27.964Z","updated_at":"2026-01-02T10:00:04.318Z","avatar_url":"https://github.com/sometastycake.png","language":"Python","funding_links":[],"categories":["Market data libraries"],"sub_categories":[],"readme":"# Unofficial python SDK for Huobi API\n\n[![CI](https://github.com/sometastycake/asynchuobi/actions/workflows/ci.yml/badge.svg)](https://github.com/sometastycake/asynchuobi/actions/workflows/ci.yml)\n[![Python: versions](\nhttps://img.shields.io/badge/python-3.7%20%7C%203.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue)]()\n\n## Official documentation\n[Documentation](https://huobiapi.github.io/docs/spot/v1/en/#change-log)\n\n## Install\n\n```bash\npip install asynchuobi\n```\n\n## Generic API\n\n```python\nfrom asynchuobi.api.clients.generic import GenericHuobiClient\n\n\nasync def main():\n    async with GenericHuobiClient() as client:\n        trading_symbols = await client.get_all_supported_trading_symbols()\n```\n\n## Market API\n\n```python\nfrom asynchuobi.api.clients.market import MarketHuobiClient\nfrom asynchuobi.enums import CandleInterval\n\n\nasync def main():\n    async with MarketHuobiClient() as client:\n        candles = await client.get_candles('btcusdt', CandleInterval.min_1)\n        orderbook = await client.get_market_depth('btcusdt')\n```\n\n## Subuser API\n\n```python\nfrom asynchuobi.api.clients.subuser import SubUserHuobiClient\nfrom asynchuobi.enums import ApiKeyPermission\n\n\nasync def main():\n    async with SubUserHuobiClient(\n        access_key='access_key',\n        secret_key='secret_key',\n    ) as client:\n        subusers = await client.get_sub_users_list()\n        for subuser in subusers['data']:\n            keys = await client.api_key_query(subuser['uid'])\n            status = await client.get_sub_user_status(subuser['uid'])\n            balance = await client.get_account_balance_of_sub_user(subuser['uid'])\n```\n\n## Wallet API\n\n```python\nfrom asynchuobi.api.clients.wallet import WalletHuobiClient\n\n\nasync def main():\n    async with WalletHuobiClient(\n        access_key='access_key',\n        secret_key='secret_key',\n    ) as client:\n        withdraw_response = await client.create_withdraw_request(\n            address='address',\n            currency='usdt',\n            amount=10\n        )\n```\n\n## Account API\n\n```python\nfrom asynchuobi.api.clients.account import AccountHuobiClient\nfrom asynchuobi.enums import AccountTypeCode, Sort\n\n\nasync def main():\n    async with AccountHuobiClient(\n        access_key='access_key',\n        secret_key='secret_key',\n    ) as client:\n        accounts = await client.accounts()\n        for account in accounts['data']:\n            balances = await client.account_balance(account_id=account['id'])\n        for account_type in (AccountTypeCode.spot, AccountTypeCode.flat):\n            total_valuation = await client.get_total_valuation_of_platform_assets(\n                account_type_code=account_type,\n                valuation_currency='BTC',\n            )\n```\n\n## Orders API\n\n```python\nfrom asynchuobi.api.clients.order import OrderHuobiClient\nfrom asynchuobi.enums import OrderType\n\nasync def main():\n    async with OrderHuobiClient(\n            access_key='access_key',\n            secret_key='secret_key'\n    ) as client:\n        response = await client.new_order(\n            account_id=account_id,\n            symbol='dogeusdt',\n            order_type=OrderType.buy_limit,\n            amount=20,\n            price=0.0660,\n        )\n        if response['status'] == 'ok':\n            order_id = response['data']\n            cancelling = await client.cancel_order(\n                order_id=order_id,\n            )\n```\n\n## Margin API\n\n```python\nfrom asynchuobi.api.clients.margin import MarginHuobiClient\n\n\nasync def main():\n    async with MarginHuobiClient(\n        access_key='access_key',\n        secret_key='secret_key',\n    ) as client:\n        cross_margin_balance = await client.get_balance_of_cross_margin_account()\n        isolated_margin_balance = await client.get_balance_of_isolated_margin_account(\n            symbol='btcusdt',\n        )\n```\n\n\n## WebSocket\n\nClient supports retrieving information about market data, such as candles, orderbook, trade details.\n\n### Usage\n\n```python\nfrom asynchuobi.enums import CandleInterval\nfrom asynchuobi.ws.ws_client import WSHuobiMarket\n\n\nasync def main():\n    async with WSHuobiMarket() as ws:\n        await ws.candlestick('btcusdt', CandleInterval.min_1).sub()\n        await ws.market_stats('btcusdt').sub()\n        await ws.market_ticker_info('btcusdt').sub()\n        await ws.orderbook('btcusdt').sub()\n        async for message in ws:\n            ...\n```\n\nYou can define callbacks which will called when message was received from websocket\n\n```python\nfrom typing import Dict\n\nfrom asynchuobi.exceptions import WSHuobiError\nfrom asynchuobi.ws.ws_client import WSHuobiMarket\n\n\ndef callback(msg: Dict):\n    print(msg)\n\n\ndef error(e: WSHuobiError):\n    print(e)\n\n\nasync def orderbook():\n    async with WSHuobiMarket() as ws:\n        await ws.orderbook('btcusdt').sub(callback=callback)\n        await ws.run_with_callbacks(error_callback=error)\n```\n\nYou can also define async callback\n\n### Retrieving information about account balance changing and about orders\n\nAuthentication is required\n\n```python\nfrom asynchuobi.ws.ws_client import WSHuobiAccount\n\n\nasync def main():\n    async with WSHuobiAccount('access_key', 'secret_key') as ws:\n        await ws.subscribe_account_change()\n        await ws.subscribe_order_updates('btcusdt')\n        async for message in ws:\n            ...\n```\n\nWith callbacks\n\n```python\nfrom asynchuobi.ws.ws_client import WSHuobiAccount\nfrom asynchuobi.exceptions import WSHuobiError\n\n\ndef callback(message: dict):\n    print(message)\n\n\ndef error(e: WSHuobiError):\n    print(e)\n\n\nasync def main():\n    async with WSHuobiAccount('access_key', 'secret_key') as ws:\n        await ws.subscribe_account_change(\n            callback=callback,\n        )\n        await ws.run_with_callbacks(error_callback=error)\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsometastycake%2Fasynchuobi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsometastycake%2Fasynchuobi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsometastycake%2Fasynchuobi/lists"}