Skip to main content

hookmind (Python)

Python SDK for the HookMind Protocol — AI-powered dynamic fees and impermanent loss insurance for Uniswap v4 on Unichain.

Install

pip install hookmind

Requires Python ≥ 3.10.

Quick start

import asyncio
from hookmind import Agent

async def main():
    async with Agent(api_key="hm_your_key") as agent:
        # Health check
        pong = await agent.ping()
        print(pong.version, pong.chain_id)

        # Live pool state
        pools = await agent.get_pools()
        fee   = await agent.get_fee(pools[0].pool_id)
        print(f"Current fee: {fee.current_fee} bps → recommended: {fee.recommended_fee} bps")

        # IL Insurance vault
        stats = await agent.get_vault_stats()
        quote = await agent.get_quote("0xYourLPAddress")
        print(f"Premium: {quote.premium} USDC  Max payout: {quote.max_payout} USDC")

asyncio.run(main())

Class reference

Agent

from hookmind import Agent

agent = Agent(
    api_key="hm_your_key",
    api_url="https://hookmind-api.fly.dev",  # optional
    timeout=30.0,                             # optional, seconds
)
# Use as async context manager (recommended) or call await agent.close() manually

Signals

signals = await agent.get_signals(limit=20)
signal  = await agent.submit_signal(
    signal={
        "poolId": "0xb60e6d...",
        "fee": 500,
        "volatilityScore": 4500,
        "nonce": 1,
        "chainId": 1301,
    },
    private_key_hex="0x_your_key",
)

Pools & fees

pools = await agent.get_pools()
pool  = await agent.get_pool("0xb60e6d...")
fee   = await agent.get_fee("0xb60e6d...")
sim   = await agent.simulate_fee(SimulateParams(base_fee=300, sigma2=5000, sigma2_max=10000))

IL Insurance vault

stats = await agent.get_vault_stats()
quote = await agent.get_quote("0xLP...", tick_lower=-887272, tick_upper=887272)

Operators

operators = await agent.get_operators()
operator  = await agent.get_operator("0xAddress")
await agent.register_operator("0x_ecdsa_public_key")

Real-time WebSocket stream

async for event in agent.listen():
    print(event["type"], event["data"])

Types

from hookmind import (
    Signal, PoolData, FeeRecommendation,
    SimulateParams, SimulationResult,
    VaultStats, ILQuote,
    Operator, ApiKey, PingResult,
    HookMindError,
)

Error handling

from hookmind import HookMindError

try:
    pool = await agent.get_pool("0xbad...")
except HookMindError as e:
    print(e.code, e.status, str(e))

Links

License

MIT © 2026 HookMind Protocol Contributors

Release files for hookmind 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hookmind 0.1.2
File Size Uploaded
hookmind-0.1.2.tar.gz 9.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for hookmind 0.1.2
File Interpreter ABI Platform
hookmind-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 19.1 kB

Release files / hookmind-0.1.2.tar.gz

Download URL hookmind-0.1.2.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bfa51ef7502686b0e15c40edb19e94484cd98685360b23e1bcf9e64b1008a9fc
BLAKE2b-256 checksum
How to use checksums
bc8b0579bba26a1886c498cbff5ceae88c776505c271594bdbfcf2af2047bc36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / hookmind-0.1.2-py3-none-any.whl

Download URL hookmind-0.1.2-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5a255b861e12a6f06e9690a6d8f5b6d51539442818824a3b6b0940b170f15da1
BLAKE2b-256 checksum
How to use checksums
64e633cf9480c7acbd528198f1b90746f3c20d9211b83230f9efe7f2452ffd35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page