async-hyperliquid 0.4.7__tar.gz → 1.0.0__tar.gz

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.
Files changed (105) hide show
  1. async_hyperliquid-1.0.0/CHANGELOG.md +523 -0
  2. async_hyperliquid-1.0.0/PKG-INFO +99 -0
  3. async_hyperliquid-1.0.0/README.md +65 -0
  4. async_hyperliquid-1.0.0/benchmarks/README.md +428 -0
  5. async_hyperliquid-1.0.0/benchmarks/__init__.py +1 -0
  6. async_hyperliquid-1.0.0/benchmarks/hotpath.py +505 -0
  7. async_hyperliquid-1.0.0/benchmarks/live/__init__.py +1 -0
  8. async_hyperliquid-1.0.0/benchmarks/live/models.py +404 -0
  9. async_hyperliquid-1.0.0/benchmarks/live/pacing.py +39 -0
  10. async_hyperliquid-1.0.0/benchmarks/live/preflight.py +88 -0
  11. async_hyperliquid-1.0.0/benchmarks/live/providers.py +559 -0
  12. async_hyperliquid-1.0.0/benchmarks/live/reporting.py +1923 -0
  13. async_hyperliquid-1.0.0/benchmarks/live/results.py +330 -0
  14. async_hyperliquid-1.0.0/benchmarks/live/runner.py +483 -0
  15. async_hyperliquid-1.0.0/benchmarks/live/workload.py +74 -0
  16. async_hyperliquid-1.0.0/benchmarks/live_exchange.py +407 -0
  17. async_hyperliquid-1.0.0/benchmarks/results/20260805T192621Z/cancel-id-latency.png +0 -0
  18. async_hyperliquid-1.0.0/benchmarks/results/20260805T192621Z/cancel-id-latency.svg +2960 -0
  19. async_hyperliquid-1.0.0/benchmarks/results/20260805T192621Z/report.json +4859 -0
  20. async_hyperliquid-1.0.0/benchmarks/results/20260805T192621Z/samples.csv +601 -0
  21. async_hyperliquid-1.0.0/benchmarks/signing.py +581 -0
  22. async_hyperliquid-1.0.0/docs/coin-name-mapping.md +84 -0
  23. async_hyperliquid-1.0.0/docs/conf.py +34 -0
  24. async_hyperliquid-1.0.0/docs/howto/index.rst +16 -0
  25. async_hyperliquid-1.0.0/docs/howto/info-queries.rst +73 -0
  26. async_hyperliquid-1.0.0/docs/howto/lifecycle-reconciliation.rst +66 -0
  27. async_hyperliquid-1.0.0/docs/howto/markets.rst +47 -0
  28. async_hyperliquid-1.0.0/docs/howto/orders.rst +111 -0
  29. async_hyperliquid-1.0.0/docs/howto/routing.rst +58 -0
  30. async_hyperliquid-1.0.0/docs/howto/transfers-administration.rst +65 -0
  31. async_hyperliquid-1.0.0/docs/index.rst +47 -0
  32. async_hyperliquid-1.0.0/docs/introduction/index.rst +39 -0
  33. async_hyperliquid-1.0.0/docs/introduction/installation.rst +28 -0
  34. async_hyperliquid-1.0.0/docs/introduction/quickstart.rst +119 -0
  35. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/coin-name-mapping.po +228 -0
  36. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/howto/index.po +62 -0
  37. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/howto/info-queries.po +123 -0
  38. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/howto/lifecycle-reconciliation.po +148 -0
  39. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/howto/markets.po +100 -0
  40. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/howto/orders.po +200 -0
  41. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/howto/routing.po +132 -0
  42. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/howto/transfers-administration.po +161 -0
  43. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/index.po +55 -0
  44. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/introduction/index.po +109 -0
  45. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/introduction/installation.po +53 -0
  46. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/introduction/quickstart.po +84 -0
  47. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/migration-0.5-to-1.0.po +796 -0
  48. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/project/about.po +37 -0
  49. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/project/index.po +37 -0
  50. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/project/license.po +36 -0
  51. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/reference/async-hyperliquid.po +51 -0
  52. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/reference/errors.po +52 -0
  53. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/reference/exchange-client.po +51 -0
  54. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/reference/index.po +51 -0
  55. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/reference/info-client.po +33 -0
  56. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/reference/response-types.po +69 -0
  57. async_hyperliquid-1.0.0/docs/locale/zh_CN/LC_MESSAGES/reference/types.po +79 -0
  58. async_hyperliquid-1.0.0/docs/migration-0.5-to-1.0.md +330 -0
  59. async_hyperliquid-1.0.0/docs/project/about.rst +9 -0
  60. async_hyperliquid-1.0.0/docs/project/index.rst +16 -0
  61. async_hyperliquid-1.0.0/docs/project/license.rst +10 -0
  62. async_hyperliquid-1.0.0/docs/reference/async-hyperliquid.rst +19 -0
  63. async_hyperliquid-1.0.0/docs/reference/errors.rst +11 -0
  64. async_hyperliquid-1.0.0/docs/reference/exchange-client.rst +19 -0
  65. async_hyperliquid-1.0.0/docs/reference/index.rst +11 -0
  66. async_hyperliquid-1.0.0/docs/reference/info-client.rst +9 -0
  67. async_hyperliquid-1.0.0/docs/reference/response-types.rst +32 -0
  68. async_hyperliquid-1.0.0/docs/reference/types.rst +108 -0
  69. {async_hyperliquid-0.4.7 → async_hyperliquid-1.0.0}/pyproject.toml +42 -37
  70. async_hyperliquid-1.0.0/src/async_hyperliquid/__init__.py +5 -0
  71. async_hyperliquid-1.0.0/src/async_hyperliquid/_internal/__init__.py +1 -0
  72. async_hyperliquid-1.0.0/src/async_hyperliquid/_internal/encoding.py +112 -0
  73. async_hyperliquid-1.0.0/src/async_hyperliquid/_internal/exchange.py +149 -0
  74. async_hyperliquid-1.0.0/src/async_hyperliquid/_internal/http.py +119 -0
  75. async_hyperliquid-1.0.0/src/async_hyperliquid/_internal/info.py +95 -0
  76. async_hyperliquid-1.0.0/src/async_hyperliquid/_internal/metadata.py +289 -0
  77. async_hyperliquid-1.0.0/src/async_hyperliquid/_internal/signing.py +242 -0
  78. async_hyperliquid-1.0.0/src/async_hyperliquid/client.py +695 -0
  79. async_hyperliquid-1.0.0/src/async_hyperliquid/constants.py +8 -0
  80. async_hyperliquid-1.0.0/src/async_hyperliquid/errors.py +30 -0
  81. async_hyperliquid-1.0.0/src/async_hyperliquid/exchange.py +847 -0
  82. async_hyperliquid-1.0.0/src/async_hyperliquid/info.py +624 -0
  83. async_hyperliquid-1.0.0/src/async_hyperliquid/types/__init__.py +67 -0
  84. async_hyperliquid-1.0.0/src/async_hyperliquid/types/common.py +90 -0
  85. async_hyperliquid-1.0.0/src/async_hyperliquid/types/exchange.py +623 -0
  86. async_hyperliquid-1.0.0/src/async_hyperliquid/types/info.py +781 -0
  87. async_hyperliquid-0.4.7/PKG-INFO +0 -253
  88. async_hyperliquid-0.4.7/README.md +0 -194
  89. async_hyperliquid-0.4.7/src/async_hyperliquid/__init__.py +0 -5
  90. async_hyperliquid-0.4.7/src/async_hyperliquid/_async_hyperliquid/__init__.py +0 -3
  91. async_hyperliquid-0.4.7/src/async_hyperliquid/_async_hyperliquid/actions.py +0 -261
  92. async_hyperliquid-0.4.7/src/async_hyperliquid/_async_hyperliquid/core.py +0 -428
  93. async_hyperliquid-0.4.7/src/async_hyperliquid/_async_hyperliquid/info.py +0 -309
  94. async_hyperliquid-0.4.7/src/async_hyperliquid/_async_hyperliquid/orders.py +0 -446
  95. async_hyperliquid-0.4.7/src/async_hyperliquid/async_api.py +0 -85
  96. async_hyperliquid-0.4.7/src/async_hyperliquid/async_hyperliquid.py +0 -214
  97. async_hyperliquid-0.4.7/src/async_hyperliquid/exchange.py +0 -99
  98. async_hyperliquid-0.4.7/src/async_hyperliquid/info.py +0 -275
  99. async_hyperliquid-0.4.7/src/async_hyperliquid/utils/constants.py +0 -108
  100. async_hyperliquid-0.4.7/src/async_hyperliquid/utils/decorators.py +0 -18
  101. async_hyperliquid-0.4.7/src/async_hyperliquid/utils/miscs.py +0 -68
  102. async_hyperliquid-0.4.7/src/async_hyperliquid/utils/signing.py +0 -420
  103. async_hyperliquid-0.4.7/src/async_hyperliquid/utils/types.py +0 -879
  104. {async_hyperliquid-0.4.7 → async_hyperliquid-1.0.0}/LICENSE +0 -0
  105. /async_hyperliquid-0.4.7/src/async_hyperliquid/utils/__init__.py → /async_hyperliquid-1.0.0/src/async_hyperliquid/py.typed +0 -0
