polymarket-hft

Crates.iopolymarket-hft
lib.rspolymarket-hft
version0.0.7
created_at2025-12-05 07:21:48.886944+00
updated_at2025-12-19 11:36:24.845311+00
descriptionA high-frequency trading system for Polymarket with built-in API clients (Data API, CLOB, CLOB WebSocket, Gamma, RTDS) and CLI
homepage
repositoryhttps://github.com/telepair/polymarket-hft
max_upload_size
id1967816
size857,413
Liys (liysx)

documentation

README

polymarket-hft

Crates.io Documentation License: MIT

[!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.

Architecture Overview

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.

Documentation

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

Quick Start

As a Library

[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(())
}

As a CLI

cargo run -- data health
cargo run -- gamma get-markets -l 5
cargo run -- clob get-orderbook -m "0x..."

[!NOTE]

See Client Documentation and CLI Guide for details.

Roadmap

  • 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.

Contributing

git clone https://github.com/telepair/polymarket-hft.git
cd polymarket-hft
cargo build && cargo test
cargo run -- --help

License

MIT License - see LICENSE.

Disclaimer

Unofficial SDK, not affiliated with Polymarket. Use at your own risk for educational and research purposes.

Links

Commit count: 0

cargo fmt