Skip to main content
Glama
arbitrage-anyprice
by pjrpjr

Arbitrage-AnyPrice

Cross-Market Real-Time Pricing Inefficiency, GPU-vs-LLM Token Compute Arbitrage & Prediction-Market Resolution-Rule Firewall Terminal.

CI License: MIT

Strictly Zero-Custody & Read-Only Posture (MM-04): Pure read-only quantitative market-data analytics, resolution-rule equivalence auditing, and signed JSON/MCP/x402 feeds. $0 client capital custodied, zero automated trading on restricted venues, and zero individualized investment advice.


Why Arbitrage-AnyPrice Exists

Retail arbitrage scanners fail in production because they compare top-of-book midpoints across Polymarket and Kalshi without auditing settlement clauses, ignore Kalshi quadratic fees and FRED risk-free capital lockup carry, or claim "90% GPU compute savings" using VRAM-OOM or 100%-utilization fantasies.

Arbitrage-AnyPrice unifies three live public pricing arenas inside one deterministic, cryptographically hash-chained SQLite WAL terminal:

  1. Prediction & Event Markets (>= 2,300 live contracts) — Polymarket Gamma + sorted CLOB L2 books (feesEnabled modeled), Kalshi Trade API v2 non-MVE series & orderbook_fp L2 books, plus Manifold (MANA_PLAY) and Metaculus (POINTS_PLAY) strictly quarantined as non-cash calibration feeds.

  2. AI Compute & Token Markets (468 OpenRouter LLMs + 500+ live GPU offers) — Vast.ai spot GPU slices, stock-verified RunPod GraphQL, and Azure Retail Prices On-Demand baselines compared against open-weight OpenRouter per-1M-token pricing under hard VRAM physics (weights + 25% KV cache + >=2.5 GB/GPU CUDA/NCCL), <= 70% realistic utilization ceiling, 3:1 input:output token mix, 1 / reliability preemption haircut, and sublinear PCIe vs NVLink tensor-parallel scaling.

  3. FX, Macro Carry & Digital-Asset Valuation — Frankfurter ECB FX rates, live FRED DFF / NY Fed EFFR risk-free carry (3.89%), CoinGecko/Kraken/Coinbase executable bid/ask spot quotes, and ICANN RDAP domain expiry metadata.


Related MCP server: hyperliquid-info

Core Anti-Phantom Architecture

  • Fail-Closed Resolution-Rule Equivalence Firewall: Blocks divergent oracles (e.g., Binance BTC/USDT vs CF Benchmarks BRTI), asymmetric macro definitions (e.g., BEA-only vs BEA-or-NBER recession), UTC cutoff/timezone gaps (> 15 min), boundary mismatches (> vs >=, intraday touch vs close), one-sided 50-50 void clauses, subjective UMA vs statutory agency rules, inverted polarity/negation traps, play-money conflation, and non-exhaustive Dutch-books.

  • Depth-Weighted Marginal Book Walk & FRED Carry Gate: Walks sorted opposing orderbooks level-by-level, stops strictly before negative-EV marginal L2 depth, caps executable size at min(depth_A, depth_B), deducts exact Kalshi quadratic ceil_cents(0.07 * N * p * (1 - p)) + Polymarket active taker fees + compound FRED DFF / EFFR lockup carry (days_to_expiry + 2d settlement lag), and rejects NaN/inf inputs fail-closed.

  • Deep Row-Level SHA-256 SQLite WAL Ledger: Every polling cycle chains prev_sha256 -> snapshot_sha256 across all persisted tables; verify_hash_chain() recomputes every run's canonical content digest directly from stored SQLite rows to detect silent row tampering.


Quickstart

uv venv --python 3.12 .venv
uv pip install --python .venv/bin/python -e ".[dev]"

# 1. Run full test suite (64+ deterministic core + hostile red-team tests, 0 warnings)
.venv/bin/pytest -v -W error

# 2. Run a live multi-venue ingestion cycle into data/ledger.sqlite3
.venv/bin/python scripts/run_collector.py --once

# 3. Launch the read-only FastAPI terminal + MCP HTTP + x402 API
.venv/bin/python scripts/run_server.py --host 127.0.0.1 --port 8787

Independent Verification (Zero Dependencies)

Any independent quant or AI-infrastructure engineer can audit the exported report, SHA-256 manifest checksums, deep SQLite hash chain, and zero-phantom invariants using Python stdlib only:

python3 scripts/verify_report.py
# Or verify published report checksums without the local SQLite database:
python3 scripts/verify_report.py --manifest-only

MCP Server (Stdio & HTTP JSON-RPC 2.0)

