Installation
Requires Python 3.10+.Set your API key
Get your key at api.mathematicalcompany.com, then:Add this to your shell profile (
~/.zshrc or ~/.bashrc) so it persists.Your First Strategy
Create a filemy_strategy.py:
Ctrl+C to stop. All open orders are canceled automatically on shutdown.
What Just Happened?
hz.run()created a paper exchange engine with risk limits- A SQLite database was opened at
./my_strategy.dbfor persistence - The main loop started, running your pipeline every 1 second:
fair_valuereturned0.50quoterreceived0.50and generated quotes at bid=0.47 / ask=0.53- The engine canceled stale orders, submitted new quotes, and ticked the paper exchange
- On
Ctrl+C, positions were snapshotted and all orders canceled
Next Steps
Core Concepts
Understand hz.run(), pipelines, and the context object.
Exchanges
Connect to Polymarket, Kalshi, Alpaca, IBKR, Coinbase, Robinhood, or trade on paper.
Examples
See full strategy examples with live feeds.
Multi-Exchange
Trade on multiple exchanges simultaneously.