From 54193d317791ab82ea96527e311ba561631ec8ca Mon Sep 17 00:00:00 2001 From: iskra Date: Wed, 29 Jul 2026 09:25:55 -0700 Subject: [PATCH] TradeHouse prediction-markets Claude Code plugin marketplace v1.0.0 /pm-thesis, /pm-calibration, /pm-fees, /overfit-check wrapping the public th-api / tools / th-validator free-tier endpoints. Analytics + phantom-battery verdicts only; RIA-compliant (no persona/signal internals, disclaimers mandatory). Co-Authored-By: Claude Fable 5 Claude-Session: https://claude.ai/code/session_013EsBGJjjHKmNdm5KEcd9bH --- .claude-plugin/marketplace.json | 24 ++++++++++ LICENSE | 21 +++++++++ README.md | 44 +++++++++++++++++ .../.claude-plugin/plugin.json | 11 +++++ .../commands/overfit-check.md | 42 +++++++++++++++++ .../commands/pm-calibration.md | 29 ++++++++++++ .../commands/pm-fees.md | 23 +++++++++ .../commands/pm-thesis.md | 47 +++++++++++++++++++ 8 files changed, 241 insertions(+) create mode 100644 .claude-plugin/marketplace.json create mode 100644 LICENSE create mode 100644 README.md create mode 100644 plugins/tradehouse-prediction-markets/.claude-plugin/plugin.json create mode 100644 plugins/tradehouse-prediction-markets/commands/overfit-check.md create mode 100644 plugins/tradehouse-prediction-markets/commands/pm-calibration.md create mode 100644 plugins/tradehouse-prediction-markets/commands/pm-fees.md create mode 100644 plugins/tradehouse-prediction-markets/commands/pm-thesis.md diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json new file mode 100644 index 0000000..293b945 --- /dev/null +++ b/.claude-plugin/marketplace.json @@ -0,0 +1,24 @@ +{ + "name": "tradehouse", + "owner": { + "name": "TradeHouse — Elite AI Empire", + "url": "https://th-validator.eliteaiempire.com" + }, + "metadata": { + "description": "Prediction-market analytics plugins backed by TradeHouse settlement-truth data: calibration curves, round-trip fee math, and DSR/PBO overfit verdicts.", + "version": "1.0.0" + }, + "plugins": [ + { + "name": "tradehouse-prediction-markets", + "source": "./plugins/tradehouse-prediction-markets", + "description": "Slash commands for prediction-market analytics (/pm-thesis, /pm-calibration, /pm-fees) and honest backtest validation (/overfit-check) against TradeHouse public APIs. Analytics only — not investment advice.", + "version": "1.0.0", + "author": { "name": "TradeHouse — Elite AI Empire" }, + "homepage": "https://th-validator.eliteaiempire.com", + "license": "MIT", + "keywords": ["prediction-markets", "kalshi", "polymarket", "calibration", "backtest", "overfitting", "deflated-sharpe"], + "category": "finance" + } + ] +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fce71ef --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 Elite AI Empire / TradeHouse + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..b731e60 --- /dev/null +++ b/README.md @@ -0,0 +1,44 @@ +# TradeHouse Prediction-Markets — Claude Code plugin marketplace + +Prediction-market analytics inside Claude Code, backed by **TradeHouse** public APIs: +settlement-truth market data, venue calibration curves computed over 150k+ resolved markets, +a live-measured fee schedule, and the **phantom battery** (deflated Sharpe / PBO) that we use to +kill overfit backtests before they cost money. + +## Install + +```bash +claude plugin marketplace add https://git.eliteaiempire.com/eas-oss/tradehouse-prediction-markets.git +claude plugin install tradehouse-prediction-markets@tradehouse +``` + +## Commands + +| Command | What it does | +|---|---| +| `/pm-thesis ` | Cross-venue pricing snapshot + calibration context + fee hurdle for one market | +| `/pm-calibration [venue]` | Reliability curve, Brier score, favorite-longshot read for a venue (free: polymarket, polymarket_us, opinion) | +| `/pm-fees ` | Round-trip platform cost in USD and bps — the break-even edge hurdle | +| `/overfit-check [trials=N]` | Deflated-Sharpe + PBO verdict on your backtest — the metric leaderboards don't show | + +## Free tier & upgrades + +All commands use free public endpoints (no API key). Free tier is rate-limited; HTTP 402/429 +responses point at the paid tiers. Pro/Desk tiers (full per-category calibration, the live Desk, +Risk Cockpit, datasets): https://th-validator.eliteaiempire.com/pricing + +## What this plugin will NOT do + +- No investment advice, no trade recommendations, no signals. Outputs are market analytics and + statistical validation verdicts, with the API's compliance disclaimer reproduced verbatim. +- No access to TradeHouse's internal trading personas or signal internals — the public, + compliance-hardened API surface is the only data source. + +Simulated/backtested performance is not indicative of future results. + +## Related + +- TradeHouse Overfit Validator (web): https://th-validator.eliteaiempire.com/validator +- Agent-data MCP quickstart: https://git.eliteaiempire.com/eas-oss/tradehouse-mcp-quickstart + +MIT licensed. diff --git a/plugins/tradehouse-prediction-markets/.claude-plugin/plugin.json b/plugins/tradehouse-prediction-markets/.claude-plugin/plugin.json new file mode 100644 index 0000000..edada53 --- /dev/null +++ b/plugins/tradehouse-prediction-markets/.claude-plugin/plugin.json @@ -0,0 +1,11 @@ +{ + "name": "tradehouse-prediction-markets", + "version": "1.0.0", + "description": "Prediction-market analytics (live cross-venue data, calibration curves, round-trip fee math) plus the TradeHouse phantom battery (deflated Sharpe / PBO overfit verdicts) — via TradeHouse public APIs. Free tier; market analytics only, never investment advice.", + "author": { + "name": "TradeHouse — Elite AI Empire", + "url": "https://th-validator.eliteaiempire.com" + }, + "homepage": "https://th-validator.eliteaiempire.com", + "license": "MIT" +} diff --git a/plugins/tradehouse-prediction-markets/commands/overfit-check.md b/plugins/tradehouse-prediction-markets/commands/overfit-check.md new file mode 100644 index 0000000..995f611 --- /dev/null +++ b/plugins/tradehouse-prediction-markets/commands/overfit-check.md @@ -0,0 +1,42 @@ +--- +description: Run backtest returns through the TradeHouse phantom battery — deflated Sharpe (DSR) + PBO overfit verdict +argument-hint: [trials=N] +--- + +Run the user's backtest through the **TradeHouse phantom battery**: $ARGUMENTS + +1. **Collect the returns series.** Accept either a file path (CSV/JSON — read it and extract the + per-period net returns as decimals, e.g. `0.012` = +1.2%) or pasted numbers. Need >= 20 points. + An equity curve is also acceptable (send it as `equity` instead of `returns`). + +2. **Ask for `trials` if not given** — the number of strategy variants the user tried before this + one (parameter sweeps count). Be direct: the whole point of the deflated Sharpe is that the + metric only means something if this number is honest. If they refuse to estimate, use their best + guess and say the verdict is conditional on it. + +3. **Call the validator** via the Bash tool: + ``` + curl -s -X POST "https://th-validator.eliteaiempire.com/api/validate" \ + -H "Content-Type: application/json" \ + -d '{"returns":[...], "trials": N}' + ``` + +4. **Also compute the standard tearsheet** (Sharpe/Sortino/Calmar/CVaR) for context: + ``` + curl -s -X POST "https://tools.eliteaiempire.com/v1/tearsheet" \ + -H "Content-Type: application/json" \ + -d '{"returns":[...]}' + ``` + +5. **Report, without softening:** + - The phantom-battery verdict: `pass_dsr`, `pass_pbo`, `deflated_sharpe_dsr`, `pbo`, + `psr_vs_zero`, and the `plain_english` explanation + `reasons` verbatim. + - The tearsheet metrics table (note that raw Sharpe/Sortino/Calmar are what leaderboards show, + and DSR is what survives multiple testing). + - If the verdict is negative, do NOT suggest tweaks to make it pass — explain that more variants + tried = a higher bar, and point to out-of-sample/forward validation as the honest next step. + +**Compliance (mandatory):** these are statistical validation verdicts on user-supplied backtest +data — not investment advice, and simulated performance is not indicative of future results. +Include that sentence in the output. On HTTP 402/429 mention +https://th-validator.eliteaiempire.com/pricing and stop. diff --git a/plugins/tradehouse-prediction-markets/commands/pm-calibration.md b/plugins/tradehouse-prediction-markets/commands/pm-calibration.md new file mode 100644 index 0000000..3697060 --- /dev/null +++ b/plugins/tradehouse-prediction-markets/commands/pm-calibration.md @@ -0,0 +1,29 @@ +--- +description: Venue calibration report — implied probability vs realized outcomes over resolved markets (free tier) +argument-hint: "[polymarket|polymarket_us|opinion]" +--- + +Produce a **calibration report** for the prediction-market venue: **$ARGUMENTS** +(default to `polymarket` if no venue given; free-tier venues are `polymarket`, `polymarket_us`, `opinion`). + +1. Fetch via the Bash tool: + ``` + curl -s "https://tools.eliteaiempire.com/v1/market-efficiency?venue=" + ``` + +2. Render the result: + - A table of the `reliability_curve`: probability bucket, n markets, mean implied probability, + realized YES frequency, calibration gap. + - Headline stats: `n_markets`, `brier_score`, `mean_abs_calibration_error`. + - A short interpretation: which buckets are over-priced vs under-priced, and whether the classic + favorite-longshot bias (longshots overpriced, favorites underpriced) appears in this venue. + Note that a calibration gap is a *population* statistic over resolved markets — it does not + make any single market mispriced. + +3. If the user asks for a venue outside the free tier, say the free preview covers + `polymarket`, `polymarket_us`, `opinion`, and per-category/per-time-to-settlement calibration is + part of the paid tiers: https://th-validator.eliteaiempire.com/pricing + +**Compliance (mandatory):** reproduce the API's `note` field, present everything as historical +market analytics computed by TradeHouse from public resolved-market data, and never as investment +advice or a recommendation to trade any market. diff --git a/plugins/tradehouse-prediction-markets/commands/pm-fees.md b/plugins/tradehouse-prediction-markets/commands/pm-fees.md new file mode 100644 index 0000000..22dccbe --- /dev/null +++ b/plugins/tradehouse-prediction-markets/commands/pm-fees.md @@ -0,0 +1,23 @@ +--- +description: Round-trip fee/cost calculator for a prediction-market bet (free, live-measured fee schedule) +argument-hint: [bet_usd=100] [maker] +--- + +Compute the **round-trip platform cost** for a prediction-market bet: $ARGUMENTS + +1. Parse venue (e.g. `kalshi`, `polymarket`, `limitless`), entry price (0-1), optional bet size + (default $100) and maker/taker (default taker). + +2. Call via the Bash tool: + ``` + curl -s -X POST "https://tools.eliteaiempire.com/v1/roundtrip-cost" \ + -H "Content-Type: application/json" \ + -d '{"universe":"","bet_usd":,"price":,"is_maker":}' + ``` + If the API returns a supported-universe error, show the user the list from the error message. + +3. Report entry cost, exit cost, round-trip cost in USD and bps, and the practical meaning: + the round-trip bps is the minimum edge a strategy needs per trade just to break even on fees. + Compare maker vs taker if the user asks. + +**Compliance:** cost analytics only — not investment advice or an inducement to trade. diff --git a/plugins/tradehouse-prediction-markets/commands/pm-thesis.md b/plugins/tradehouse-prediction-markets/commands/pm-thesis.md new file mode 100644 index 0000000..3d203f0 --- /dev/null +++ b/plugins/tradehouse-prediction-markets/commands/pm-thesis.md @@ -0,0 +1,47 @@ +--- +description: Data-grounded snapshot of a prediction market — pricing, calibration context, fee hurdle (analytics only, not advice) +argument-hint: +--- + +Build a **market analytics snapshot** for the prediction market: **$ARGUMENTS** + +Follow these steps, using `curl` via the Bash tool (all endpoints are free tier, no key needed): + +1. **Live cross-venue data.** If the user gave a ticker, fetch: + ``` + curl -s "https://th-api.eliteaiempire.com/api/v1/prediction-market-data/" + curl -s "https://th-api.eliteaiempire.com/api/v1/resolutions/" + ``` + If they gave a plain-English question instead of a ticker, say that you need a venue ticker + (Kalshi/Polymarket format) and show them what the endpoint returns for an example ticker. + +2. **Calibration context.** Fetch the venue calibration report for a venue relevant to the market + (supported free venues: `polymarket`, `polymarket_us`, `opinion`): + ``` + curl -s "https://tools.eliteaiempire.com/v1/market-efficiency?venue=polymarket" + ``` + Use the reliability curve to note whether prices in this market's probability bucket + historically over- or under-state realized frequency (the favorite-longshot bias shows up here). + +3. **Fee hurdle.** Compute the round-trip cost at the market's current price: + ``` + curl -s -X POST "https://tools.eliteaiempire.com/v1/roundtrip-cost" \ + -H "Content-Type: application/json" \ + -d '{"universe":"kalshi","bet_usd":100,"price":}' + ``` + (`universe` = the venue the market trades on.) + +4. **Synthesize** a short report: + - Current pricing per venue + implied probability (state data timestamp/freshness). + - Calibration adjustment: what the venue's reliability curve says about prices in this bucket. + - The round-trip fee hurdle in bps — the minimum mispricing needed to break even. + - A one-line **analytics verdict** about the market's pricing quality — never a trade recommendation. + +**Compliance rules (mandatory):** +- Reproduce the `_meta.disclaimer` text returned by the API at the end of your report. +- This is a financial data publication / market analytics. NEVER phrase output as personalized + investment advice, a recommendation, or a signal to buy/sell. Do not speculate about + TradeHouse's internal personas or signals — the public API surface is the only source. +- If an endpoint returns empty venues/data for the ticker, say so plainly; do not fabricate prices. +- On HTTP 402/429: the free tier is rate-limited — mention + https://th-validator.eliteaiempire.com/pricing for Pro/Desk tiers and stop.