@@ -0,0 +1,523 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2026-08-17
9
+
10
+ ### Added
11
+
12
+ - Publish comprehensive Read the Docs documentation for installation, Info and
13
+ Exchange workflows, routing, market and asset mapping, reconciliation,
14
+ migration, project ownership, licensing, and the public API reference.
15
+ - Add a complete Simplified Chinese documentation build using Sphinx gettext,
16
+ while preserving Python identifiers, signatures, types, code, and autodoc
17
+ content in English.
18
+
19
+ ### Changed
20
+
21
+ - Promote the 1.0 API from release candidate to stable without additional
22
+ runtime contract changes.
23
+ - Gate English and Simplified Chinese documentation in CI, release validation,
24
+ and source-distribution tests with warnings treated as errors.
25
+ - Publish GitHub Release notes from the exact matching CHANGELOG section and
26
+ verify the body before and after immutable release publication.
27
+ - Run artifact download actions on the Node 24 runtime.
28
+
29
+ ## [1.0.0rc1] - 2026-08-04
30
+
31
+ ### Added
32
+
33
+ - Restore the expanded root `place_order` workflow, typed `place_orders`, its
34
+ exact `batch_place_orders` alias, and full-position batch close workflows.
35
+ - Complete the documented Exchange action surface, including agent transfers,
36
+ Core-to-EVM data transfers, HIP-3 liquidator transfers, outcome actions,
37
+ AQAv2 authorization, risk-free-rate voting, noop, and reward claims.
38
+ - Add testnet-only live fixtures that validate master/API-wallet roles without
39
+ exposing keys, plus separate deterministic and live integration commands.
40
+ - Add credential-free `InfoClient` with exact constructor-time routing for
41
+ official, self-hosted, and third-party Info endpoints.
42
+ - Add immutable typed command dataclasses and exact `TypedDict` wire-response
43
+ contracts, plus the `py.typed` marker.
44
+ - Add independent `info_url` and `exchange_url` routing while keeping `Network`
45
+ as the sole signing-domain selector.
46
+ - Add an immutable `vault_address` execution target for vault and subaccount
47
+ signing, envelopes, account queries, and transfer-specific fields.
48
+ - Add exact `twapOrder` and `twapCancel` response contracts and return types.
49
+ - Add independently optional `trigger_px` and `stop_px` arguments to
50
+ `place_twap`, with exact action-level `details` encoding and automatic
51
+ trigger direction from the current mark price.
52
+ - Add deterministic lifecycle, finite timeout budgets, cancellation-safe atomic
53
+ metadata snapshots, and explicit `IndeterminateActionError` reconciliation
54
+ semantics.
55
+ - Add exact official-SDK Exchange payload vectors, a secret-safe `.env.local`
56
+ signing oracle, and a parity-gated three-provider benchmark under
57
+ `benchmarks/` with a reproducible operations manual and local comparison
58
+ results.
59
+
60
+ ### Changed
61
+
62
+ - Group private encoding, transport, metadata, signing, and protocol helpers
63
+ under `_internal/` while keeping public errors and protocol constants at the
64
+ package root; `exchange.py` and `info.py` now contain only client-owned
65
+ workflows and lifecycle state.
66
+ - Move the wheel hot-path runner to `benchmarks/hotpath.py`, shorten test module
67
+ names using their domain directories, and use `hl` consistently for the
68
+ authenticated integration client.
69
+ - Keep Info and Exchange integration cases visible to pytest and VS Code;
70
+ deterministic tests remain an explicitly offline suite.
71
+ - Run the complete credential-free Info integration suite against both MAINNET
72
+ and TESTNET. Retry an initial HTTP 429 once after 60 seconds, skip after a
73
+ second 429, and warn then skip when TESTNET returns a 5xx response.
74
+ - Restrict signed Exchange integration to testnet with `IS_MAINNET=false` as
75
+ its only suite-level execution setting; missing, empty, true, and malformed
76
+ values hard-fail before credential validation or client construction.
77
+ - Replace the duplicate order dataclass hierarchy with one
78
+ `PlaceOrderRequest`/`ModifyOrderRequest` `TypedDict` vocabulary using
79
+ `is_buy`, `cloid`, singular order option names, and `Builder`.
80
+ - Rename public DEX sequence parameters to `dexs`; keep `perp_dexes()` only as
81
+ the name of the official `perpDexs` Info request.
82
+ - Move position-closing orchestration from `ExchangeClient` to
83
+ `AsyncHyperliquid`, where one position read produces one signed batch order.
84
+ - Keep every Info-dependent signed workflow on `AsyncHyperliquid`; the concrete
85
+ `ExchangeClient` now owns only resolved action construction, nonce/signing,
86
+ vault targeting, and submission.
87
+ - Require `PlaceOrderRequest.is_market` explicitly and route matching singular
88
+ order/cancel methods through their canonical batch implementations.
89
+ - Collect signed Exchange and dual-network Info cases without execution opt-in
90
+ marker filtering.
91
+ - Replace the dynamic facade with an explicit resource owner whose concrete
92
+ `.info` and `.exchange` clients share one HTTP transport.
93
+ - Require valid account and signing credentials for `AsyncHyperliquid`; use
94
+ `InfoClient` for read-only access.
95
+ - Batch order preparation performs one metadata snapshot lookup, one signature,
96
+ and one HTTP POST.
97
+ - Batch market and close orders fetch `allMids` once per distinct DEX.
98
+ - Canonicalize all placement through `place_orders`, allow market and
99
+ non-market requests in one same-venue batch, and remove the provisional RC1
100
+ `place_market_orders` helper.
101
+ - Resolve the venue before enforcing builder caps (`100` tenths of a basis
102
+ point for perpetuals and `1000` for spot/outcome), and leave minimum-order
103
+ notional validation to the Exchange.
104
+ - Apply the documented outcome price domain and `0.00001` USDC tick without
105
+ adding an SDK-side minimum-notional gate.
106
+ - Pin the development environment to Python 3.12 with uv and upgrade aiohttp to
107
+ 3.14.3, msgpack to 1.2.1, eth-account to 0.13.7, eth-utils to the
108
+ resolver-compatible 5.3.1, and the development signing oracle to the official
109
+ Hyperliquid SDK 0.24.0.
110
+ - Keep `coincurve` as a runtime dependency after an isolated end-to-end
111
+ benchmark showed approximately 94% lower signing latency than the native
112
+ fallback.
113
+ - Precompute the immutable Exchange EIP-712 domain and agent type hashes so L1
114
+ signing avoids rebuilding the same typed-data schema on every request.
115
+ - Match the official SDK request envelope exactly by retaining nullable
116
+ `vaultAddress` and `expiresAfter` fields, including when they are unset.
117
+ - Pin CoinCurve in the benchmark dependency group and reject CCXT benchmark
118
+ runs unless its direct CoinCurve secp256k1 signer passes a preflight check.
119
+
120
+ ### Removed
121
+
122
+ - Remove flat forwarding methods, `AsyncHyper`, `InfoAPI`, `ExchangeAPI`,
123
+ dynamic proxying, import-time monkeypatching, and legacy utility re-exports.
124
+ - Remove mutable `base_url` routing and URL-derived signing-network decisions.
125
+ - Remove embedded EVM support and the `hl-web3` dependency; EVM users should
126
+ construct `hl-web3` directly.
127
+ - Remove the broken legacy benchmark visualizer, its generated image, and its
128
+ unused plotting dependency group.
129
+
130
+ ### Fixed
131
+
132
+ - Prevent the `base_url=None` path from posting to mainnet while signing for
133
+ testnet.
134
+ - Prevent a cancelled metadata waiter from cancelling or poisoning unrelated
135
+ refresh work.
136
+ - Match the live `allPerpMetas` response as a list of perpetual metadata
137
+ objects rather than conflating it with `metaAndAssetCtxs` pairs.
138
+ - Reject partial `allPerpMetas` snapshots that omit a DEX declared by
139
+ `perpDexs`.
140
+ - Reject order prices or sizes that round to zero at the market precision
141
+ before signing.
142
+ - Reject spot and outcome reduce-only orders locally before signing, and
143
+ centralize finite, positive order-size normalization across orders and TWAPs.
144
+ - Reject malformed JSON and mismatched protocol response shapes at the
145
+ transport/client boundary without leaking request signatures.
146
+ - Keep root-scoped actions on the main account while preserving vault targets
147
+ for orders, cancels, account queries, and protocol-specific transfers.
148
+ - Reject malformed signed success acknowledgements, zero-sized TWAP wire
149
+ values, and HTTP redirects before they can be treated as trusted outcomes.
150
+ - Normalize outer and trigger prices with the same venue tick rules, preserve
151
+ their canonical wire formatting, and accept the Exchange's `waitingForFill`
152
+ and `waitingForTrigger` grouped-order acknowledgements.
153
+ - Match the live modify contracts: singular `modify` returns the default
154
+ acknowledgement, while `batchModify` returns per-order statuses and a new
155
+ resting OID when applicable.
156
+ - Preserve BTC integer prices above `10000`, six-decimal kPEPE prices, and the
157
+ protocol tick/lot rules without adding a client-side minimum-notional gate.
158
+ - Isolate public metadata mappings from the internal snapshot and keep
159
+ credential-free root imports free of the signing stack.
160
+
161
+ ## [0.5.0] - 2026-04-20
162
+
163
+ ### Added
164
+ - Add metadata helpers for supported spot quote assets and HIP-3 dex collateral mappings, and expose the raw `allPerpMetas` info endpoint for callers that need the full on-chain perp-meta list.
165
+ - Add `docs/coin-name-mapping.md` to document how `coin` inputs resolve into internal coin names, asset ids, and display symbols across base perp, spot, and HIP-3 perp markets.
166
+
167
+ ### Changed
168
+ - Stop tracking repository-local Codex workflow files (`AGENTS.md`, `.agent/`, and `skills/`) so they stay local-only and no longer ship in the GitHub repository.
169
+ - Refactor `AsyncHyperliquid` to compose an internal `AsyncHyperliquidCore` state owner while keeping the public unified client API, so `_async_hyperliquid` no longer relies on a stateful capability inheritance chain.
170
+ - Add experimental aggregated-perp helper methods, keep `get_all_metas()` on the original per-DEX path for compatibility, and move `init_metas()` onto the explicit `allPerpMetas` metadata-refresh path to reduce request fan-out and rate-limit pressure.
171
+ - Derive aggregate DEX identities from each `allPerpMetas` payload row instead of positional prefix alignment, keep `self.perp_dexs` unchanged, refetch configured DEX metadata directly when only the aggregate payload is stale, and fail metadata refresh outright when `perpDexs` temporarily omits configured DEXs or returns an invalid base/duplicate DEX ordering so stale and shifted offset spaces never get mixed.
172
+
173
+ ### Fixed
174
+ - Correct `AsyncHyperliquid` async context-manager typing so `async with AsyncHyperliquid(...) as hl` preserves the concrete client type and satisfies static type checkers.
175
+ - Restore `AsyncHyperliquid` compatibility with `AsyncAPI` subtype checks and ensure composed core helpers still honor facade-level overrides after the composition refactor.
176
+
177
+ ## [0.4.7] - 2026-03-30
178
+
179
+ ### Fixed
180
+ - Allow `close_position`, `close_positions`, `close_all_positions`, and `close_dex_positions` to forward optional `builder` fees through the existing batch market-order path.
181
+
182
+ ## [0.4.6] - 2026-03-29
183
+
184
+ ### Added
185
+ - Extend `scripts/client_hotpath_benchmark.py` with warm-cache batch-order and batch-cancel benchmarks so scheduler overhead is measured separately from network-latency wins.
186
+
187
+ ### Changed
188
+ - Split metadata lifecycle responsibilities so shared `AsyncHyperliquid` instances still coalesce concurrent cold-start initialization, while the public `init_metas()` API remains an explicit refresh hook for long-lived clients.
189
+ - Use cached asset ids with a flatter direct-lookup fast path for warm-cache `get_mark_price`, batch order preparation, and batch cancel preparation so hot paths stop linearly rescanning metadata or paying extra helper-call overhead for local dictionary work.
190
+ - Simplify signing float formatting to trim fixed-point strings directly instead of normalizing through `Decimal`, while now rejecting non-finite values explicitly so invalid payloads fail deterministically before signing.
191
+
192
+ ## [0.4.5] - 2026-03-27
193
+
194
+ ### Added
195
+ - Add `get_mark_price(coin)` to fetch live `markPx` values for spot pairs, the primary perp dex, and builder-deployed perp dexs from the corresponding asset-context endpoints.
196
+ - Add live mainnet integration coverage for `get_mark_price`, including spot aliases, builder-deployed perp symbols, unsupported legacy symbol forms, and HYPE cross-quote parity checks against perp pricing.
197
+
198
+ ### Changed
199
+ - Allow `InfoAPI.get_perp_meta_ctx` to target a specific perp dex via the optional `dex` request field.
200
+ - Document a code-level TODO in `init_metas` for future HIP-4 outcome asset/meta initialization, since outcome asset IDs use a separate encoding path from current perp and spot markets.
201
+
202
+ ### Fixed
203
+ - Resolve spot `get_mark_price` lookups by the spot pair `index` returned in `spotMetaAndAssetCtxs`, so aliases and quoted spot pairs like `USDT0/USDC`, `USDE/USDC`, `USDH/USDC`, and `@107` read the correct live `markPx`.
204
+
205
+ ## [0.4.4] - 2026-03-25
206
+
207
+ ### Added
208
+ - Vendor repository-local review pipeline and routed review skills under `skills/` so the Reviewer workflow in `AGENTS.md` does not depend on user-level skill installation.
209
+ - Add `scripts/signing_benchmark.py` to compare cached EIP-712 template reuse, backend selection, and order batching against the legacy rebuild-on-every-call signing path with repeatable local benchmarks.
210
+ - Add `scripts/client_hotpath_benchmark.py` to measure metadata fan-out concurrency, warm-cache order rounding, and batch cancel asset-resolution throughput against legacy serial code paths.
211
+ - Add `coincurve` as a runtime dependency so `eth-account`/`eth-keys` can use the faster CoinCurve secp256k1 backend by default.
212
+ - Add `close_positions(coins)` so callers can close a selected set of positions through one batched market-order action instead of looping over `close_position`.
213
+
214
+ ### Changed
215
+ - Allow `AsyncHyperliquid` to reuse a caller-provided `aiohttp` session and use a pooled connector with DNS caching for internally managed HTTP clients.
216
+ - Reuse cached EIP-712 signing templates for static `domain` and `types` payload sections to cut Python object churn on high-frequency signed requests.
217
+ - Prepare batch order payloads concurrently before signing so large `batch_place_orders` calls spend less time serially rounding assets and prices.
218
+ - Fetch base/spot metadata and per-DEX metadata concurrently in `get_metas`, `get_all_metas`, and `get_all_market_prices`, and resolve batch cancel asset ids in parallel instead of serially awaiting each lookup.
219
+
220
+ ### Fixed
221
+ - Align the vendored review-pipeline skill metadata and `AGENTS.md` references with the existing user-level `pipeline-review` name to avoid mixed identifiers.
222
+ - Ensure signed actions use a per-client monotonic nonce generator so concurrent requests do not collide when multiple actions are submitted in the same millisecond.
223
+ - Redact signature material from debug request logs while keeping action type and request metadata visible for troubleshooting.
224
+ - Remove duplicate coin-name resolution from `get_coin_sz_decimals` so hot order-preparation paths only resolve cached metadata once per request.
225
+ - Keep `_init_spot_meta` resilient to malformed token indexes while caching quote-token aliases via `setdefault` for direct quote-token lookups.
226
+
227
+ ## [0.4.3] - 2026-03-13
228
+
229
+ ### Changed
230
+ - Document the Builder release workflow in `AGENTS.md`, including the requirement to create an explicit `vX.Y.Z` git tag for each versioned release.
231
+ - Refactor `AsyncHyperliquid` into focused internal client modules so metadata loading, read APIs, order flows, and signed account actions are easier to maintain without changing the public import path.
232
+
233
+ ### Fixed
234
+ - Restore legacy helper re-exports from `async_hyperliquid.async_hyperliquid` so internal refactoring does not break downstream imports or monkeypatch-based tests.
235
+
236
+ ## [0.4.2] - 2026-03-13
237
+
238
+ ### Added
239
+ - Vendor repository-local Codex skills for `pua-debugging`, `systematic-debugging`, `verification-before-completion`, and `python-uv-workflow` under `skills/` so agent behavior does not depend on user-level skill installation.
240
+ - Add `ty` as a `dev` dependency so the repository-local `python-uv-workflow` verification path can run inside the project.
241
+
242
+ ### Changed
243
+ - Require Builder workflow changes to update `CHANGELOG.md` in the same change set for every commit-worthy repository change.
244
+
245
+ ### Fixed
246
+ - Resolve `ty` verification issues in `InfoAPI`, benchmark scripts, and abstraction integration tests so the repository-local `python-uv-workflow` checks pass in-project.
247
+
248
+ ## [0.4.1] - 2026-03-11
249
+
250
+ ### Changed
251
+ - Tighten `OrderBuilder.f` typing from `float` to `int` to match the encoded builder fee representation used by order payloads.
252
+
253
+ ### Fixed
254
+ - Skip malformed spot metadata entries whose token indexes fall outside the returned token table, avoiding crashes when testnet returns unrecognized token references.
255
+ - Update the builder-fee integration order test to use a supported builder address and a liquid `BTC` test order payload.
256
+
257
+ ## [0.4.0] - 2026-03-05
258
+
259
+ ### Added
260
+ - Add dedicated order APIs: `place_market_order` and `place_typed_order` while keeping `place_order` for compatibility.
261
+ - Add order-type builder utilities and enums: `LimitTif`, `TriggerTpsl`, `limit_order_type`, and `trigger_order_type`.
262
+ - Add user abstraction query APIs: `InfoAPI.get_user_abstraction` and `AsyncHyperliquid.get_user_abstraction`.
263
+ - Add abstraction setting APIs: `AsyncHyperliquid.user_set_abstraction` and `AsyncHyperliquid.agent_set_abstraction`, including signing support (`USER_SET_ABSTRACTION_SIGN_TYPES` and `sign_user_set_abstraction_action`).
264
+
265
+ ### Changed
266
+ - Reorganize tests into `tests/unit` and `tests/integration`, and split exchange integration tests into `test_exchange_orders.py` and `test_exchange_actions.py`.
267
+ - Improve `ensure_order_type` typing with `TypeGuard` helpers and use the limit-order builder path to avoid loose TypedDict narrowing.
268
+
269
+ ### Deprecated
270
+ - Mark `user_dex_abstraction` and `agent_enable_dex_abstraction` as deprecated in favor of `user_set_abstraction` and `agent_set_abstraction`.
271
+
272
+ ## [0.3.10] - 2026-02-08
273
+
274
+ ### Added
275
+ - Add `user_set_abstraction` to `AsyncHyperliquid` plus signing support (`sign_user_set_abstraction_action`) and constants for the new action.
276
+ - Add `Abstraction` and `AgentAbstraction` typing literals.
277
+
278
+ ### Changed
279
+ - Remove unnecessary `type: ignore` on `ExchangeAPI.address` assignment and `msgpack.packb` call; keep a targeted ignore for `ensure_order_type`.
280
+
281
+ ## [0.3.9]
282
+
283
+ ### Added
284
+ - Add `get_user_abstraction_state` to `InfoAPI` plus AsyncHyperliquid wrappers for user abstraction queries (`get_user_dex_abstraction`, `get_user_abstraction_state`).
285
+ - Add tests for `get_user_dex_abstraction` and `get_user_abstraction_state`.
286
+
287
+ ### Changed
288
+ - Add targeted type-check ignores in `tests/test_info.py` and `utils/decorators.py` to quiet mypy/pyright warnings.
289
+
290
+ ## [0.3.8] - 2026-01-27
291
+
292
+ ### Fixed
293
+ - Corrected `dex_asset_offset` calculation for external perp DEXs (HIP-3) to align with mainnet asset IDs: changed formula to `PERP_DEX_OFFSET + (idx - 1) * 10000`.
294
+
295
+ ## [0.3.7] - 2026-01-26
296
+
297
+ ### Optimized
298
+ - `init_metas` in `AsyncHyperliquid` now only fetches metadata for DEXs explicitly specified in `perp_dexs`, reducing unnecessary HTTP calls.
299
+ - Corrected `dex_asset_offset` calculation to align with the full DEX list index, ensuring data consistency when fetching a subset of DEXs.
300
+
301
+ ### Changed
302
+ - Updated `tests/conftest.py` to include common DEXs (`flx`, `vntl`, `xyz`) by default in the test client for better coverage.
303
+
304
+ ## [0.3.5] - 2026-01-20
305
+
306
+ ### Added
307
+ - Add `close_dex_positions` to close all positions in a specific DEX.
308
+ - Add `dexs` parameter to `get_all_positions` and `close_all_positions` for granular control.
309
+
310
+ ### Changed
311
+ - Optimize request count by caching `perp_dexs` during initialization.
312
+ - Significant performance boost: `get_all_positions` now uses `asyncio.gather` for parallel fetching from multiple DEXs.
313
+ - `close_all_positions` and `close_position` now return `None` instead of raising `ValueError` when no positions are found, improving bot stability for long-running processes.
314
+ - `close_position` now only queries the specific DEX the coin belongs to, reducing Info API usage in multi-DEX environments.
315
+
316
+ ### Fixed
317
+ - Correct parameter passing in `get_dex_positions` and `get_all_positions`.
318
+ - Ensure proper import of `get_coin_dex` and `asyncio`.
319
+
320
+ ## [0.3.2] - 2025-12-01
321
+
322
+ ### Added
323
+
324
+ - Support Enable HIP3 DEX abstraction: `user_dex_abstraction`
325
+ - Support Enable HIP3 DEX abstraction (agent): `agent_enable_dex_abstraction`
326
+
327
+ ## [0.3.1] - 2025-11-28
328
+
329
+ ### Fixed
330
+
331
+ - `get_perp_account_state` `dex` argument not passed
332
+
333
+ ## [0.3.0] - 2025-11-27
334
+
335
+ ### Added
336
+
337
+ - Support HIP-3: perp dexs
338
+ - Add `AsyncHyperliquid` class to encapsulate additional functionality
339
+ - Introduce `get_all_metas` and `get_mid_price` methods to `AsyncHyperliquid` for improved meta data handling
340
+ - Add utility function `get_leverages_from_positions` to calculate leverage from positions
341
+ - Refactor `AccountState` to include `dexs` for better state management
342
+
343
+ ### Changed
344
+
345
+ - Bump version to 0.3.0
346
+ - Refactor payloads in `AsyncAPI` and `InfoAPI` to use a consistent naming convention
347
+ - Update existing methods to include return type annotations and enhanced docstrings for clarity
348
+ - Refactor tests to consistently use `AsyncHyperliquid` instead of `AsyncHyper` for improved clarity and maintainability
349
+ - Update `conftest.py` to load environment variables more efficiently
350
+ - Update methods to use `get_mid_price` for price calculations
351
+
352
+ ### Removed
353
+
354
+ - Remove deprecated `_slippage_price` method from `AsyncHyperliquid`
355
+
356
+ ### Enhanced
357
+
358
+ - Ensure all test functions are fully annotated and contain docstrings for better documentation
359
+ - Update tests to cover new functionality and ensure comprehensive coverage
360
+
361
+ ## [0.2.6] - 2025-10-31
362
+
363
+ ### Changed
364
+
365
+ - Refactor: integrate the `vault` and `expire` arguments into class attribute (2025-10-31)
366
+
367
+ ## [0.2.5] - 2025-08-22
368
+
369
+ ### Fixed
370
+
371
+ - Update meta cache if coin not found to ensure works for new list coin
372
+
373
+ ## [0.2.4] - 2025-08-11
374
+
375
+ ### Added
376
+
377
+ - Support transfer between accounts
378
+ - Support transfer between perpetual and spot
379
+ - Support transfer between perpetual and vaults
380
+ - Support transfer HYPE between spot and staking
381
+ - Support withdraw
382
+ - Support token delegation
383
+ - Support approve agent wallet (api wallet)
384
+ - Support convert single user to multi-sig user
385
+
386
+ ## [0.2.3] - 2025-08-07
387
+
388
+ ### Added
389
+
390
+ - Support to enable/disable EVM big block for HyperEVM smart contract deploy (2025-08-05)
391
+
392
+ ### Changed
393
+
394
+ - Refactor: Change project layout from 'flat layout' to 'src layout' (2025-08-07)
395
+ - Integrate `uv` and add Hyperliquid EVM client (2025-08-07)
396
+
397
+ ### Updated
398
+
399
+ - Update aiohttp 3.11.13 -> 3.12.15 (2025-08-02)
400
+
401
+ ## [0.2.2] - 2025-07-24
402
+
403
+ ### Fixed
404
+
405
+ - Strip '.0' for sz in place_twap (2025-07-24)
406
+
407
+ ## [0.2.1] - 2025-07-17
408
+
409
+ ### Added
410
+
411
+ - Support cancel order by cloid (2025-07-17)
412
+
413
+ ## [0.2.0] - 2025-07-16
414
+
415
+ ### Added
416
+
417
+ - Support place twap and cancel twap (2025-07-16)
418
+ - Support modify order (2025-07-16)
419
+
420
+ ## [0.1.27] - 2025-07-14
421
+
422
+ ### Fixed
423
+
424
+ - Remove redundancy get_coin_name in canceling (2025-07-14)
425
+ - Remove customized coin symbols in metas to avoid conflict (2025-07-14)
426
+
427
+ ## [0.1.26] - 2025-07-02
428
+
429
+ ### Fixed
430
+
431
+ - Round px properly with tick and lot size (2025-07-02)
432
+
433
+ ## [0.1.20] - 2025-06-30
434
+
435
+ ### Changed
436
+
437
+ - Deprecate _slippage_price, add _round_sz_px (2025-06-30)
438
+ - Unify argument name for orders: limit_px -> px, reduce_only -> ro (2025-06-30)
439
+
440
+ ## [0.1.19] - 2025-06-29
441
+
442
+ ### Added
443
+
444
+ - Support place TP/SL orders in place_order (2025-06-29)
445
+ - Add batch_place_orders to aggregate multiple orders into one request (2025-06-29)
446
+ - Add batch_cancel_orders to make cancels more efficient (2025-06-29)
447
+ - Use batch_place_orders in close_all_positions (2025-06-29)
448
+ - Test for batching (batch_place_orders and batch_cancel_orders) (2025-06-29)
449
+
450
+ ### Fixed
451
+
452
+ - Do not add builder into OrderAction if builder is None (2025-06-29)
453
+
454
+ ### Changed
455
+
456
+ - Use modern typing (python 3.10 and above) (2025-06-29)
457
+ - Comprehensive for cancel_orders (2025-06-29)
458
+ - Use more generic way in tests (2025-06-29)
459
+
460
+ ### Enhanced
461
+
462
+ - Init_metas if coin not found in self.coin_names at the first time (2025-06-29)
463
+
464
+ ## [0.1.18] - 2025-06-15
465
+
466
+ ### Fixed
467
+
468
+ - Fix typo in ClearinghouseState (2025-06-15)
469
+
470
+ ### Changed
471
+
472
+ - Remove commented codes cause not use anymore (2025-06-03)
473
+ - Add USD transfer functionalities (2025-06-03)
474
+ - Enhance type annotations and improve error handling in AsyncAPI and AsyncHyper classes (2025-06-03)
475
+
476
+ ## [0.1.17] - 2025-03-30
477
+
478
+ ### Added
479
+
480
+ - Add spot account state and perp account state (2025-03-30)
481
+ - Retrieve user latest ledgers (deposit, withdraw, transfer) (2025-03-26)
482
+ - Add Order types for better type hints (2025-03-18)
483
+ - Support retrieve user's portfolio (2025-03-17)
484
+ - Support get market price for all coins (2025-03-17)
485
+ - Support get coin symbol via it's name, mainly for spot coin (2025-03-16)
486
+ - Support for get account state (2025-03-15)
487
+
488
+ ### Fixed
489
+
490
+ - Wrong return type for latest fundings (2025-03-26)
491
+ - Typo for get_order_status return type (2025-03-18)
492
+ - Can not get the spot coin name with it's symbols (2025-03-17)
493
+ - get_coin_symbol error with coin name for spot (2025-03-16)
494
+ - Remove un-necessary argument for market price (2025-03-15)
495
+
496
+ ## [0.1.2] - 2025-03-15
497
+
498
+ ### Added
499
+
500
+ - Support close all positions (2025-03-15)
501
+ - Support cancel orders (2025-03-15)
502
+
503
+ ### Changed
504
+
505
+ - Change name to async-hyperliquid (2025-03-14)
506
+
507
+ ## [0.1.0] - 2025-03-14
508
+
509
+ ### Added
510
+
511
+ - Initial commit with basic functionality (2025-03-14)
512
+ - Project url metas for PyPI (2025-03-14)
513
+ - Pre-commit configuration (2025-03-14)
514
+
515
+ ### Fixed
516
+
517
+ - Wrong test arguments for update_leverage (2025-03-14)
518
+ - Signing error for place order (2025-03-14)
519
+
520
+ ### Changed
521
+
522
+ - Ignore poetry build stuffs (2025-03-14)
523
+ - Ignore test cache files (2025-03-14)
@@ -0,0 +1,99 @@
1
+ Metadata-Version: 2.4
2
+ Name: async-hyperliquid
3
+ Version: 1.0.0
4
+ Summary: Async Hyperliquid client using aiohttp
5
+ Keywords: dex,hyperliquid,async,aiohttp,trading,cryptocurrency,defi
6
+ Author: Yuki
7
+ Author-email: Yuki <yuqi.lyle@gmail.com>
8
+ License-Expression: MIT
9
+ License-File: LICENSE
10
+ Classifier: Development Status :: 5 - Production/Stable
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Financial and Insurance Industry
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3 :: Only
16
+ Classifier: Topic :: Office/Business :: Financial :: Investment
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
19
+ Classifier: Framework :: AsyncIO
20
+ Classifier: Framework :: aiohttp
21
+ Classifier: Typing :: Typed
22
+ Requires-Dist: aiohttp>=3.14.3,<4.0.0
23
+ Requires-Dist: msgpack>=1.2.1,<2.0.0
24
+ Requires-Dist: eth-account>=0.13.7,<0.14.0
25
+ Requires-Dist: eth-utils>=5.3.1,<6.0.0
26
+ Requires-Dist: coincurve>=21.0.0
27
+ Requires-Python: >=3.12
28
+ Project-URL: Homepage, https://github.com/owlyfi/async-hyperliquid
29
+ Project-URL: Documentation, https://async-hyperliquid.readthedocs.io/
30
+ Project-URL: Repository, https://github.com/owlyfi/async-hyperliquid
31
+ Project-URL: Issues, https://github.com/owlyfi/async-hyperliquid/issues
32
+ Project-URL: Changelog, https://github.com/owlyfi/async-hyperliquid/blob/main/CHANGELOG.md
33
+ Description-Content-Type: text/markdown
34
+
35
+ # Async Hyperliquid
36
+
37
+ [![CI](https://github.com/owlyfi/async-hyperliquid/actions/workflows/ci.yml/badge.svg)](https://github.com/owlyfi/async-hyperliquid/actions/workflows/ci.yml)
38
+ [![Documentation Status](https://readthedocs.org/projects/async-hyperliquid/badge/?version=latest)](https://async-hyperliquid.readthedocs.io/en/latest/?badge=latest)
39
+ [![PyPI](https://img.shields.io/pypi/v/async-hyperliquid.svg)](https://pypi.org/project/async-hyperliquid/)
40
+
41
+ `async-hyperliquid` is a typed, asynchronous Python client for the Hyperliquid
42
+ REST API. It provides credential-free market and account queries through
43
+ `InfoClient`, plus authenticated order workflows through `AsyncHyperliquid`.
44
+ The client uses `aiohttp`, keeps protocol-shaped responses as `TypedDict`, and
45
+ supports explicit mainnet and testnet routing.
46
+
47
+ ## Installation
48
+
49
+ ```bash
50
+ pip install async-hyperliquid
51
+ ```
52
+
53
+ ## Read market data
54
+
55
+ ```python
56
+ import asyncio
57
+
58
+ from async_hyperliquid import InfoClient
59
+ from async_hyperliquid.types import Network
60
+
61
+
62
+ async def main() -> None:
63
+ async with InfoClient(network=Network.MAINNET) as client:
64
+ print(await client.mid_price("BTC"))
65
+
66
+
67
+ asyncio.run(main())
68
+ ```
69
+
70
+ ## Place a testnet order
71
+
72
+ Use a dedicated API-wallet key and start on testnet. This submits a signed
73
+ market order.
74
+
75
+ ```python
76
+ import asyncio
77
+ import os
78
+
79
+ from async_hyperliquid import AsyncHyperliquid
80
+ from async_hyperliquid.types import Network
81
+
82
+
83
+ async def main() -> None:
84
+ async with AsyncHyperliquid(
85
+ os.environ["HL_ACCOUNT_ADDRESS"],
86
+ os.environ["HL_SIGNING_KEY"],
87
+ network=Network.TESTNET,
88
+ ) as client:
89
+ result = await client.place_order("BTC", True, 0.001, 0, is_market=True)
90
+ print(result)
91
+
92
+
93
+ asyncio.run(main())
94
+ ```
95
+
96
+ Learn more in the [Read the Docs documentation](https://async-hyperliquid.readthedocs.io/),
97
+ [API reference](https://async-hyperliquid.readthedocs.io/en/latest/reference/index.html),
98
+ [migration guide](https://async-hyperliquid.readthedocs.io/en/latest/migration-0.5-to-1.0.html),
99
+ [changelog](CHANGELOG.md), and [license](LICENSE).
@@ -0,0 +1,65 @@
1
+ # Async Hyperliquid
2
+
3
+ [![CI](https://github.com/owlyfi/async-hyperliquid/actions/workflows/ci.yml/badge.svg)](https://github.com/owlyfi/async-hyperliquid/actions/workflows/ci.yml)
4
+ [![Documentation Status](https://readthedocs.org/projects/async-hyperliquid/badge/?version=latest)](https://async-hyperliquid.readthedocs.io/en/latest/?badge=latest)
5
+ [![PyPI](https://img.shields.io/pypi/v/async-hyperliquid.svg)](https://pypi.org/project/async-hyperliquid/)
6
+
7
+ `async-hyperliquid` is a typed, asynchronous Python client for the Hyperliquid
8
+ REST API. It provides credential-free market and account queries through
9
+ `InfoClient`, plus authenticated order workflows through `AsyncHyperliquid`.
10
+ The client uses `aiohttp`, keeps protocol-shaped responses as `TypedDict`, and
11
+ supports explicit mainnet and testnet routing.
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ pip install async-hyperliquid
17
+ ```
18
+
19
+ ## Read market data
20
+
21
+ ```python
22
+ import asyncio
23
+
24
+ from async_hyperliquid import InfoClient
25
+ from async_hyperliquid.types import Network
26
+
27
+
28
+ async def main() -> None:
29
+ async with InfoClient(network=Network.MAINNET) as client:
30
+ print(await client.mid_price("BTC"))
31
+
32
+
33
+ asyncio.run(main())
34
+ ```
35
+
36
+ ## Place a testnet order
37
+
38
+ Use a dedicated API-wallet key and start on testnet. This submits a signed
39
+ market order.
40
+
41
+ ```python
42
+ import asyncio
43
+ import os
44
+
45
+ from async_hyperliquid import AsyncHyperliquid
46
+ from async_hyperliquid.types import Network
47
+
48
+
49
+ async def main() -> None:
50
+ async with AsyncHyperliquid(
51
+ os.environ["HL_ACCOUNT_ADDRESS"],
52
+ os.environ["HL_SIGNING_KEY"],
53
+ network=Network.TESTNET,
54
+ ) as client:
55
+ result = await client.place_order("BTC", True, 0.001, 0, is_market=True)
56
+ print(result)
57
+
58
+
59
+ asyncio.run(main())
60
+ ```
61
+
62
+ Learn more in the [Read the Docs documentation](https://async-hyperliquid.readthedocs.io/),
63
+ [API reference](https://async-hyperliquid.readthedocs.io/en/latest/reference/index.html),
64
+ [migration guide](https://async-hyperliquid.readthedocs.io/en/latest/migration-0.5-to-1.0.html),
65
+ [changelog](CHANGELOG.md), and [license](LICENSE).