
How We Built Realtime Precomputed PnL for Polymarket
1.6B trades backfilled in under a week (now tracking 1.9B+), 378 live indexes, and a custom database that sustains up to 2M writes per second. Why query-time PnL fails, and what we built instead.
We index the protocols your product depends on and stand up the backend. Polymarket is live today. Everything else we build with you.
Built with your team
We index the protocol and ship the data backend.
import { StructClient } from "@structbuild/sdk";
const client = new StructClient({ apiKey: process.env.STRUCT_API_KEY });
const events = await client.events.list({
status: "active",
sort_by: "volume",
timeframe: "1h",
limit: 25,
});
for (const event of events.data) {
console.log(event.title, event.volume, event.markets.length);
}Indexing a protocol is custom, not self-serve. We work with your team to stand up the indexers, the pipeline, and the APIs.
Index your protocol. Point us at the programs and contracts your product depends on. We stand up the live firehose and complete historical backfill as part of the engagement.
Step 1
Index your protocol
Live firehose and full historical backfill
Prediction markets are self-serve today. Solana, Ethereum, Ink, Arc, or a chain we have not listed: we index it with your team.
Query markets, trades, positions, wallets, and candlesticks, with complete, fully backfilled history.
Learn moreTrigger on market creations, resolutions, price thresholds, wallet activity, and dozens of custom events.
Learn moreStream trades, transactions, price updates, and market changes in real time, with millisecond latency on every chain.
Learn moreTrading apps, agents, and wallets outside Polymarket are engagements. We build the data backend. You own the product.
We stand up discovery feeds, live prices, and token metrics so your team can ship the trading app, not the indexer.
We feed agents the onchain context they need to research, monitor, and trade. Scoped per protocol, shipped with your team.
Holdings, cost basis, and PnL for the wallets your product tracks. We resolve the balances. You own the dashboard.
Connect Polymarket data to the AI tools you already use and ship your integration in minutes.
Connect AI assistants like Claude, Cursor, and Codex directly to live Polymarket data through the Model Context Protocol.
Install the Struct skill in Claude Code to scaffold integrations, generate API calls, and work with our SDK using natural language.
Pay only for what you use with the x402 protocol. Every API call settles instantly in USDC, no subscriptions, no minimums, no wallet round-trips.
Real numbers from production. Millisecond latency, measured continuously.
Guides, product updates, and deep dives into onchain data.

1.6B trades backfilled in under a week (now tracking 1.9B+), 378 live indexes, and a custom database that sustains up to 2M writes per second. Why query-time PnL fails, and what we built instead.

We benchmarked Polymarket's RTDS feed against the Struct Trades WebSocket across ~15,000 live trades. Struct's confirmed feed leads by ~0.5s, its mempool feed by 2.6s.

v0.6 rebuilds Struct's PnL from the ground up. Exactly what a trader has made or lost on Polymarket, updated every block, counting every fee, rebate, reward, and yield payment.