[!CAUTION] > Early Development (Pre-0.1.0) - API wrappers are not fully tested. Breaking changes may occur. Do not use in production.
A high-frequency trading (HFT) system for Polymarket with built-in API clients and CLI.
The system is designed as a modular, event-driven architecture:
Clients → Ingestors → Dispatcher → Policy Engine → Action Executor
↓
State Manager + Archiver
Supported Clients & APIs - Currently implemented clients and APIs are:
| API | Protocol | Status |
|---|---|---|
| Polymarket Data API | REST | ✅ |
| Polymarket Gamma Markets | REST | ✅ |
| Polymarket CLOB | REST + WebSocket | ✅ |
| Polymarket RTDS | WebSocket | ✅ |
| CoinMarketCap Standard | REST | ✅ |
| CoinGecko Demo | REST | ✅ |
| Alternative.me Crypto | REST | ✅ |
Storage - State Manager and Archiver are implemented using Redis and TimescaleDB.
Policy Engine — Define trading rules via YAML/JSON without code:
policies:
- id: btc_alert
conditions:
field: price
asset: "BTC"
operator: crosses_below
value: 80000
actions:
- type: notification
channel: telegram
template: "BTC below $80K!"Action Executor - supports notifications, orders and audit logging.
See Architecture and Policy Engine for details.
| Document | Description |
|---|---|
| Client Documentation | Usage guide for all API clients |
| CLI Guide | Command-line interface usage |
| CLI Examples | Practical CLI examples |
| Architecture | System design and HFT engine |
| Policy Engine | User-defined policy DSL |
| API Docs | Full API reference |
[dependencies]
polymarket-hft = "0.0.6"use polymarket_hft::client::polymarket::data::Client;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new();
let health = client.health().await?;
println!("API status: {}", health.data);
Ok(())
}cargo run -- data health
cargo run -- gamma get-markets -l 5
cargo run -- clob get-orderbook -m "0x..."Note
- CoinMarketCap: Requires API key from CoinMarketCap Developer Portal. Set
CMC_API_KEYenv var. - CoinGecko: Requires API key from CoinGecko. Set
CG_API_KEYenv var.
See Client Documentation and CLI Guide for details.
- ✅ v0.0.x - API clients (Data, Gamma, CLOB, RTDS) and CLI
- 🚧 v0.1.x - HFT Engine: Dispatcher, State Management, Strategy Engine
- 📋 v1.0.x - Production-ready with validated trading strategies
See Architecture for detailed HFT engine design.
git clone https://github.com/telepair/polymarket-hft.git
cd polymarket-hft
cargo build && cargo test
cargo run -- --helpMIT License - see LICENSE.
Unofficial SDK, not affiliated with Polymarket. Use at your own risk for educational and research purposes.
- Polymarket | API Docs | GitHub | Issues