Expose 6 strictly read-only quantitative tools to Claude Desktop, Cursor, or autonomous compute routers:

  • get_verified_spreads

  • get_quarantined_traps

  • get_backtest_summary

  • audit_resolution_equivalence

  • calculate_gpu_vs_api_arbitrage

  • verify_ledger_integrity

Stdio MCP client config:

{
  "mcpServers": {
    "arbitrage-anyprice": {
      "command": "arbitrage-anyprice-mcp",
      "args": ["--db", "data/ledger.sqlite3"]
    }
  }
}

HTTP MCP endpoint: POST /mcp (JSON-RPC 2.0 initialize, tools/list, tools/call).


x402 Base Mainnet USDC & Creem Subscription API

  • x402 Pay-Per-Query ($0.01 USDC on Base): GET /api/v1/x402/spreads and GET /api/v1/x402/backtest return an x402Version: 1 HTTP 402 manifest when unauthenticated, and verify real Base mainnet eth_getTransactionReceipt USDC Transfer logs (0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913, status=0x1, exact X402_PAY_TO_ADDRESS, >= 10000 units) with atomic SQLite replay protection.

  • Subscription Plans (GET /api/v1/billing/plans) (strictly zero-custody read-only analytics via Creem):

    • Starter / Independent ($99/mo): Subscribe via Creem

    • Pro Quant API & Backtester ($299/mo): Subscribe via Creem

    • Institutional Terminal Seat ($995/mo): Subscribe via Creem

    • Automated fulfillment webhook (POST /api/v1/billing/creem/webhook) enforces constant-time HMAC-SHA256 verification and fails closed (HTTP 503) when CREEM_API_KEY / CREEM_WEBHOOK_SECRET are unset.


License

MIT License — see LICENSE.

Available Tools

6 tools
audit_resolution_equivalenceC

Run the Gen-2 Fail-Closed Resolution-Rule Equivalence Firewall on two user-supplied prediction contract specifications.

Inputs: market_a (required), market_b (required), max_cutoff_delta_hours.

calculate_gpu_vs_api_arbitrageB

Run deterministic Gen-2 GPU spot vs LLM token API arbitrage math with hard VRAM physics, utilization ceiling, reliability haircut, and 3:1 prompt:completion mix.

Inputs: gpu (required), model (required), utilization, quantization, +1 more.

get_backtest_summaryC

Return historical snapshot decay, spread half-life, fill persistence, and deep SHA-256 chain verification summary.

Inputs: arena.

get_quarantined_trapsB

List phantom arbitrage traps blocked by the Resolution-Rule Firewall, slippage/carry gate, or VRAM/host realism checks.

Inputs: arena, limit.

get_verified_spreadsC

List latest verified & advisory cross-market prediction, compute, and FX spreads from the live SQLite WAL ledger.

Inputs: arena, limit.

verify_ledger_integrityB

Execute deep row-level SHA-256 content recomputation and hash-chain verification across all poll_runs in the SQLite WAL snapshot ledger.

Inputs: no named parameters.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 6 tools

    Disambiguation4/5

    The three listing tools (verified spreads, quarantined traps, backtest summary) target clearly different datasets, and the two computational tools (resolution equivalence audit vs GPU/API arbitrage math) are distinct in purpose. The only mild overlap is between get_backtest_summary and verify_ledger_integrity, both of which mention SHA-256 chain verification, which could cause some selection hesitation.

    Naming Consistency5/5

    All six names follow a consistent snake_case verb_noun pattern (get_*, audit_*, calculate_*, verify_*), and each verb matches the operation type. No mixed conventions or vague standalone verbs.

    Tool Count5/5

    Six tools is well within the ideal 3-15 range and each one maps to a distinct facet of the arbitrage workflow: reading results, reading exclusions, historical context, rule auditing, arbitrage math, and integrity verification. No tool appears redundant.

    Completeness3/5

    The surface is entirely read/compute-oriented: there is no way to trigger a new poll or ingest fresh market data, adjust slippage/VRAM thresholds, or add a contract for ongoing monitoring. Agents can analyze existing ledger state and audit user-supplied specs, but the lifecycle has notable dead ends for data refresh and configuration.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides read-only MCP tools for market snapshots, position risk, order reconciliation, and daily report previews with deterministic financial calculations, evidence chains, and audit trails.
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables read-only access to Hyperliquid's public market, user, vault, and staking data via 61 MCP tools, covering perpetuals, spot, and borrow-lend information.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents and MT5 clients to query 18-pair FX and gold macro-surprise telemetry, prop-firm T-5m blackout and VETO trade-gate status, catalyst feeds, radar snapshots, and entitlement quota details through read-only MCP tools.
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables read-only crypto market analysis, derivatives positioning, coin and token safety checks, trade sizing, backtests, swap quote comparison, wallet reviews, portfolio stress tests, and 35 live market feeds.
      1
      Apache 2.0