Construct the client
async with (or await client.aclose()) is mandatory for clean
shutdown — the underlying httpx.AsyncClient and web3.py
WebSocket sessions need explicit teardown to avoid socket leaks
in long-running Hummingbot strategies.
First trade — approve USDC
send.buy / send.sell
proceeds without an extra approve hop.
Power users — explicit lifecycle
Same three-layer model as the TypeScript SDK:| Layer | When you’d use it |
|---|---|
client.trades.send.<action>(...) | Default. Hummingbot, AI agents, dashboards. |
client.trades.prepare_<action>(...) + manual submit | Explicit control of signing — e.g. log + audit before signing. |
client.trades.build_<action>(...) + hash_of(...) | Construct the unsigned tx, hash it, route to a remote signer. |
KashSignerError(STALE_SIGNED_TX))
matches the TS-SDK behaviour. Bypass via
EoaSubmitOptions(skip_staleness_check=True) if intentional.
Run the bundled examples
Theexamples/eoa/ folder ships with three runnable scripts:
What’s next
Smart-account quickstart
ERC-4337 v0.7 with a bundler.
Hummingbot integration
Full strategy walkthrough with cross-venue arbitrage.
Cross-language parity
How this SDK stays byte-equal with the TS SDK.