typed-hyperliquid 1.2.2__tar.gz → 1.2.4__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.
- {typed_hyperliquid-1.2.2 → typed_hyperliquid-1.2.4}/LICENSE +1 -1
- {typed_hyperliquid-1.2.2/src/typed_hyperliquid.egg-info → typed_hyperliquid-1.2.4}/PKG-INFO +22 -19
- typed_hyperliquid-1.2.4/README.md +77 -0
- {typed_hyperliquid-1.2.2 → typed_hyperliquid-1.2.4}/pyproject.toml +3 -2
- {typed_hyperliquid-1.2.2 → typed_hyperliquid-1.2.4}/src/hyperliquid/__init__.py +45 -15
- {typed_hyperliquid-1.2.2 → typed_hyperliquid-1.2.4}/src/hyperliquid/core/__init__.py +2 -1
- typed_hyperliquid-1.2.4/src/hyperliquid/core/__init__.pyi +31 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/core/endpoint/__init__.py +0 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/core/endpoint/rpc.py +51 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/core/endpoint/stream.py +77 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/core/exc.py +22 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/core/types.py +15 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/core/urls.py +19 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/core/ws/__init__.py +3 -0
- {typed_hyperliquid-1.2.2 → typed_hyperliquid-1.2.4}/src/hyperliquid/core/ws/client.py +93 -35
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/__init__.py +148 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/activate_outcome_deployer.py +76 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/agent_enable_dex_abstraction.py +56 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/agent_send_asset.py +100 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/agent_set_abstraction.py +60 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/approve_agent.py +79 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/approve_builder_fee.py +78 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/authorize_aqav2_role.py +64 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/cancel.py +102 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/cancel_by_cloid.py +102 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/claim_rewards.py +56 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/core/__init__.py +130 -0
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/core/signing.py → typed_hyperliquid-1.2.4/src/hyperliquid/exchange/core/auth.py +39 -10
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/core/envelope.py +43 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/core/transport/__init__.py +0 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/core/transport/http.py +42 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/core/transport/ws.py +41 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/disable_aligned_quote_token.py +67 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/disable_dex.py +59 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/disable_quote_token.py +64 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/enable_aligned_quote_token.py +67 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/enable_quote_token.py +64 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/genesis.py +80 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/gossip_priority_bid.py +70 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/halt_trading.py +70 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/hip3_liquidator_transfer.py +70 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/merge_outcome.py +68 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/merge_question.py +68 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/modify_order.py +120 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/modify_orders.py +236 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/negate_outcome.py +72 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/noop.py +58 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/order.py +246 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/register_and_associate_named_outcome_from_template.py +90 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/register_asset.py +102 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/register_asset2.py +102 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/register_hyperliquidity.py +91 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/register_question_from_template.py +110 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/register_spot.py +64 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/register_standalone_outcome_from_template.py +85 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/register_token2.py +89 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/reserve_request_weight.py +67 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/schedule_cancel.py +65 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/send_asset.py +98 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/send_to_evm_with_data.py +108 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/set_deployer_fees.py +80 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/set_deployer_trading_fee_share.py +78 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/set_fee_recipient.py +73 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/set_funding_interest_rates.py +62 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/set_funding_multipliers.py +62 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/set_margin_modes.py +62 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/set_margin_table_ids.py +62 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/set_open_interest_caps.py +62 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/set_oracle.py +78 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/set_perp_annotation.py +85 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/set_sub_deployers.py +125 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/settle_outcome.py +91 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/settle_question2.py +113 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/split_outcome.py +68 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/spot_transfer.py +89 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/staking_deposit.py +73 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/staking_withdraw.py +73 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/token_delegate.py +83 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/top_up_isolated_only_margin.py +68 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/twap_cancel.py +83 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/twap_order.py +107 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/update_isolated_margin.py +72 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/update_leverage.py +72 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/usd_class_transfer.py +84 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/usdc_transfer.py +84 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/user_dex_abstraction.py +78 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/user_genesis.py +84 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/user_set_abstraction.py +78 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/validator_l1_stream.py +60 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/vault_transfer.py +71 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/exchange/withdraw3.py +84 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/__init__.py +122 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/active_asset_data.py +71 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/aligned_quote_token_info.py +48 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/all_borrow_lend_reserve_states.py +49 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/all_mids.py +32 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/all_perp_metas.py +70 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/approved_builders.py +31 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/borrow_lend_reserve_state.py +52 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/borrow_lend_user_state.py +67 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/builder_fee_approved.py +34 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/candle_snapshot.py +115 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/clearinghouse_state.py +144 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/core/__init__.py +80 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/core/transport/__init__.py +0 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/core/transport/http.py +34 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/core/transport/ws.py +34 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/exchange_status.py +35 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/frontend_open_orders.py +71 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/funding_history.py +115 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/gossip_priority_auction_status.py +45 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/l2_book.py +77 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/open_orders.py +52 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/order_status.py +128 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/outcome_meta.py +91 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/outcome_templates.py +76 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/perp_annotation.py +44 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/perp_categories.py +26 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/perp_concise_annotations.py +37 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/perp_deploy_auction_status.py +41 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/perp_dex_limits.py +44 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/perp_dex_status.py +38 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/perp_dexs.py +53 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/perp_meta.py +74 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/perp_meta_and_asset_ctxs.py +99 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/perps_at_open_interest_cap.py +32 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/predicted_fundings.py +41 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/settled_outcome.py +63 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/spot_clearinghouse_state.py +53 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/spot_deploy_state.py +83 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/spot_meta.py +72 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/spot_meta_and_asset_ctxs.py +91 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/spot_pair_deploy_auction_status.py +39 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/staking_delegations.py +42 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/staking_history.py +58 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/staking_rewards.py +42 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/staking_summary.py +44 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/sub_accounts.py +107 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/token_details.py +77 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/user_abstraction.py +39 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/user_dex_abstraction.py +31 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/user_fees.py +149 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/user_fills.py +75 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/user_fills_by_time.py +148 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/user_funding.py +131 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/user_historical_orders.py +108 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/user_non_funding_ledger_updates.py +427 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/user_portfolio.py +76 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/user_rate_limit.py +44 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/user_referral.py +121 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/user_role.py +90 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/user_twap_slice_fills.py +74 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/user_vault_equities.py +40 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/info/vault_details.py +136 -0
- {typed_hyperliquid-1.2.2 → typed_hyperliquid-1.2.4}/src/hyperliquid/streams/__init__.py +36 -28
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/active_asset_ctx.py +123 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/active_asset_data.py +103 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/all_dexs_asset_ctxs.py +102 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/all_dexs_clearinghouse_state.py +107 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/all_mids.py +65 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/bbo.py +100 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/candle.py +184 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/clearinghouse_state.py +114 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/core.py +50 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/fast_asset_ctxs.py +46 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/l2_book.py +137 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/notification.py +64 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/open_orders.py +74 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/order_updates.py +118 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/outcome_meta_updates.py +130 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/spot_state.py +103 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/trades.py +90 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/twap_states.py +99 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/user_events.py +177 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/user_fills.py +126 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/user_fundings.py +83 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/user_non_funding_ledger_updates.py +257 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/user_twap_history.py +111 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/user_twap_slice_fills.py +123 -0
- typed_hyperliquid-1.2.4/src/hyperliquid/streams/web_data3.py +106 -0
- {typed_hyperliquid-1.2.2 → typed_hyperliquid-1.2.4/src/typed_hyperliquid.egg-info}/PKG-INFO +22 -19
- typed_hyperliquid-1.2.4/src/typed_hyperliquid.egg-info/SOURCES.txt +185 -0
- {typed_hyperliquid-1.2.2 → typed_hyperliquid-1.2.4}/src/typed_hyperliquid.egg-info/requires.txt +1 -0
- typed_hyperliquid-1.2.2/README.md +0 -75
- typed_hyperliquid-1.2.2/src/hyperliquid/core/__init__.pyi +0 -19
- typed_hyperliquid-1.2.2/src/hyperliquid/core/exc.py +0 -1
- typed_hyperliquid-1.2.2/src/hyperliquid/core/util.py +0 -19
- typed_hyperliquid-1.2.2/src/hyperliquid/core/validation.py +0 -6
- typed_hyperliquid-1.2.2/src/hyperliquid/core/ws/__init__.py +0 -1
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/__init__.py +0 -64
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/agent_enable_dex_abstraction.py +0 -38
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/agent_set_abstraction.py +0 -47
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/approve_agent.py +0 -66
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/approve_builder_fee.py +0 -64
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/cancel.py +0 -64
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/cancel_by_cloid.py +0 -64
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/core/__init__.py +0 -2
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/core/mixin.py +0 -185
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/modify_order.py +0 -83
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/modify_orders.py +0 -84
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/noop.py +0 -43
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/order.py +0 -152
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/reserve_request_weight.py +0 -51
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/schedule_cancel.py +0 -53
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/send_asset.py +0 -81
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/send_to_evm_with_data.py +0 -90
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/spot_transfer.py +0 -68
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/staking_deposit.py +0 -60
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/staking_withdraw.py +0 -60
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/token_delegate.py +0 -68
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/twap_cancel.py +0 -65
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/twap_order.py +0 -76
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/update_isolated_margin.py +0 -103
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/update_leverage.py +0 -59
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/usd_class_transfer.py +0 -69
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/usdc_transfer.py +0 -64
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/user_dex_abstraction.py +0 -64
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/user_set_abstraction.py +0 -66
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/validator_l1_stream.py +0 -45
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/vault_transfer.py +0 -57
- typed_hyperliquid-1.2.2/src/hyperliquid/exchange/withdraw3.py +0 -64
- typed_hyperliquid-1.2.2/src/hyperliquid/info/__init__.py +0 -8
- typed_hyperliquid-1.2.2/src/hyperliquid/info/core.py +0 -146
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/__init__.py +0 -64
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/aligned_quote_token_info.py +0 -27
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/all_borrow_lend_reserve_states.py +0 -28
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/all_mids.py +0 -24
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/borrow_lend_reserve_state.py +0 -31
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/borrow_lend_user_state.py +0 -33
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/builder_fee_approved.py +0 -26
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/candle_snapshot.py +0 -56
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/frontend_open_orders.py +0 -58
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/l2_book.py +0 -46
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/open_orders.py +0 -44
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/order_status.py +0 -96
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/staking_delegations.py +0 -25
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/staking_history.py +0 -74
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/staking_rewards.py +0 -25
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/staking_summary.py +0 -24
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/sub_accounts.py +0 -54
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/user_abstraction.py +0 -26
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/user_dex_abstraction.py +0 -19
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/user_fees.py +0 -75
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/user_fills.py +0 -61
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/user_fills_by_time.py +0 -92
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/user_historical_orders.py +0 -65
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/user_portfolio.py +0 -38
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/user_rate_limit.py +0 -28
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/user_referral.py +0 -57
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/user_role.py +0 -54
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/user_twap_slice_fills.py +0 -64
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/user_vault_equities.py +0 -26
- typed_hyperliquid-1.2.2/src/hyperliquid/info/methods/vault_details.py +0 -79
- typed_hyperliquid-1.2.2/src/hyperliquid/info/perps/__init__.py +0 -38
- typed_hyperliquid-1.2.2/src/hyperliquid/info/perps/active_asset_data.py +0 -41
- typed_hyperliquid-1.2.2/src/hyperliquid/info/perps/all_perp_metas.py +0 -54
- typed_hyperliquid-1.2.2/src/hyperliquid/info/perps/clearinghouse_state.py +0 -73
- typed_hyperliquid-1.2.2/src/hyperliquid/info/perps/funding_history.py +0 -60
- typed_hyperliquid-1.2.2/src/hyperliquid/info/perps/perp_annotation.py +0 -22
- typed_hyperliquid-1.2.2/src/hyperliquid/info/perps/perp_categories.py +0 -16
- typed_hyperliquid-1.2.2/src/hyperliquid/info/perps/perp_deploy_auction_status.py +0 -22
- typed_hyperliquid-1.2.2/src/hyperliquid/info/perps/perp_dex_limits.py +0 -24
- typed_hyperliquid-1.2.2/src/hyperliquid/info/perps/perp_dex_status.py +0 -21
- typed_hyperliquid-1.2.2/src/hyperliquid/info/perps/perp_dexs.py +0 -24
- typed_hyperliquid-1.2.2/src/hyperliquid/info/perps/perp_meta.py +0 -46
- typed_hyperliquid-1.2.2/src/hyperliquid/info/perps/perp_meta_and_asset_ctxs.py +0 -63
- typed_hyperliquid-1.2.2/src/hyperliquid/info/perps/perps_at_open_interest_cap.py +0 -25
- typed_hyperliquid-1.2.2/src/hyperliquid/info/perps/predicted_fundings.py +0 -23
- typed_hyperliquid-1.2.2/src/hyperliquid/info/perps/user_funding.py +0 -67
- typed_hyperliquid-1.2.2/src/hyperliquid/info/perps/user_non_funding_ledger_updates.py +0 -333
- typed_hyperliquid-1.2.2/src/hyperliquid/info/spot/__init__.py +0 -18
- typed_hyperliquid-1.2.2/src/hyperliquid/info/spot/spot_clearinghouse_state.py +0 -28
- typed_hyperliquid-1.2.2/src/hyperliquid/info/spot/spot_deploy_state.py +0 -45
- typed_hyperliquid-1.2.2/src/hyperliquid/info/spot/spot_meta.py +0 -53
- typed_hyperliquid-1.2.2/src/hyperliquid/info/spot/spot_meta_and_asset_ctxs.py +0 -27
- typed_hyperliquid-1.2.2/src/hyperliquid/info/spot/spot_pair_deploy_auction_status.py +0 -22
- typed_hyperliquid-1.2.2/src/hyperliquid/info/spot/token_details.py +0 -40
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/active_asset_ctx.py +0 -65
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/active_asset_data.py +0 -60
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/all_dexs_asset_ctxs.py +0 -55
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/all_mids.py +0 -35
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/bbo.py +0 -45
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/candle.py +0 -53
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/clearinghouse_state.py +0 -49
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/core.py +0 -62
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/l2_book.py +0 -65
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/notification.py +0 -31
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/open_orders.py +0 -40
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/order_updates.py +0 -46
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/trades.py +0 -59
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/twap_states.py +0 -53
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/user_events.py +0 -88
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/user_fills.py +0 -67
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/user_fundings.py +0 -49
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/user_non_funding_ledger_updates.py +0 -314
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/user_twap_history.py +0 -57
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/user_twap_slice_fills.py +0 -66
- typed_hyperliquid-1.2.2/src/hyperliquid/streams/web_data3.py +0 -57
- typed_hyperliquid-1.2.2/src/typed_hyperliquid.egg-info/SOURCES.txt +0 -128
- {typed_hyperliquid-1.2.2 → typed_hyperliquid-1.2.4}/setup.cfg +0 -0
- {typed_hyperliquid-1.2.2 → typed_hyperliquid-1.2.4}/src/hyperliquid/py.typed +0 -0
- {typed_hyperliquid-1.2.2 → typed_hyperliquid-1.2.4}/src/typed_hyperliquid.egg-info/dependency_links.txt +0 -0
- {typed_hyperliquid-1.2.2 → typed_hyperliquid-1.2.4}/src/typed_hyperliquid.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: typed-hyperliquid
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.4
|
|
4
4
|
Summary: A fully typed, validated async client for the Hyperliquid API.
|
|
5
5
|
Author-email: Marcel Claramunt <marcel@tribulnation.com>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -15,12 +15,13 @@ Requires-Python: >=3.10
|
|
|
15
15
|
Description-Content-Type: text/markdown
|
|
16
16
|
License-File: LICENSE
|
|
17
17
|
Requires-Dist: typed-core>=0.2.0
|
|
18
|
+
Requires-Dist: lazy-loader
|
|
18
19
|
Requires-Dist: eth-account
|
|
19
20
|
Requires-Dist: msgpack
|
|
20
21
|
Dynamic: license-file
|
|
21
22
|
|
|
22
23
|
<p align="center">
|
|
23
|
-
<a href="https://
|
|
24
|
+
<a href="https://tribulnation.com/typed/hyperliquid">
|
|
24
25
|
<picture>
|
|
25
26
|
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tribulnation/hyperliquid/refs/heads/main/media/hyperliquid-dark.svg">
|
|
26
27
|
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/tribulnation/hyperliquid/refs/heads/main/media/hyperliquid-light.svg">
|
|
@@ -40,7 +41,7 @@ Dynamic: license-file
|
|
|
40
41
|
<a href="https://pypi.org/project/typed-hyperliquid/">
|
|
41
42
|
<img src="https://img.shields.io/pypi/pyversions/typed-hyperliquid.svg" alt="Python versions">
|
|
42
43
|
</a>
|
|
43
|
-
<a href="https://
|
|
44
|
+
<a href="https://tribulnation.com/typed/hyperliquid/">
|
|
44
45
|
<img src="https://img.shields.io/badge/docs-live-black" alt="Docs">
|
|
45
46
|
</a>
|
|
46
47
|
<a href="LICENSE">
|
|
@@ -50,7 +51,7 @@ Dynamic: license-file
|
|
|
50
51
|
|
|
51
52
|
---
|
|
52
53
|
|
|
53
|
-
- **Documentation**: [https://
|
|
54
|
+
- **Documentation**: [https://tribulnation.com/typed/hyperliquid](https://tribulnation.com/typed/hyperliquid)
|
|
54
55
|
- **Source Code**: [https://github.com/tribulnation/hyperliquid](https://github.com/tribulnation/hyperliquid)
|
|
55
56
|
|
|
56
57
|
---
|
|
@@ -67,11 +68,12 @@ async with Hyperliquid.ws(public=True) as client:
|
|
|
67
68
|
|
|
68
69
|
## Why Typed Hyperliquid?
|
|
69
70
|
|
|
70
|
-
- **🎯 Precise Types**: Typed endpoint inputs and responses
|
|
71
|
-
- **✅ Runtime Validation**:
|
|
72
|
-
- **⚡ Async First**: HTTP, WebSocket
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
- **🎯 Precise Types**: Typed endpoint inputs and responses, not `dict`/`Any`.
|
|
72
|
+
- **✅ Runtime Validation**: Responses validated by default, not just typed on paper.
|
|
73
|
+
- **⚡ Async First**: HTTP, request-response WebSocket, and subscription streams, built for
|
|
74
|
+
concurrent workflows.
|
|
75
|
+
- **📚 Full Surface**: `client.info`, `client.exchange`, and `client.streams` -- perps,
|
|
76
|
+
spot, and every documented info/exchange/stream endpoint, not just the popular ones.
|
|
75
77
|
|
|
76
78
|
## Installation
|
|
77
79
|
|
|
@@ -81,16 +83,17 @@ pip install typed-hyperliquid
|
|
|
81
83
|
|
|
82
84
|
## How To
|
|
83
85
|
|
|
84
|
-
- [Place & Manage Orders](https://
|
|
85
|
-
- [Fetch Market Data](https://
|
|
86
|
-
- [Fetch Your Balances & Positions](https://
|
|
87
|
-
- [Fetch Your Transactions](https://
|
|
88
|
-
- [Listen To Your Trades](https://
|
|
89
|
-
- [Listen To Public Data](https://
|
|
86
|
+
- [Place & Manage Orders](https://tribulnation.com/typed/hyperliquid/how-to/place-and-manage-orders)
|
|
87
|
+
- [Fetch Market Data](https://tribulnation.com/typed/hyperliquid/how-to/fetch-market-data)
|
|
88
|
+
- [Fetch Your Balances & Positions](https://tribulnation.com/typed/hyperliquid/how-to/fetch-balances-and-positions)
|
|
89
|
+
- [Fetch Your Transactions](https://tribulnation.com/typed/hyperliquid/how-to/fetch-transactions)
|
|
90
|
+
- [Listen To Your Trades](https://tribulnation.com/typed/hyperliquid/how-to/listen-to-your-trades)
|
|
91
|
+
- [Listen To Public Data](https://tribulnation.com/typed/hyperliquid/how-to/listen-to-public-data)
|
|
90
92
|
|
|
91
93
|
## Reference
|
|
92
94
|
|
|
93
|
-
- [Authenticated Setup](https://
|
|
94
|
-
- [
|
|
95
|
-
- [
|
|
96
|
-
- [
|
|
95
|
+
- [Authenticated Setup](https://tribulnation.com/typed/hyperliquid/authenticated-setup)
|
|
96
|
+
- [Async Usage](https://tribulnation.com/typed/hyperliquid/reference/async-usage)
|
|
97
|
+
- [Error Handling](https://tribulnation.com/typed/hyperliquid/reference/error-handling)
|
|
98
|
+
- [Environment Variables](https://tribulnation.com/typed/hyperliquid/reference/env-vars)
|
|
99
|
+
- [Timestamps](https://tribulnation.com/typed/hyperliquid/reference/timestamps)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://tribulnation.com/typed/hyperliquid">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/tribulnation/hyperliquid/refs/heads/main/media/hyperliquid-dark.svg">
|
|
5
|
+
<source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/tribulnation/hyperliquid/refs/heads/main/media/hyperliquid-light.svg">
|
|
6
|
+
<img alt="Typed Hyperliquid" src="https://raw.githubusercontent.com/tribulnation/hyperliquid/refs/heads/main/media/hyperliquid-light.svg" width="520">
|
|
7
|
+
</picture>
|
|
8
|
+
</a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<em>A fully typed, validated async client for the Hyperliquid API.</em>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="https://pypi.org/project/typed-hyperliquid/">
|
|
17
|
+
<img src="https://img.shields.io/pypi/v/typed-hyperliquid.svg" alt="PyPI version">
|
|
18
|
+
</a>
|
|
19
|
+
<a href="https://pypi.org/project/typed-hyperliquid/">
|
|
20
|
+
<img src="https://img.shields.io/pypi/pyversions/typed-hyperliquid.svg" alt="Python versions">
|
|
21
|
+
</a>
|
|
22
|
+
<a href="https://tribulnation.com/typed/hyperliquid/">
|
|
23
|
+
<img src="https://img.shields.io/badge/docs-live-black" alt="Docs">
|
|
24
|
+
</a>
|
|
25
|
+
<a href="LICENSE">
|
|
26
|
+
<img src="https://img.shields.io/pypi/l/typed-hyperliquid.svg" alt="License">
|
|
27
|
+
</a>
|
|
28
|
+
</p>
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
- **Documentation**: [https://tribulnation.com/typed/hyperliquid](https://tribulnation.com/typed/hyperliquid)
|
|
33
|
+
- **Source Code**: [https://github.com/tribulnation/hyperliquid](https://github.com/tribulnation/hyperliquid)
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from hyperliquid import Hyperliquid
|
|
39
|
+
|
|
40
|
+
async with Hyperliquid.ws(public=True) as client:
|
|
41
|
+
stream = await client.streams.trades('BTC')
|
|
42
|
+
async for msg in stream:
|
|
43
|
+
for trade in msg:
|
|
44
|
+
print(trade['px'], trade['sz'], trade['side'])
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Why Typed Hyperliquid?
|
|
48
|
+
|
|
49
|
+
- **🎯 Precise Types**: Typed endpoint inputs and responses, not `dict`/`Any`.
|
|
50
|
+
- **✅ Runtime Validation**: Responses validated by default, not just typed on paper.
|
|
51
|
+
- **⚡ Async First**: HTTP, request-response WebSocket, and subscription streams, built for
|
|
52
|
+
concurrent workflows.
|
|
53
|
+
- **📚 Full Surface**: `client.info`, `client.exchange`, and `client.streams` -- perps,
|
|
54
|
+
spot, and every documented info/exchange/stream endpoint, not just the popular ones.
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install typed-hyperliquid
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## How To
|
|
63
|
+
|
|
64
|
+
- [Place & Manage Orders](https://tribulnation.com/typed/hyperliquid/how-to/place-and-manage-orders)
|
|
65
|
+
- [Fetch Market Data](https://tribulnation.com/typed/hyperliquid/how-to/fetch-market-data)
|
|
66
|
+
- [Fetch Your Balances & Positions](https://tribulnation.com/typed/hyperliquid/how-to/fetch-balances-and-positions)
|
|
67
|
+
- [Fetch Your Transactions](https://tribulnation.com/typed/hyperliquid/how-to/fetch-transactions)
|
|
68
|
+
- [Listen To Your Trades](https://tribulnation.com/typed/hyperliquid/how-to/listen-to-your-trades)
|
|
69
|
+
- [Listen To Public Data](https://tribulnation.com/typed/hyperliquid/how-to/listen-to-public-data)
|
|
70
|
+
|
|
71
|
+
## Reference
|
|
72
|
+
|
|
73
|
+
- [Authenticated Setup](https://tribulnation.com/typed/hyperliquid/authenticated-setup)
|
|
74
|
+
- [Async Usage](https://tribulnation.com/typed/hyperliquid/reference/async-usage)
|
|
75
|
+
- [Error Handling](https://tribulnation.com/typed/hyperliquid/reference/error-handling)
|
|
76
|
+
- [Environment Variables](https://tribulnation.com/typed/hyperliquid/reference/env-vars)
|
|
77
|
+
- [Timestamps](https://tribulnation.com/typed/hyperliquid/reference/timestamps)
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "typed-hyperliquid"
|
|
7
|
-
version = "1.2.
|
|
7
|
+
version = "1.2.4"
|
|
8
8
|
authors = [
|
|
9
9
|
{name="Marcel Claramunt", email="marcel@tribulnation.com"}
|
|
10
10
|
]
|
|
@@ -19,6 +19,7 @@ classifiers = [
|
|
|
19
19
|
]
|
|
20
20
|
dependencies = [
|
|
21
21
|
"typed-core>=0.2.0",
|
|
22
|
+
"lazy-loader",
|
|
22
23
|
"eth-account",
|
|
23
24
|
"msgpack"
|
|
24
25
|
]
|
|
@@ -31,4 +32,4 @@ Documentation = "https://hyperliquid.tribulnation.com"
|
|
|
31
32
|
Website = "https://tribulnation.com"
|
|
32
33
|
|
|
33
34
|
[tool.setuptools.package-data]
|
|
34
|
-
hyperliquid = ["py.typed"]
|
|
35
|
+
hyperliquid = ["py.typed", "*.pyi", "**/*.pyi"]
|
|
@@ -3,11 +3,17 @@ import asyncio as _asyncio
|
|
|
3
3
|
from eth_account.account import Account as _Account
|
|
4
4
|
from eth_account.signers.local import LocalAccount
|
|
5
5
|
from typed_core.exceptions import (
|
|
6
|
-
Error,
|
|
7
|
-
|
|
6
|
+
Error,
|
|
7
|
+
NetworkError,
|
|
8
|
+
ValidationError,
|
|
9
|
+
ApiError,
|
|
10
|
+
BadRequest,
|
|
11
|
+
AuthError,
|
|
12
|
+
RateLimited,
|
|
13
|
+
LogicError,
|
|
8
14
|
)
|
|
9
15
|
from typed_core.http import HttpClient
|
|
10
|
-
from .core import
|
|
16
|
+
from .core import ws_url as _resolve_ws_url
|
|
11
17
|
from .core.ws import SocketClient
|
|
12
18
|
from .info import Info
|
|
13
19
|
from .exchange import Exchange
|
|
@@ -15,14 +21,19 @@ from .streams import Streams
|
|
|
15
21
|
|
|
16
22
|
Wallet = LocalAccount | str | bytes | int
|
|
17
23
|
|
|
24
|
+
|
|
18
25
|
def _env_wallet(mainnet: bool = True) -> LocalAccount | None:
|
|
19
26
|
"""Load the network-specific wallet from the environment."""
|
|
20
27
|
import os
|
|
28
|
+
|
|
21
29
|
key = 'HYPERLIQUID_PRIVATE_KEY' if mainnet else 'HYPERLIQUID_TESTNET_PRIVATE_KEY'
|
|
22
30
|
if (pk := os.getenv(key)) is not None:
|
|
23
31
|
return _Account.from_key(pk)
|
|
24
32
|
|
|
25
|
-
|
|
33
|
+
|
|
34
|
+
def _parse_wallet(
|
|
35
|
+
wallet: Wallet | None, *, mainnet: bool = True
|
|
36
|
+
) -> LocalAccount | None:
|
|
26
37
|
"""Parse an explicit wallet or load the network-specific environment wallet."""
|
|
27
38
|
if wallet is None:
|
|
28
39
|
return _env_wallet(mainnet=mainnet)
|
|
@@ -31,9 +42,11 @@ def _parse_wallet(wallet: Wallet | None, *, mainnet: bool = True) -> LocalAccoun
|
|
|
31
42
|
else:
|
|
32
43
|
return _Account.from_key(wallet)
|
|
33
44
|
|
|
45
|
+
|
|
34
46
|
@_dataclass
|
|
35
47
|
class Hyperliquid:
|
|
36
48
|
"""Composite Hyperliquid client for info, streams, and exchange APIs."""
|
|
49
|
+
|
|
37
50
|
info: Info
|
|
38
51
|
streams: Streams
|
|
39
52
|
_exchange: Exchange | None = _field(default=None, repr=False)
|
|
@@ -51,9 +64,14 @@ class Hyperliquid:
|
|
|
51
64
|
|
|
52
65
|
@classmethod
|
|
53
66
|
def http(
|
|
54
|
-
cls,
|
|
55
|
-
|
|
56
|
-
|
|
67
|
+
cls,
|
|
68
|
+
wallet: Wallet | None = None,
|
|
69
|
+
/,
|
|
70
|
+
*,
|
|
71
|
+
mainnet: bool = True,
|
|
72
|
+
validate: bool = True,
|
|
73
|
+
public: bool = False,
|
|
74
|
+
base_url: str | None = None,
|
|
57
75
|
ws_url: str | None = None,
|
|
58
76
|
):
|
|
59
77
|
"""Create a new Hyperliquid client with HTTP transport.
|
|
@@ -81,12 +99,18 @@ class Hyperliquid:
|
|
|
81
99
|
exchange = None
|
|
82
100
|
else:
|
|
83
101
|
exchange = Exchange.http(
|
|
84
|
-
wallet,
|
|
102
|
+
wallet,
|
|
103
|
+
mainnet=mainnet,
|
|
104
|
+
validate=validate,
|
|
105
|
+
http=http,
|
|
85
106
|
base_url=base_url,
|
|
86
107
|
)
|
|
87
108
|
return cls(
|
|
88
109
|
info=Info.http(
|
|
89
|
-
mainnet=mainnet,
|
|
110
|
+
mainnet=mainnet,
|
|
111
|
+
validate=validate,
|
|
112
|
+
http=http,
|
|
113
|
+
base_url=base_url,
|
|
90
114
|
),
|
|
91
115
|
streams=Streams.new(mainnet=mainnet, validate=validate, ws_url=ws_url),
|
|
92
116
|
_exchange=exchange,
|
|
@@ -94,8 +118,13 @@ class Hyperliquid:
|
|
|
94
118
|
|
|
95
119
|
@classmethod
|
|
96
120
|
def ws(
|
|
97
|
-
cls,
|
|
98
|
-
|
|
121
|
+
cls,
|
|
122
|
+
wallet: Wallet | None = None,
|
|
123
|
+
*,
|
|
124
|
+
mainnet: bool = True,
|
|
125
|
+
validate: bool = True,
|
|
126
|
+
public: bool = False,
|
|
127
|
+
ws_url: str | None = None,
|
|
99
128
|
):
|
|
100
129
|
"""Create a new Hyperliquid client with WebSocket transport.
|
|
101
130
|
|
|
@@ -109,8 +138,7 @@ class Hyperliquid:
|
|
|
109
138
|
ws_url: Custom WebSocket URL. If provided, takes precedence over
|
|
110
139
|
`mainnet`.
|
|
111
140
|
"""
|
|
112
|
-
|
|
113
|
-
ws = SocketClient(url=ws_url or f'wss://{domain}/ws')
|
|
141
|
+
ws = SocketClient(url=ws_url or _resolve_ws_url(mainnet))
|
|
114
142
|
wallet = _parse_wallet(wallet, mainnet=mainnet)
|
|
115
143
|
if wallet is None:
|
|
116
144
|
if not public:
|
|
@@ -121,7 +149,10 @@ class Hyperliquid:
|
|
|
121
149
|
exchange = None
|
|
122
150
|
else:
|
|
123
151
|
exchange = Exchange.ws_of(
|
|
124
|
-
wallet,
|
|
152
|
+
wallet,
|
|
153
|
+
ws=ws,
|
|
154
|
+
mainnet=mainnet,
|
|
155
|
+
validate=validate,
|
|
125
156
|
)
|
|
126
157
|
return cls(
|
|
127
158
|
info=Info.ws_of(ws, validate=validate),
|
|
@@ -129,7 +160,6 @@ class Hyperliquid:
|
|
|
129
160
|
_exchange=exchange,
|
|
130
161
|
)
|
|
131
162
|
|
|
132
|
-
|
|
133
163
|
async def __aenter__(self):
|
|
134
164
|
enters = [
|
|
135
165
|
self.info.__aenter__(),
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from .ws import SocketClient
|
|
2
|
+
from .urls import HYPERLIQUID_MAINNET, HYPERLIQUID_TESTNET, http_base_url, ws_url
|
|
3
|
+
from .types import timestamp, Timestamp
|
|
4
|
+
from .exc import (
|
|
5
|
+
Error,
|
|
6
|
+
ApiError,
|
|
7
|
+
AuthError,
|
|
8
|
+
NetworkError,
|
|
9
|
+
RateLimited,
|
|
10
|
+
ValidationError,
|
|
11
|
+
BadRequest,
|
|
12
|
+
LogicError,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
__all__ = [
|
|
16
|
+
'SocketClient',
|
|
17
|
+
'HYPERLIQUID_MAINNET',
|
|
18
|
+
'HYPERLIQUID_TESTNET',
|
|
19
|
+
'http_base_url',
|
|
20
|
+
'ws_url',
|
|
21
|
+
'timestamp',
|
|
22
|
+
'Timestamp',
|
|
23
|
+
'Error',
|
|
24
|
+
'ApiError',
|
|
25
|
+
'AuthError',
|
|
26
|
+
'NetworkError',
|
|
27
|
+
'RateLimited',
|
|
28
|
+
'ValidationError',
|
|
29
|
+
'BadRequest',
|
|
30
|
+
'LogicError',
|
|
31
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"""Base endpoint class for RPC endpoints -- shared by `info` and `exchange`, the two
|
|
2
|
+
surfaces reachable over either HTTP or the shared WebSocket connection, both with the
|
|
3
|
+
same request/reply shape: one JSON payload in, one decoded value out.
|
|
4
|
+
|
|
5
|
+
No `method`/`path` decomposition here: Hyperliquid has exactly one URL per surface
|
|
6
|
+
(`/info`, `/exchange`) and selects the operation via a `type` field inside the payload,
|
|
7
|
+
not the URL. No `authed_request` split either -- `exchange`'s "authentication" is a
|
|
8
|
+
signature embedded in the payload itself (see `exchange/core/auth.py`), built one layer
|
|
9
|
+
above this class, not a header a transport attaches generically.
|
|
10
|
+
|
|
11
|
+
Not frozen, unlike the generic template: every leaf endpoint method (`info.l2_book`,
|
|
12
|
+
`exchange.order`, ...) is its own single-method mixin, and `Info`/`Exchange`/`Streams`
|
|
13
|
+
compose ~20-100 of them via multiple inheritance into one flat, `type`-discriminated
|
|
14
|
+
namespace matching the venue's own flat request shape -- not nested `cached_property`
|
|
15
|
+
subsections. Python's `dataclasses` requires every class in an inheritance chain to
|
|
16
|
+
agree on frozen-ness, so freezing this base would force freezing that entire composed
|
|
17
|
+
chain for no behavioral benefit (nothing here is ever mutated post-construction).
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from typing_extensions import Any, Mapping, Protocol, Self
|
|
21
|
+
from dataclasses import dataclass
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class RpcClient(Protocol):
|
|
25
|
+
"""Structural interface a transport implements to back an `RpcEndpoint`."""
|
|
26
|
+
|
|
27
|
+
async def request(self, payload: Mapping[str, Any]) -> Any:
|
|
28
|
+
"""Send one request payload and return the decoded response value."""
|
|
29
|
+
...
|
|
30
|
+
|
|
31
|
+
async def __aenter__(self) -> Self: ...
|
|
32
|
+
|
|
33
|
+
async def __aexit__(self, exc_type, exc_value, traceback): ...
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass(kw_only=True)
|
|
37
|
+
class RpcEndpoint:
|
|
38
|
+
"""Base class for RPC endpoints."""
|
|
39
|
+
|
|
40
|
+
client: RpcClient
|
|
41
|
+
validate: bool = True
|
|
42
|
+
|
|
43
|
+
async def __aenter__(self) -> Self:
|
|
44
|
+
await self.client.__aenter__()
|
|
45
|
+
return self
|
|
46
|
+
|
|
47
|
+
async def __aexit__(self, exc_type, exc_value, traceback):
|
|
48
|
+
await self.client.__aexit__(exc_type, exc_value, traceback)
|
|
49
|
+
|
|
50
|
+
async def request(self, payload: Mapping[str, Any]) -> Any:
|
|
51
|
+
return await self.client.request(payload)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""Base endpoint class for stream endpoints -- backs `streams`, the venue's only
|
|
2
|
+
channel-subscription surface.
|
|
3
|
+
|
|
4
|
+
No `authed_subscribe`: every Hyperliquid channel, public or user-scoped, subscribes with
|
|
5
|
+
a plain `user` address parameter (see `spec/discovery.md`'s Authentication section) --
|
|
6
|
+
there is no channel that additionally requires a wallet signature to open.
|
|
7
|
+
|
|
8
|
+
Not frozen, for the same reason as `endpoint/rpc.py`: `Streams` composes ~20 single-method
|
|
9
|
+
mixins via multiple inheritance rather than nested `cached_property` children, and
|
|
10
|
+
`dataclasses` requires frozen-ness to agree across that whole chain.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from typing_extensions import Any, Callable, Protocol, Self
|
|
14
|
+
from dataclasses import dataclass
|
|
15
|
+
|
|
16
|
+
from typed_core.util import StreamManager
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class StreamClient(Protocol):
|
|
20
|
+
"""Structural interface a transport implements to back a `StreamEndpoint`.
|
|
21
|
+
|
|
22
|
+
`params` is `Any`, not `Mapping[str, Any]`: the concrete transport (`SocketClient`,
|
|
23
|
+
shared with `info`/`exchange`) subscribes through `typed_core.ws.StreamsRpc`, whose own
|
|
24
|
+
`params` is a specific `TypedDict` rather than an arbitrary mapping -- a `TypedDict`
|
|
25
|
+
accepts a stricter set of values than `Mapping[str, Any]`, so typing this any narrower
|
|
26
|
+
here would make that real implementation fail Protocol conformance.
|
|
27
|
+
"""
|
|
28
|
+
|
|
29
|
+
def subscribe(
|
|
30
|
+
self,
|
|
31
|
+
channel: str,
|
|
32
|
+
params: Any = None,
|
|
33
|
+
*,
|
|
34
|
+
request_channel: str | None = None,
|
|
35
|
+
message_key: Callable[[Any], str] | None = None,
|
|
36
|
+
) -> StreamManager[Any, Any, Any]:
|
|
37
|
+
"""Subscribe to a channel, optionally separating request and message channels.
|
|
38
|
+
|
|
39
|
+
`message_key`: for channels shared across multiple concurrent subscriptions (e.g.
|
|
40
|
+
`l2Book`, tagged identically for every coin), a function deriving the local
|
|
41
|
+
subscription key from an incoming notification.
|
|
42
|
+
"""
|
|
43
|
+
...
|
|
44
|
+
|
|
45
|
+
async def __aenter__(self) -> Self: ...
|
|
46
|
+
|
|
47
|
+
async def __aexit__(self, exc_type, exc_value, traceback): ...
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
@dataclass(kw_only=True)
|
|
51
|
+
class StreamEndpoint:
|
|
52
|
+
"""Base class for stream endpoints."""
|
|
53
|
+
|
|
54
|
+
client: StreamClient
|
|
55
|
+
validate: bool = True
|
|
56
|
+
|
|
57
|
+
async def __aenter__(self) -> Self:
|
|
58
|
+
await self.client.__aenter__()
|
|
59
|
+
return self
|
|
60
|
+
|
|
61
|
+
async def __aexit__(self, exc_type, exc_value, traceback):
|
|
62
|
+
await self.client.__aexit__(exc_type, exc_value, traceback)
|
|
63
|
+
|
|
64
|
+
def subscribe(
|
|
65
|
+
self,
|
|
66
|
+
channel: str,
|
|
67
|
+
params: Any = None,
|
|
68
|
+
*,
|
|
69
|
+
request_channel: str | None = None,
|
|
70
|
+
message_key: Callable[[Any], str] | None = None,
|
|
71
|
+
) -> StreamManager[Any, Any, Any]:
|
|
72
|
+
return self.client.subscribe(
|
|
73
|
+
channel,
|
|
74
|
+
params,
|
|
75
|
+
request_channel=request_channel,
|
|
76
|
+
message_key=message_key,
|
|
77
|
+
)
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from typed_core.exceptions import (
|
|
2
|
+
Error,
|
|
3
|
+
NetworkError,
|
|
4
|
+
ValidationError,
|
|
5
|
+
ApiError,
|
|
6
|
+
BadRequest,
|
|
7
|
+
AuthError,
|
|
8
|
+
RateLimited,
|
|
9
|
+
LogicError,
|
|
10
|
+
)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
'Error',
|
|
15
|
+
'NetworkError',
|
|
16
|
+
'ValidationError',
|
|
17
|
+
'ApiError',
|
|
18
|
+
'BadRequest',
|
|
19
|
+
'AuthError',
|
|
20
|
+
'RateLimited',
|
|
21
|
+
'LogicError',
|
|
22
|
+
]
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""Hyperliquid's wire timestamp: milliseconds since the Unix epoch, UTC. Threaded through
|
|
2
|
+
nonce generation (`timestamp.now()`, used by every signed exchange action) and available
|
|
3
|
+
for response fields that adopt `Timestamp` instead of a bare `int`.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from typing_extensions import Annotated
|
|
7
|
+
from datetime import datetime, timezone
|
|
8
|
+
from pydantic import BeforeValidator
|
|
9
|
+
|
|
10
|
+
from typed_core.times import EpochConverter
|
|
11
|
+
|
|
12
|
+
timestamp = EpochConverter.milliseconds(tz=timezone.utc)
|
|
13
|
+
|
|
14
|
+
Timestamp = Annotated[datetime, BeforeValidator(timestamp.parse)]
|
|
15
|
+
"""A timestamp field, to use directly in a response `TypedDict`'s annotations."""
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Hyperliquid network domains, and the per-transport URL resolution every surface
|
|
2
|
+
shares: `info` and `exchange` (HTTP or the shared WebSocket connection) and `streams`
|
|
3
|
+
(WebSocket only) all key off the same mainnet/testnet domain.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
HYPERLIQUID_MAINNET = 'api.hyperliquid.xyz'
|
|
7
|
+
HYPERLIQUID_TESTNET = 'api.hyperliquid-testnet.xyz'
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def http_base_url(mainnet: bool = True) -> str:
|
|
11
|
+
"""Resolve the HTTP API root shared by `info` and `exchange`."""
|
|
12
|
+
domain = HYPERLIQUID_MAINNET if mainnet else HYPERLIQUID_TESTNET
|
|
13
|
+
return f'https://{domain}'
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def ws_url(mainnet: bool = True) -> str:
|
|
17
|
+
"""Resolve the WebSocket URL shared by `info`, `exchange`, and `streams`."""
|
|
18
|
+
domain = HYPERLIQUID_MAINNET if mainnet else HYPERLIQUID_TESTNET
|
|
19
|
+
return f'wss://{domain}/ws'
|