--- name: polystrike-agent-api description: Read Polystrike's record of the Polymarket post-count markets for Elon Musk and Ted Cruz (X) and Donald Trump (Truth Social) - our independent count, the XTracker count the markets settle on, the count the Polymarket page shows, the posts themselves, and bucket-price history. Use it to see where a market's count stands or to study past markets. The API needs a Data key or a $0.01 x402 payment per call; there is no free tier. Files older than 30 days are open in the public archive. This is data, not predictions or trading advice. license: MIT metadata: version: "2.1" subject: "Elon Musk, Ted Cruz, Donald Trump" platform: "Polymarket" # The venue that lists and settles these markets provider: "Polystrike" # The source of the API/Data --- # Polystrike Agent API > Polystrike keeps a per-post record of Polymarket's post-count markets: our own count of qualifying posts, the XTracker count the markets settle on, and the number the Polymarket page shows, plus the posts, bucket prices and order books behind them. **We sell the record, not predictions.** Forecasts, trading signals, position sizing and portfolio advice are not part of the product. **Contact**: hello@polystrike.xyz, or [@dizpers](https://x.com/dizpers) on X. ## 1. What is covered | Account | Platform | API `{user}` | How often we read it | |---|---|---|---| | Elon Musk (`@elonmusk`) | X | `elon` | every 1 s | | Ted Cruz (`@tedcruz`) | X | `cruz` | every 5 s | | Donald Trump (`@realDonaldTrump`) | Truth Social | `trump` | every 15 s (about every 5 minutes when Truth Social blocks the fast reader) | For every open market window we keep three counters: | Counter | Field | Meaning | |---|---|---| | Our count | `real_counter` | Qualifying posts we captured in the window (rules in §2). | | XTracker count | `polymarket_xtracker_counter` | The settlement oracle's count. XTracker updates about every 5 minutes. **This is the number the market pays on.** | | Page count | `polymarket_ui_counter` | The number the Polymarket market page shows. Display only; it can lag or freeze. | And the gaps between them: | Field | Formula | |---|---| | `settlement_delta` | `real_counter - polymarket_xtracker_counter` | | `display_delta` | `real_counter - polymarket_ui_counter` | | `internal_delta` | `polymarket_ui_counter - polymarket_xtracker_counter` | The gaps are timing, not a trading signal. A positive `settlement_delta` usually means XTracker has not scraped a new post yet; after a deletion it can also mean XTracker missed a post we kept (§2). The order book prices off the settling count, and our own research found trading the page-vs-oracle gap roughly breakeven. ## 2. Counting rules and settlement - **X (Elon Musk, Ted Cruz)**: main-feed posts, quote posts, reposts and main-feed replies count; in-thread replies and community reposts don't. - **Truth Social (Donald Trump)**: Truths, quote Truths and ReTruths count; replies don't. - **Settlement**: when the window closes, the bucket containing XTracker's final in-window count resolves YES; every other bucket resolves NO. - **Deleted posts** (rule in force since 2026-08-06): our count keeps every qualifying post we captured while it was live, even after it is deleted; the post is flagged `is_deleted` and keeps `is_counted: true`. XTracker still counted about 7 in 10 of the deletions we caught (52 measured). A post deleted before XTracker's next scrape (about every 5 minutes) can be missed, so after a deletion our count can read 1-3 above XTracker's. The Truth Social market counts deleted posts once they were captured. - **When a deletion shows up**: on X we re-read the full timeline every 10 minutes, and a post must be missing from two re-reads in a row before we flag it, so `is_deleted` appears about 20 minutes after the deletion. The post keeps counting either way. ## 3. Freshness and latency | What | Figure | |---|---| | `@elonmusk`: post published to counted | median **11.5 s**, p90 12.6-15.1 s, p99 28.2 s, worst logged 631 s (measured on production 2026-07-29) | | X's timeline index | needs about 10.8 s to list a new post, so polling harder does not move the median | | `@tedcruz` | polled every 5 s; the 11.5 s figure was measured for Elon only and does not apply here | | `@realDonaldTrump` (Truth Social) | read every 15 s, or about every 5 minutes when Truth Social blocks the fast reader; the 11.5 s figure does not apply here | | XTracker (not ours) | updates about every 5 minutes | | Data key and x402 | counters live (`"freshness": "live"`) | | Counter pages on polystrike.xyz | about **30 minutes** behind; each page shows when it was generated | These figures tell you how current a number is, nothing more. In our own paper testing, when a post pushed the count past a bucket boundary, the price had finished moving within about 2-3 seconds, before our feed had the post. ## 4. Tiers | | Data | Pay-per-call | Public archive | |---|---|---|---| | Price | $29 for 30 days, $290 for a year | $0.01 per call | open | | Auth | `X-API-Key` header | x402 payment header, no key | none | | Rate limit | 10,000 requests/hour | no hourly cap | - | | Counters | live | live | snapshots older than 30 days | | Posts | up to 100 per page with `is_counted`, plus the full archive | same as Data | no | | History (`/api/v1/history/*`) | yes | yes | no | | Bulk parquet | full archive | no | files older than 30 days | | WebSocket `/ws` | yes | no | no | There is **no free tier and no free key**: every data endpoint answers only a Data key or an x402 payment, and a call without either gets 402 (§6). **Data.** Live counters, 10,000 requests/hour, the full post archive with the counted verdict, minute-level counter and price history, order books, bulk parquet and the WebSocket. Pay USDC on Polygon or Base to `0x2B1204Ed8152F888092cB4e25FeF6348C646C578`, then submit the transaction hash and your email at https://polystrike.xyz/#waitlist or hello@polystrike.xyz. Keys are issued by hand, usually within a few hours. Send the key as `X-API-Key: ps_pro_...`. Pricing: https://polystrike.xyz/#pricing. **Pay-per-call.** $0.01 per call in USDC on Base via x402, no key and no account. Call a paid endpoint without a key; the 402 response carries the payment requirements in its `PAYMENT-REQUIRED` header. Retry with the payment in `X-PAYMENT` (x402 v1) or `PAYMENT-SIGNATURE` (v2). Same live data as Data, one call at a time; bulk files are subscription-only. **Public archive.** `GET /api/v1/bulk/public` needs no key or payment: parquet counter and bucket-price snapshots older than 30 days, under CC BY 4.0 (§5.5). ## 5. Endpoints Base URL `https://polystrike.xyz`. OpenAPI spec: https://polystrike.xyz/openapi.json (paths, parameters, auth schemes; this file adds field meanings and caveats). Every request needs a `User-Agent` header: Cloudflare rejects Python urllib's default one. Timestamps are Unix epoch milliseconds (UTC). `{user}` is `elon`, `cruz` or `trump`. | Endpoint | Access | Returns | |---|---|---| | `GET /api/v1/meta/{user}` | Data, x402 | Counters and deltas for each open window | | `GET /api/v1/meta/elon/tweets`, `/api/v1/meta/cruz/tweets`, `/api/v1/meta/trump/posts` | Data, x402 | Recent posts with type and counting flags | | `GET /api/v1/prediction/{user}` | Data, x402 | Counters, posting pace and each bucket's `market_price` (no forecasts, §9) | | `GET /api/v1/history/{user}/counter` | Data, x402 | Counter snapshots over time | | `GET /api/v1/history/{user}/prices` | Data, x402 | Bucket price snapshots | | `GET /api/v1/history/{user}/books` | Data, x402 | Order-book snapshots | | `GET /api/v1/history/{user}/tweets` | Data, x402 | Every post, deleted ones included, with the counted verdict | | `GET /api/v1/bulk/public` | Open | Public parquet archive (CC BY 4.0) | | `GET /api/v1/bulk/{user}` | Data | Full parquet archive for one account | | `/ws` | Data | Counter snapshots pushed as they are written | | `GET /api/v1/health` | Open | `{"timestamp": ..., "status": "ok"}` | | `GET /api/v1/signals/{user}`, `GET /api/v1/portfolio/elon` | — | Retired 2026-11-08: HTTP 410 for every caller (§9) | ### 5.1 Counters: `GET /api/v1/meta/{user}` ```bash curl -A "my-agent/1.0" -H "X-API-Key: ps_pro_..." https://polystrike.xyz/api/v1/meta/trump ``` The response is an **object**, not a list. The open windows are in `data`, and several can be open at once (for example a weekly and a shorter window). A Data-key response (the numbers are an example): ```json { "timestamp": 1790795280353, "freshness": "live", "freshness_delay_sec": 0, "data": [ { "event_id": 1083675, "event_title": "Donald Trump # Truth Social posts September 29 - October 6, 2026?", "slug": "donald-trump-of-truth-social-posts-september-29-october-6-2026", "image": "https://polymarket-upload.s3.us-east-2.amazonaws.com/trump-66eefdf4e0.jpg", "start_ts": 1790697600000, "end_ts": 1791302400000, "snapshot_ts": 1790793220392, "polymarket_xtracker_counter": 8, "real_counter": 8, "polymarket_ui_counter": 8, "settlement_delta": 0, "display_delta": 0, "internal_delta": 0 } ] } ``` - Top level: `timestamp` (server time), `freshness` (`"live"` for Data and x402), `freshness_delay_sec` (`0`), `data`. - Per window: `event_id`, `event_title`, `slug` (Polymarket event slug), `image`, `start_ts` and `end_ts` (the window), `snapshot_ts` (when these counters were captured), the three counters and three deltas from §1. - A counter can be `null` when the window has no snapshot yet. ### 5.2 Posts: `/api/v1/meta/elon/tweets`, `/api/v1/meta/cruz/tweets`, `/api/v1/meta/trump/posts` Query: `limit` (1-100, default 15) and `offset`. ```json { "timestamp": 1770734408963, "data": [ { "tweet_id": "2021230513298473031", "text": "SpaceX is launching...", "created_ts": 1770733881000, "referenced_text": null, "referenced_author_id": null, "is_reply": false, "is_quote": false, "is_retweet": false, "is_counted": true } ], "limit": 15, "offset": 0 } ``` - `is_counted`: whether the post counts under the market's rules (§2): `true` or `false`. - `is_reply`, `is_quote`, `is_retweet`: the post type. On Truth Social, `tweet_id` is the post ID, `is_retweet` marks a ReTruth and `is_quote` a quote Truth. - `referenced_text` and `referenced_author_id`: the quoted or reposted post, when there is one. - `created_ts`: when the post was published. - This feed leaves out deleted posts. The full record, deletions included, is `/api/v1/history/{user}/tweets`. - Posts responses carry no `freshness` fields. ### 5.3 Bucket prices: `GET /api/v1/prediction/{user}` Same envelope as §5.1 (`timestamp`, `freshness`, `freshness_delay_sec`, `data`). Each window in `data` has `event_id`, `event_title`, the three counters and three deltas, `seconds_remaining`, and `markets`: one `{"title": "240-259", "market_price": 0.35}` entry per bucket, where `market_price` is the Polymarket price (implied probability). The response also carries model fields that are not part of the product (§9). ### 5.4 History (Data or x402): `/api/v1/history/{user}/...` Every history response is `{"timestamp", "freshness": "live", "data": [...], "next_cursor"}`. Rows come in `id` order; pass `next_cursor` back as `cursor` until it is `null`. `limit` is 1-5000 (default 1000). | Route | Required | Optional | Rows | |---|---|---|---| | `counter` | `from_ms`, `to_ms` | `cursor`, `limit` | Counter snapshots: our count, XTracker's and the page's, with the deltas | | `prices` | `from_ms`, `to_ms` (at most 31 days apart) | `event_id`, `cursor`, `limit` | Bucket price snapshots (`event_id`, `market_title`, `token_id`, `yes_price`, `timestamp`) | | `books` | `from_ms`, `to_ms` (at most 31 days apart) | `token_id`, `cursor`, `limit` | Order-book snapshots; `bids` and `asks` are lists of `[price, size]` | | `tweets` | none | `q` (substring of the text), `since`, `until` (on `created_at`), `cursor`, `limit` | Every post, deleted ones included: `is_counted`, `filter_reason`, `is_deleted`, `deleted_at`, quoted or reposted text. Post time is `created_at` here, not `created_ts` | A wider range on `prices` or `books` returns 422; use the bulk files (§5.5) for long windows. ### 5.5 Bulk parquet - `GET /api/v1/bulk/public` (open, no key or payment, CC BY 4.0): lists every public file, i.e. parquet older than 30 days. It holds counter snapshots and bucket-price snapshots for elon, cruz and trump, with data since 2025-06-13. Each entry is `{table, date, file, bytes}`; download it at `/api/v1/bulk/public/{table}/{date}/{file}`. - `GET /api/v1/bulk/{user}` (Data key): the same listing for the full archive of `{user}_snapshots`, `{user}_market_snapshots` and `{user}_orderbook_snapshots`; download at `/api/v1/bulk/{user}/{table}/{date}/{file}`. Per-call x402 payers get 403 `bulk_is_subscription_only`. ### 5.6 WebSocket: `wss://polystrike.xyz/ws` (Data) Pass the key as an `X-API-Key` header or as `?api_key=`. Without a Data key the socket sends one `{"type": "error", "code": "pro_required", ...}` message and closes with code 1008. Subscribe with `{"action": "subscribe", "channel": "elon:*"}` for every open window of an account, or `"elon:"` for one window; each message is `{"channel", "type": "snapshot", "user_id", "event_id", "data": {...counters and deltas}}`. The socket relays `elon`, `cruz` and `trump`. ## 6. Errors Paywall and rate-limit refusals return one five-field body at the top level: ```json { "error": "payment_required", "message": "This endpoint is part of the Data tier. Subscribe for $29/month ($290/year): send USDC on Polygon or Base to 0x2B1204Ed8152F888092cB4e25FeF6348C646C578, then submit the tx hash and your email at https://polystrike.xyz/#waitlist or hello@polystrike.xyz; keys are issued by hand, usually within a few hours. Or pay $0.01 per call with USDC on Base via x402 (see PAYMENT-REQUIRED headers). ...", "pricing": "https://polystrike.xyz/#pricing", "docs": "https://polystrike.xyz/SKILL.md", "contact": "hello@polystrike.xyz" } ``` | Status | Body | When | |---|---|---| | 402 | `payment_required`, with x402 requirements in the `PAYMENT-REQUIRED` header | A data endpoint called without a Data key or payment: pay per call or get a key | | 401 | `payment_required` | The same, while x402 payments are switched off | | 401 | `{"detail": "Invalid API Key"}` | Unknown key | | 403 | `{"detail": "API Key expired"}` or `{"detail": "API Key inactive"}` | Expired or disabled key | | 403 | `bulk_is_subscription_only` (`error`, `message`, `pricing`) | An x402 payer on `/api/v1/bulk/{user}` | | 422 | `{"detail": ...}` | Bad parameters, such as a history range over 31 days | | 429 | `rate_limited`, with a `Retry-After` header | The hourly limit is used up | ## 7. MCP server - Streamable HTTP (primary): `https://polystrike.xyz/mcp` - Legacy SSE, for older clients: `https://polystrike.xyz/mcp/sse` Claude Code: ```bash claude mcp add --transport http polystrike https://polystrike.xyz/mcp --header "x-api-key: YOUR_KEY" ``` Claude Desktop (`claude_desktop_config.json`), bridged with `mcp-remote`: ```json { "mcpServers": { "polystrike": { "command": "npx", "args": ["-y", "mcp-remote", "https://polystrike.xyz/mcp", "--header", "x-api-key:${POLYSTRIKE_API_KEY}"], "env": { "POLYSTRIKE_API_KEY": "YOUR_KEY" } } } } ``` Tools (the data tools need a Data key in the `x-api-key` header): - `get_market_metadata` (`user`: `elon` | `cruz` | `trump`): counters and deltas for the open windows. - `get_recent_tweets` (`user`, `limit`, `offset`): recent posts with `is_counted`. - `check_health`: API status. - `get_predictions` (`user`): counters and each bucket's `market_price` (no forecasts). The signal and portfolio tools were retired on 2026-11-08 (§9). ## 8. Examples Python, standard library only: ```python import json import time import urllib.request def get(path, key=None): headers = {"User-Agent": "my-agent/1.0"} # Cloudflare rejects urllib's default User-Agent if key: headers["X-API-Key"] = key req = urllib.request.Request("https://polystrike.xyz" + path, headers=headers) with urllib.request.urlopen(req, timeout=15) as resp: return json.load(resp) KEY = "ps_pro_..." # your Data key body = get("/api/v1/meta/elon", key=KEY) # an object, not a list print(body["freshness"], body["freshness_delay_sec"]) # "live" 0 for window in body["data"]: print(window["event_title"], "ours", window["real_counter"], "xtracker", window["polymarket_xtracker_counter"], "page", window["polymarket_ui_counter"], "as of", window["snapshot_ts"]) # Data key: page through a day of counter history now = int(time.time() * 1000) cursor, rows = 0, [] while True: page = get(f"/api/v1/history/elon/counter?from_ms={now - 86_400_000}&to_ms={now}" f"&cursor={cursor}&limit=5000", key=KEY) rows += page["data"] if page["next_cursor"] is None: break cursor = page["next_cursor"] ``` ## 9. Retired: forecasts, signals and portfolio advice Polystrike sells the record, not predictions. On 2026-11-08 the forecast-model outputs were removed from the API. - `GET /api/v1/prediction/{user}` returns the counters, `velocity_counted_1h` / `velocity_all_1h` and each bucket's `title` and `market_price` (§5.3). It no longer carries `forecast`, `model_prob`, the edge field or `sleep_probability`. - `GET /api/v1/signals/{user}`, `GET /api/v1/portfolio/elon` and `GET /api/v1/portfolio/elon/rebalancing` answer HTTP 410 (`not_sold`) to every caller, before any payment is asked. - The MCP tools `get_trading_signals`, `analyze_portfolio` and `get_rebalancing_recommendations` no longer exist.