| Crates.io | polymarket-hft |
| lib.rs | polymarket-hft |
| version | 0.0.7 |
| created_at | 2025-12-05 07:21:48.886944+00 |
| updated_at | 2025-12-19 11:36:24.845311+00 |
| description | A high-frequency trading system for Polymarket with built-in API clients (Data API, CLOB, CLOB WebSocket, Gamma, RTDS) and CLI |
| homepage | |
| repository | https://github.com/telepair/polymarket-hft |
| max_upload_size | |
| id | 1967816 |
| size | 857,413 |
[!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.
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 -- --help
MIT License - see LICENSE.
Unofficial SDK, not affiliated with Polymarket. Use at your own risk for educational and research purposes.