> ## Documentation Index
> Fetch the complete documentation index at: https://dash-docs.nomos.trade/llms.txt
> Use this file to discover all available pages before exploring further.

# Study Crypto Up/Down Rounds

> List every round of a series with its outcome and reference prices, then every wallet's result and fills.

Polymarket's crypto Up/Down rounds (BTC, ETH, SOL, XRP, DOGE, BNB, HYPE, ZEC; 5m, 15m, 1h, 4h and daily) are ordinary markets with predictable slugs, such as `btc-updown-5m-1790572800` for the BTC 5-minute round that starts at that unix second. Three routes cover a study of them:

1. `/v1/markets` lists the rounds, each with its token ids, its outcome and its window.
2. Market `/traders` gives every wallet's result in a round.
3. `/v1/fills` with `include=wallet,tx` gives every fill, with its wallet, for up to 100 rounds per request.

## 1. List the Rounds

Filter by slug prefix and end date. Each market's `resolution.winningOutcome` is 0 (Up) or 1 (Down) once the round has resolved on chain. `round` carries the window and, for rounds Codex recorded, the opening (`strike`) and closing (`close`) reference prices; for older rounds those prices are `null`.

```python Python theme={null}
# uses get() from Rate Limits
def rounds(prefix, start, end):
    after = None
    while True:
        params = {"slugPrefix": prefix, "from": start, "to": end, "limit": 1000}
        if after:
            params["after"] = after
        page = get("/v1/markets", **params)
        yield from page["markets"]
        after = page["next"]
        if not after:
            break

day = list(rounds("btc-updown-5m-", 1790553600, 1790640000))
up = sum(1 for m in day if m["resolution"] and m["resolution"]["winningOutcome"] == 0)
print(len(day), "rounds,", up, "went Up")
```

## 2. Every Wallet's Result in a Round

`/traders` folds each wallet's fills, splits, merges and redemptions into one row. Once the round has resolved, `totalPnl` is its settled PnL, fees included. Walk every wallet with `offset`:

```python Python theme={null}
def traders(condition_id):
    offset = 0
    while offset is not None:
        page = get(f"/v1/markets/{condition_id}/traders", limit=1000, offset=offset)
        yield from page["traders"]
        offset = page["next"]

for t in traders(day[0]["conditionId"]):
    print(t["wallet"], t["totalPnl"])
```

## 3. Fills with Wallets, 100 Rounds at a Time

Rows are `[market, ts, block, logIndex, outcome, side, shares, usd, exchange, isTaker, fee, wallet, tx]`: `market` is the round's place in your list, and shares and usd are micro-units. A window spans at most 7 days, so start it a little before the first round opens for trading.

```python Python theme={null}
def fills(markets):
    ids = [m["conditionId"] for m in markets]
    start = min(m["endDate"] for m in markets) - 86400
    end = max(m["endDate"] for m in markets) + 1
    after = None
    while True:
        params = {"markets": ",".join(ids), "from": start, "to": end, "limit": 50000, "include": "wallet,tx"}
        if after:
            params["after"] = after
        page = get("/v1/fills", **params)
        for row in page["fills"]:
            yield markets[row[0]], row
        after = page["next"]
        if not after:
            break

for i in range(0, len(day), 100):
    for market, (_, ts, _, _, outcome, side, shares, usd, _, is_taker, fee, wallet, tx) in fills(day[i : i + 100]):
        if is_taker and shares:
            print(market["slug"], wallet, "BUY" if side == 0 else "SELL", "Up" if outcome == 0 else "Down", shares / 1e6, usd / shares)
```

<Tip>
  A day of BTC 5-minute rounds is 288 markets: three `/v1/fills` walks rather than one walk per round.
</Tip>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.