npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

polly-gamba

v1.0.10

Published

Coinbase price signal → Claude brain → Polymarket CLOB execution

Readme

polly-gamba

Signal propagation arbitrage: Coinbase price move → Polymarket bet, before the humans do.

┌─────────────────┐    signal    ┌───────────────────┐    match    ┌──────────────────┐
│  Coinbase WS    │ ──────────→  │   Signal Router   │ ─────────→  │  Polymarket CLOB │
│  BTC/ETH ticker │              │   (Claude brain)  │             │  Order execution │
└─────────────────┘              └───────────────────┘             └──────────────────┘
       ↑                                  ↑                                 ↑
  0.5% move in                    keyword + heuristic              dry-run by default
    60s window                    market matching                  (set API key for live)

Why this works

Human reaction time from seeing a BTC pump on Coinbase to placing a Polymarket bet: 5–30 minutes.

That's the edge. We don't front-run algos — we front-run people. Crypto price signal → find correlated prediction markets → place before the crowd arrives.

News doesn't matter. Price signal does.

Architecture

| Component | File | Purpose | |---|---|---| | Coinbase WS | src/signals/coinbase-ws.ts | Real-time BTC/ETH ticker, threshold detection | | Gamma API | src/markets/gamma.ts | Fetch active Polymarket markets, 10-min cache | | CLOB API | src/markets/clob.ts | Orderbook reads, price queries, order placement | | MCP Server | src/mcp/server.ts | Polymarket tools for Claude Code integration | | Main loop | src/index.ts | Orchestration, latency tracking, dry-run |

Quick start

npm install

# Run the signal → match → execute pipeline (dry-run mode)
npx ts-node src/index.ts

# Run as MCP server (for Claude Code)
npx ts-node src/mcp/server.ts

# Run smoke tests
npm test

Signal detection

coinbase-ws.ts connects to Coinbase Advanced Trade WebSocket (no auth required):

  • Subscribes to ticker channel for BTC-USD and ETH-USD
  • Maintains a 60-second rolling price window
  • Fires a PriceSignal when price moves ≥ 0.5% within the window
interface PriceSignal {
  asset: 'BTC' | 'ETH'
  direction: 'up' | 'down'
  pct_change: number    // e.g. 0.0213 for +2.13%
  price: number         // current USD price
  window_secs: number   // actual window duration
  signal_ts: number     // Date.now() at detection
}

Market matching

On signal, the system:

  1. Fetches active Polymarket markets (Gamma API, cached 10 min)
  2. Filters for volume > $10k, liquidity > $1k
  3. Keyword-matches market questions against the signal asset
  4. Logs matched markets + latency breakdown

MCP Tools (Claude integration)

Add to ~/.claude/claude_desktop_config.json:

{
  "mcpServers": {
    "polymarket": {
      "command": "npx",
      "args": ["ts-node", "/path/to/polly-gamba/src/mcp/server.ts"]
    }
  }
}

Available tools:

  • list_markets — fetch active markets with optional keyword filter
  • get_orderbook — CLOB orderbook for a token
  • get_market_price — buy/sell price (0–1 = probability)
  • assess_signal — find markets affected by a price signal
  • place_order — place order (dry-run default)

Latency tracking

Every signal logs:

signal_ts      → when the price move was detected
match_ts       → when market matching completed
execute_ts     → when dry-run/order was logged

Target: signal → execute in < 500ms.

Config

| Env var | Required | Description | |---|---|---| | POLYMARKET_API_KEY | No (for now) | CLOB API key for live order placement |

Dry-run mode

All order placement is dry-run by default — logs WOULD PLACE ORDER: ... without touching the CLOB. Set dry_run: false and POLYMARKET_API_KEY for live execution.

Next steps

  1. CLOB auth — implement EIP-712 L1 + L2 API key header signing
  2. Position sizing — Kelly criterion on signal strength × market liquidity
  3. Redis signal bus — decouple signal detection from execution
  4. Backtesting — replay historical Coinbase ticks against historical Polymarket prices
  5. Claude reasoning — pipe signals through Claude for semantic market scoring

Build

npm run build   # tsc → dist/
npm test        # smoke tests (live API, read-only)