Gabagool logoArbigab
> The Bot> How It Works> Doc> Contact
Get the bot

$ cat ./how-it-works

A technical breakdown of how gabagool22 and distinct-baguette trades Polymarket crypto UP/DOWN bucket markets. Three automated strategies running 24/7 across BTC, ETH, SOL, and XRP.

$ cat ./bucket-markets
Polymarket's crypto UP/DOWN markets are binary contracts that resolve based on whether an asset's price is above or below a strike price at expiry. Each market has two tokens:
UP Token
Pays $1.00 if the asset closes above the strike. Otherwise $0.
DOWN Token
Pays $1.00 if the asset closes below the strike. Otherwise $0.
New markets open every 5 minutes, 15 minutes, and 1 hour across four assets. Because UP + DOWN must resolve to exactly $1.00, any pricing that sums to less creates a risk-free arbitrage opportunity. Any pricing that deviates from fair value creates a directional opportunity.
BTCETHSOLXRP5m / 15m / 1h windows
$ cat ./strategies
Momentum Trading
The momentum strategy exploits the latency between Binance spot prices and Polymarket contract pricing. When BTC moves sharply on Binance, Polymarket's UP/DOWN tokens take seconds to reprice. The bot detects the move via a real-time Binance aggTrade WebSocket feed and enters a Polymarket position before the market adjusts.
Signal detection uses a configurable lookback window and minimum delta threshold. When the price move exceeds the threshold, the bot fires an order on the corresponding UP or DOWN token.
4 execution modes: single_taker (FOK at ask — default), gtc_at_ask (GTC limit at ask, rests if no fill), single_maker (GTC at bid for maker fees), dual_hybrid (taker on signal side + maker on contra side simultaneously). Each mode trades off fill probability against execution cost. See the parameter tuning guide for details.
Market Making
Two-sided quoting on both UP and DOWN tokens. The bot posts resting limit orders on both sides of the spread and profits from the bid-ask gap. The key edge is Binance preemptive cancel: the bot monitors the real-time Binance price feed and cancels resting orders before an adverse price move results in a toxic fill.
When the Binance feed signals a sharp BTC move, the bot cancels its exposed side (e.g., cancels resting UP bids if BTC is about to dump) in sub-second, then re-quotes once the move settles. This dramatically reduces adverse selection — the #1 killer of market-making strategies.
Automatic position rebalancing and on-chain merging via ProxyWallet Factory. When the bot accumulates both UP and DOWN tokens, it merges them on-chain to recover USDC and free up capital.
Spread Capture (Arbitrage)
The spread capture strategy exploits a fundamental constraint: UP + DOWN tokens must resolve to exactly $1.00. When the combined bid prices sum to less than $1.00 (e.g., UP bid at $0.48 + DOWN bid at $0.49 = $0.97), the bot buys both sides at the bid for a guaranteed $0.03 profit at resolution, regardless of which direction the asset moves.
This is a risk-neutral strategy — the bot profits at resolution no matter the outcome. Each instance monitors one asset/window combination, checking every tick whether the combined price falls below the spread threshold. Run multiple instances to cover all markets.
$ cat ./architecture
The bot is a single Rust binary that runs as a systemd service on a Linux VPS. Event-driven architecture — the evaluation loop wakes on each Binance aggTrade, not on a fixed timer.
Binance WebSocket (aggTrade)
  │
  ├─→ Signal Engine (lookback, delta threshold)
  │     │
  │     ├─→ Momentum Strategy ───→ Polymarket CLOB
  │     ├─→ Market Making ───────→ Polymarket CLOB
  │     └─→ Spread Capture ──────→ Polymarket CLOB
  │
  └─→ Preemptive Cancel (adverse move detection)
        └─→ Cancel resting orders before toxic fill
Each asset (BTC, ETH, SOL, XRP) gets its own Binance feed and strategy instances
Vendored Polymarket SDK — full CLOB API integration, no external dependencies
GTC and FOK order types with configurable execution modes per strategy
On-chain merge via ProxyWallet Factory — recovers capital from matched UP/DOWN positions
$ cat ./differentiators
Arbitrage trading algo~44K lines of Rust. Not a hosted service, not an API wrapper. You own it, deploy it...
6.8 GB Historical Data11,201 market files across BTC, ETH, SOL, XRP at 100ms resolution with embedded Binance klines.
Parallel Backtester3 fill models (deterministic, probabilistic, latency). Tests thousands of markets in minutes.
Pre-Tuned Configs10 ready-to-trade configurations for every asset and time window combination.
Real-Time Dashboarddashboard showing live positions, P&L, order flow, and momentum signals.
Production Battle-Testedthe same codebase running on the developer's own VPS with $500K+ in verified profit.

$ cat ./deep-dives

Technical details behind each component. Click to expand.

Full strategy docs, deployment guides, and parameter tuningRead the docs →