Skip to main content
All posts

Kwery for Agents

JaegerJaeger6 min read
Kwery for Agents

Kwery for Agents: A Unified Data Stack for Prediction Markets and Crypto Derivatives

Prediction markets and crypto derivatives are some of the most information-dense environments in finance. Polymarket and Kalshi price the probability of real-world events in real time. Hyperliquid and Binance expose funding rates, open interest, and liquidation flows that institutional traders watch obsessively. Chainlink bridges all of it to on-chain oracle prices.

The problem is access. Each venue has its own API, its own quirks, its own parameter naming conventions. Polymarket prices are decimals. Kalshi prices are cents. Hyperliquid's candle endpoint takes start_time. Binance's takes start. No normalization. No consistency. No shared interface.

Kwery fixes that — and today we're making it available to agents.


One API. Five Platforms. Every Data Type.

Kwery normalizes data from Polymarket, Kalshi, Hyperliquid, Binance, and Chainlink behind a single authenticated API. Candles, trades, order books, snapshots, funding rates, open interest, liquidations — every data type, every supported venue, same interface.

We've built four layers on top of that API specifically for agents:

  • Kwery MCP Server — 33 structured tool calls that expose every endpoint to any MCP-compatible agent.

  • Kwery Skills — six expert instruction sets that teach agents how to use those tools correctly, covering backtesting, signal construction, derivatives analysis, orderbook analysis, cross-platform comparison, and prediction market research.

  • Kwery Claude Code Plugin — a single install that bundles the MCP server and all six skills together.

  • Kwery CLI — 40+ commands for shell scripts, CI/CD pipelines, and any environment where MCP isn't the right fit.


MCP Server

The MCP Server is what agents actually call. Thirty-three tools, each one mapping directly to a Kwery API endpoint with validated inputs and typed outputs.

No shell. No curl. No regex-parsing a JSON blob to find the right field. An agent that wants Hyperliquid's BTC-PERP funding rate for the last 48 8-hour periods calls hyperliquid_funding with { symbol: "BTC", limit: 48 } and gets back structured data — the correct endpoint, the correct params, already normalized.

The tools break down by category:

Category Tools
Account & status kwery_limits, kwery_status, kwery_sources
Market discovery kwery_markets, kwery_market, polymarket_markets, polymarket_market, kalshi_markets
Candles & OHLCV polymarket_candles, hyperliquid_candles, binance_candles, chainlink_candles
Trades polymarket_trades, hyperliquid_trades
Order books polymarket_orderbook, kalshi_orderbook
Snapshots polymarket_snapshots, polymarket_snapshot_at, kalshi_snapshots, kalshi_snapshot_at, hyperliquid_snapshots, hyperliquid_snapshot_at
Derivatives hyperliquid_funding, hyperliquid_oi, binance_funding, binance_oi, binance_liquidations, binance_flow
Spot & reference binance_ticker, binance_spot_markets, binance_futures_markets, kalshi_prices

Add it to any MCP client in one line:

claude mcp add kwery npx kwery-mcp@latest

Or in a JSON config:

{
  "mcpServers": {
    "kwery": {
      "command": "npx",
      "args": ["kwery-mcp@latest"]
    }
  }
}

Set KWERY_API_KEY and you're live. Get your key at kwery.xyz/dashboard.


Skills

Having 33 tools available isn't the same as knowing how to use them. An agent that calls polymarket_candles without a token_id gets back duplicate rows — one for the Yes leg, one for the No leg — for every market that matches the symbol. A backtest built on that data is silently wrong from row one. An agent comparing Polymarket and Kalshi probabilities without normalizing Kalshi's cent-denominated prices to decimals will see a constant ~50x divergence that doesn't exist.

Skills are how we prevent that. Each skill is a pre-loaded instruction set that gives the agent domain expertise — routing logic, normalization rules, known pitfalls, and the right tool combinations for a given task.

Backtest handles point-in-time accurate strategy testing on prediction markets. It enforces token_id requirements, reconstructs historical market state from snapshot data, and produces look-ahead-clean P&L series.

Signal is for cross-platform signal construction. It combines Polymarket and Kalshi probability curves with Hyperliquid and Binance funding rate and OI data, normalized to the same scale, to surface divergences and crowding setups.

Derivatives focuses on perpetuals. Funding carry analysis, open interest vs price divergence, liquidation cascade pattern detection — across both Hyperliquid and Binance in the same query.

Research is for historical analysis. Resolution accuracy studies, event-driven price behavior, Polymarket vs Kalshi consensus comparisons — all from historical data, no live account required.

Orderbook covers liquidity depth on Polymarket and Kalshi. Slippage estimation, spread trends, bid/ask imbalance over time — useful before sizing into a position.

Cross-Platform is the broadest skill. It pulls candles, trades, order book state, and market listings across all five platforms simultaneously and surfaces divergences, arbitrage signals, and cross-venue confirmation patterns.

Each skill ships with system prompt variants for the Claude API, OpenAI API, Cursor Rules, and ChatGPT. Install standalone:

git clone https://github.com/KweryAPI/core-ai.git
cd core-ai/kwery-skills

./backtest/install.sh      # → ~/.claude/skills/backtest/
./signal/install.sh        # → ~/.claude/skills/signal/
./derivatives/install.sh   # → ~/.claude/skills/derivatives/
./research/install.sh      # → ~/.claude/skills/research/

Claude Code Plugin

The plugin is the fastest path. It bundles the MCP server and all six skills — one install, no configuration.

Once published to the Claude Code marketplace:

/plugin install kwery

Six slash commands become available immediately:

Command Activates
/kwery:backtest Prediction market backtesting skill
/kwery:signal Cross-platform signal construction
/kwery:derivatives Funding, OI, and liquidation research
/kwery:research Historical prediction market analysis
/kwery:orderbook Liquidity and depth analysis
/kwery:cross-platform Multi-venue divergence detection

A prompt like "Pull the last 30 days of BTC-PERP funding from Hyperliquid and Binance, flag any sessions where both venues exceeded 0.1%, and cross-reference those timestamps against the Polymarket BTC price consensus" gets routed to the right tools, normalized across venues, and returned as a clean dataset — no intermediate prompting, no tool selection by hand.


CLI

The CLI is for everything outside the agent loop. Forty-plus commands across all five platforms, organized into intuitive namespaces.

npm install -g kwery-cli
kwery login

kwery polymarket candles BTC --interval 1h --limit 200
kwery kalshi prices BTCX-PRICE-1K --limit 100
kwery hyperliquid funding BTC --limit 48
kwery binance oi ETH --limit 96
kwery binance liquidations BTC --start 2025-01-01 --end 2025-03-01
kwery binance spot-markets
kwery binance futures-markets

Every command accepts --format json for pipeline use. Useful for cron jobs, data ingestion scripts, or any workflow where spinning up an MCP client isn't practical.


Tiers

Tier Historical Window Cost
Free 7 days
Pro 14 days $29
Business 31 days $79

Tier gate errors surface cleanly through both the MCP and CLI with an upgrade link rather than a raw 403.


Get Started

Start at kwery.xyz/dashboard for your API key, or browse the full source at github.com/KweryAPI/core-ai.