Skip to main content

Prediction market positions and PnL

What are prediction market positions and PnL?

Prediction market positions and PnL are each trader’s holdings in every market outcome, with the average price they paid and the profit or loss on what they’ve sold.

Prediction markets, trading apps and analytics providers use them for portfolio screens, leaderboards and research, and every one depends on applying each fill in order.

Goldsky keeps positions current from every fill and serves them by wallet or streams them to your database, while unrealized PnL, rankings and what you show stay with you.

You can build it two ways: call the Feeds prediction-market positions API for each wallet, or stream the positions dataset into your own database with Turbo Pipelines.

Who tracks prediction market positions and PnL?

Prediction market apps, trading terminals and data and analytics providers that track traders on prediction markets.

How prediction market positions and PnL are tracked

The diagram follows one wallet from its orders filling on the market to its positions and PnL in your app, and shows who does each step. Your setup may differ.

Goldsky, step 2: FeedsUpdate positionsSize, entry price and realized PnL
Blockchains, step 1: Orders fillTrades settle on the prediction market
Your business, step 4: Show positions and PnLIn your app or leaderboard
Goldsky, step 3: FeedsServe them by walletOne request returns a wallet’s positions
  • Goldsky

Ways to track prediction market positions and PnL

The positions API returns one wallet’s current positions and realized PnL per request; the pipeline puts every account’s positions in your database, where you can add unrealized PnL, history and rankings.

Best for
One wallet’s current positions, with no database
Products
Feeds
What you run
Nothing; you call an endpoint and keep what you need
What you write
REST requests
Where your data lives
Hosted by Goldsky
How results reach you
Returned when you call
Best for
Every account, with history and rankings in your database
Products
Turbo
What you run
The destination: your database, queue or bucket, or a Postgres database Goldsky hosts
What you write
Pipeline YAML and SQL; TypeScript transforms when needed
Where your data lives
In your own database or systems
How results reach you
Pushed to you

Option 1: Track prediction market positions and PnL with a positions API

Your app calls the Feeds Positions endpoint with a wallet address and gets back that wallet’s Polymarket positions, each with size, average entry price and realized PnL. Goldsky keeps the positions current from every fill.

When to use a prediction market positions API

An app team wants a trader’s portfolio view or a ranked list of their positions, one wallet at a time, without running a database for it.

What you’ll need

  • Goldsky Feeds
  • A current price source for each outcome, for unrealized PnL
  • An app or leaderboard that shows the results
  1. Fill orders on the prediction market

    A trader’s position changes each time one of their orders to buy or sell outcome shares is filled.

    Each fill is recorded onchain with the trader, the outcome token, the number of shares and the price. One trade can produce several fills, one for each side and each order it matched.

  2. Keep each position current

    Handled by Goldsky Feeds

    A position is the running result of every fill: how many shares the trader holds, what they paid on average and what they’ve made on what they sold.

    Every fill for a wallet has to update its size, average entry price and realized PnL, in order. A fill missed or applied twice leaves the entry price wrong from then on.

    Feeds keeps a position per wallet and outcome token for Polymarket, with amount, avg_price, realized_pnl and total_bought, updated as fills land on Polygon.

    See the Polymarket datasets (opens in a new tab)
  3. Fetch a wallet’s positions

    Handled by Goldsky Feeds

    Your app shows one trader’s positions when they open their portfolio or when someone looks them up.

    One request returns the wallet’s positions, largest first or ranked by PnL. Amounts come back in raw units, so the app divides them before showing them, or a share count looks a million times larger.

    With Goldsky, your app calls the Feeds Positions endpoint with the wallet address, and sort=realized_pnl_desc ranks positions by PnL. Add include_zero=true to include closed positions.

    Read the positions endpoint reference (opens in a new tab)
  4. Show positions and PnL in your app

    Traders want their open positions and results on one screen, and leaderboards rank them by PnL.

    Your app shows each position’s size, entry price and PnL. Gains on shares still held depend on each outcome’s current market price, which comes from your price source; showing only realized PnL undercounts traders with large open positions.

What to know about using a positions API

  • Positions are current only; you can’t ask for a wallet’s positions at a past block.
  • PnL is realized only, so gains on shares still held are yours to add.
  • A position is the net of trades, which can differ from the tokens the wallet holds after splits, merges or plain transfers.
  • A leaderboard across many wallets means one call per wallet.

Option 2: Track prediction market positions and PnL by streaming to your database

A pipeline streams the Polymarket positions dataset, and the fills behind it if you want them, into your database. You add unrealized PnL, position history and leaderboards with your own queries.

When to stream prediction market positions to your database

You need every account at once, with unrealized PnL, history or rankings across wallets, kept in your own database.

What you’ll need

  • Goldsky Turbo
  • A database or warehouse for positions and fills
  • A current price source for each outcome, for unrealized PnL
  • An app or leaderboard that reads from your database
  1. Fill orders on the prediction market

    A trader’s position changes each time one of their orders to buy or sell outcome shares is filled.

    Each fill is recorded onchain with the trader, the outcome token, the number of shares and the price. One trade can produce several fills, one for each side and each order it matched.

  2. Stream every account’s positions to your database

    Handled by Goldsky Turbo

    Leaderboards and risk views compare all traders at once, so every position has to be in one place.

    Each position row is keyed by trader and outcome, so an update replaces the old row instead of adding a second one. Without that key, a trader’s position is counted once per trade.

    A Turbo Pipelines pipeline can read the polymarket.user_positions dataset, including its history, and write it to a database sink keyed on user_id and token_id.

    See the Polymarket datasets (opens in a new tab)
  3. Keep the fills for trade history

    Handled by Goldsky Turbo

    A position shows where a trader stands; the fills show how they got there.

    Each fill is stored once, with its price, side and size. Trade history rebuilt from position snapshots loses the individual trades and their prices.

    The same pipeline can add the polymarket.order_filled dataset as a second source and write each fill, keyed on its id, to another table.

    See the order-filled schema (opens in a new tab)
  4. Add unrealized PnL and rankings

    Traders and leaderboards care about open positions too, valued at today’s odds.

    Your database multiplies each open position by the outcome’s current price, adds realized PnL and ranks wallets. Rankings worked out from realized PnL alone favor traders who sell early.

  5. Show positions and PnL in your app

    Traders want their open positions and results on one screen, and leaderboards rank them by PnL.

    Your app shows each position’s size, entry price and PnL. Gains on shares still held depend on each outcome’s current market price, which comes from your price source; showing only realized PnL undercounts traders with large open positions.

What to know about streaming prediction market positions

  • The positions dataset covers every account, so the first load is large; plan storage for it.
  • Rankings, totals and unrealized PnL are queries in your database.
  • Tables keyed on a primary key take reorg corrections as updates and deletes.
  • Goldsky runs the pipeline; you own the database and the queries on it.

What you control

Your team
  • Show positions and PnL in your app

Security and deployment

  • SOC 2 Type IIIndependently audited security controls.
  • Dedicated infrastructureSingle-tenant options for production workloads.
  • Data residencyCloud, on-premises or co-located.

Track prediction market positions and PnL with Goldsky

We’ll map it to your systems and show you what Goldsky runs, so your team builds the product, not the pipelines underneath it.

© Endless Sky Inc. All rights reserved.

PrivacyTermsSecurity

System status