ScriptStrategyBase subclass and drive trades through it on every
tick. Kash never sees a private key; the strategy holds the signer.
Architectural shape
Reference strategy
The package shipsexamples/hummingbot/amm_arb_kash_uniswap.py — a working
ScriptStrategyBase that demonstrates the canonical SDK
integration pattern. Skeleton runs against Base Sepolia in EOA
mode; the Uniswap leg + sizing model are stubbed for you to wire to
your real venue.
examples/hummingbot/amm_arb_kash_uniswap.py
on the public mirror.
Running the strategy in Hummingbot
Resource requirements
Per active strategy:| Resource | Footprint |
|---|---|
| RAM | ~20 MB resident for the SDK + httpx pool + web3.py + the WS subscription if used |
| Sockets | 1 HTTP keep-alive pool to the chain RPC; 1 WSS connection per markets.watch |
| Concurrency | All async; no thread pools (unless your signer’s CPU-bound — then LocalSigner runs sign in run_in_executor) |
| Network egress | One eth_call per tick (quote) + one eth_sendRawTransaction per executed trade |
Latency profile
| Stage | p50 | p99 |
|---|---|---|
markets.quote(...) → return | 30 ms | 250 ms |
trades.build_buy(...) → return | <1 ms | 5 ms |
trades.prepare_buy(...) → return | 50 ms | 400 ms |
trades.signer.sign_transaction(...) | <1 ms | 5 ms |
trades.submit(...) → tx hash | 100 ms | 800 ms |
| Mempool inclusion (chain-side) | 2 s | 10 s |
Observability
Every public method accepts an optionalsignal: asyncio.Event for
cancellation. Long-running strategies should propagate Hummingbot’s
shutdown signal into every SDK call so a ctrl-c cleanly aborts
in-flight ops.
Lifecycle hooks (KashProtocolHooks) are five fire-and-forget
callbacks for telemetry / structured logging:
on_request_start(name, attempt)on_request_finish(name, durationMs, status)on_simulate_revert(name, decoded)on_signer_call(adapter)on_bundler_call(method, durationMs, status)
Cancellation + clean shutdown
Always close the client. Hummingbot’son_stop is the hook:
async with form does this for you in standalone scripts.
Troubleshooting
KashSimulationRevertedError(SLIPPAGE_EXCEEDED)— yourmax_slippage_bpswas tighter than the market could meet. The pre-flighteth_callcaught the revert before you paid for any signing-infra round-trips.KashSignerError(STALE_SIGNED_TX)— you signed a tx and then mutated its gas/fees/nonce before submit. The submit-side staleness guard recovered the signing address from the bytes, saw a mismatch, and refused to broadcast.KashChainError(RPC_UNHEALTHY)— your RPC is down or rate-limiting. Retryable; back off and retry.
See also
EOA quickstart
The EOA-mode Python integration the strategy above uses.
Smart-account mode
For AA-stack Python integrations.
Cross-language parity
Same encoding bytes as the TypeScript SDK.