Pro Feature. Requires a Pro or Ultra subscription. Get started at api.mathematicalcompany.com
Copy-Trading
Horizon’s copy-trading module monitors Polymarket wallets and automatically mirrors their trades through the Engine. It supports size scaling, position limits per market, deduplication, and an inverse mode for fading whale activity.Copy-trading uses Polymarket’s public Data API (
hz.get_wallet_trades()) to poll for new trades, then submits mirrored orders through the Horizon Engine with full risk pipeline protection. No access to the source wallet’s private key is needed.When to Use What
| Goal | Function | Page |
|---|---|---|
| Mirror a known wallet | copy_trades() / copy_trader() | This page |
| Auto-fade a bad wallet | copy_trades(inverse=True) | This page |
| Score first, then auto-execute | hunt() | Wallet Profiler |
| Discover + auto-copy whales | galaxy_hunt() | Whale Galaxy |
| Score or analyze a wallet first | score_wallet() / analyze_wallet() | Wallet Intelligence |
Overview
Standalone Mode
hz.copy_trades() runs a blocking poll loop - the simplest way to start.Pipeline Mode
hz.copy_trader() returns a pipeline function for use inside hz.run().Inverse (Fade) Mode
Flip buy/sell to fade the whale’s trades instead of copying them.
Dedup + Watermarks
FIFO bounded dedup (10k capacity) with per-wallet timestamp watermarks prevents replaying history.
Standalone Mode: hz.copy_trades
The simplest entry point. Creates an Engine, seeds dedup state, and runs a blocking poll loop.| Parameter | Type | Default | Description |
|---|---|---|---|
wallet | str or list[str] | required | Wallet address(es) to copy |
wallets | list[str] | None | Alternative to wallet for multiple addresses |
size_scale | float | 1.0 | Multiplier for trade size (0.5 = half size) |
max_position | float | 1000.0 | Max USDC exposure per market |
min_trade_usdc | float | 1.0 | Ignore trades smaller than this |
poll_interval | float | 30.0 | Seconds between polls |
exchange | str | "paper" | Exchange backend ("paper" or "polymarket") |
inverse | bool | False | Fade the whale (flip buy/sell) |
max_slippage | float | 0.02 | Max price deviation from source |
dry_run | bool | False | Log trades without submitting orders |
risk | Risk or RiskConfig | None | Risk configuration for the engine |
api_key | str | None | Horizon API key |
- Creates an Engine with the specified exchange backend
- Seeds dedup state from the last 100 trades per wallet (prevents replaying history)
- Polls
get_wallet_trades()each cycle for new trades - Filters by min size, valid price, and timestamp watermark
- Applies size scaling and position limit clamping
- Submits
OrderRequestthrough the Engine (with full risk pipeline) - Handles SIGINT/SIGTERM for graceful shutdown
Pipeline Mode: hz.copy_trader
For use insidehz.run() alongside other pipeline functions.
| Parameter | Type | Default | Description |
|---|---|---|---|
wallet | str or list[str] | required | Wallet address(es) to copy |
wallets | list[str] | None | Alternative to wallet |
size_scale | float | 1.0 | Size multiplier |
max_position | float | 1000.0 | Max USDC per market |
min_trade_usdc | float | 1.0 | Min trade size |
inverse | bool | False | Fade mode |
max_slippage | float | 0.02 | Max slippage |
dry_run | bool | False | Dry run mode |
- Uses
ctx.params["engine"]for direct order submission (same pattern asarb_scanner) - Seeds dedup on first call only
- Stores results in
ctx.params["copy_trade_results"] - Returns
None(bypasses the quote mechanism - orders are submitted directly)
Side Mapping
Copy-trading maps source trades to orders as follows:| Source Side | Source Outcome | → Side | → OrderSide |
|---|---|---|---|
| BUY | Yes | Yes | Buy |
| BUY | No | No | Buy |
| SELL | Yes | Yes | Sell |
| SELL | No | No | Sell |
OrderSide only (Buy ↔ Sell). The Side (Yes/No) stays the same. This means inverse mode buys when the whale sells, and sells when the whale buys - fading their directional conviction.
Size Calculation
Orders are sized as follows:scaled_usdc is clamped to the remaining position limit:
- Buy:
min(0.99, source_price + max_slippage) - Sell:
max(0.01, source_price - max_slippage)
Dedup Strategy
Copy-trading uses a FIFO bounded dedup set (same pattern as Polymarket/Kalshi fill dedup in the Rust core):- Primary key:
tx_hash(falls back towallet:condition_id:timestamp:sizecomposite) - Capacity: 10,000 entries with FIFO eviction
- Seeding: On startup, the last 100 trades per wallet are marked as seen
- Watermark: Per-wallet timestamp - only trades newer than the last seen are processed