Skip to content

Introduction

Hydra is an automated trading system designed specifically for crypto price prediction markets on Polymarket. It focuses on high-frequency trading of binary outcomes, such as whether BTC, ETH, or SOL will be above or below a specific price at a certain time.

Built with Bun and TypeScript, the bot provides a robust infrastructure for market discovery, strategy execution, and risk management in the rapidly evolving prediction market landscape.

The core strategy of the bot relies on latency arbitrage between real-time price feeds from Binance and the orderbooks on Polymarket. By leveraging the difference in propagation speeds and orderbook update frequencies, the bot identifies mispriced outcome tokens before the Polymarket orderbook can react to global price movements.

This approach allows the system to capitalize on small price discrepancies that occur when the underlying asset price moves quickly on major centralized exchanges.

  • Smart Market Discovery: Automatically scores and filters available markets based on strike proximity, trading volume, liquidity depth, spread, and calculated edge.
  • Multiple Operating Modes: Supports live trading for production environments, paper trading for strategy validation, and recording/replay functionality for backtesting.
  • Low-Latency Architecture: Optimized for speed using Bun’s high-performance runtime and efficient WebSocket integrations with Binance and Polymarket.
  • Terminal UI Dashboard: Features a comprehensive TUI dashboard for real-time monitoring of trades, market scores, and system health.
  • Recording and Replay: Capability to record live market data for deterministic replay and simulation, ensuring strategies are thoroughly tested against real historical events.
  • Clock Synchronization: Built-in NTP client via HTTP Date headers to ensure millisecond-level accuracy and detect system clock drift.
  • Streaming Telemetry: Real-time performance monitoring via Telegraf/InfluxDB integration, providing time-series data for latency distributions, P&L, and system health.
  • Risk Management: Integrated staleness checks, daily loss limits, and max active market controls to prevent trading on outdated information or exceeding exposure limits.