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

> ## Agent Instructions
> To integrate AGG, start with Quickstart: REST (https://docs.agg.market/quickstart/rest), then Order lifecycle & statuses (https://docs.agg.market/concepts/order-lifecycle).
> Track every trade until it reaches a terminal status. Before retrying a failed or timed-out call, read Errors, retries & idempotency (https://docs.agg.market/concepts/errors).
> The API reference is generated from https://docs.agg.market/openapi/openapi.json.

# Trader leaderboard series

> One user's leaderboard stats per UTC day — orders, volume, spent and realizedPnl, plus a running cumulativeRealizedPnl — oldest first, ready to chart in one call. Pass exactly one of userId, externalId, username or walletAddress (username and walletAddress follow the app's leaderboardIdentity setting, as on /leaderboard). Defaults to the last 30 days ending today; at most 366 days; a `to` after today is clamped to today. Every day in the range is returned, days without activity as 0. cumulativeRealizedPnl starts from 0 at `from`. Each day's fields match /leaderboard for that one-day range exactly. realizedPnl is gross, position-level realized P&L in USD (sells against average entry on the order's creation day, settlement payout against entry on the settlement day), excluding venue and app fees. Unrealized P&L on open positions is not included. Positions with an unknown cost basis contribute 0. P&L is complete from the leaderboard deploy date; earlier settled positions carry their lifetime P&L on their redemption day. Data refreshes every 5 minutes.



## OpenAPI

````yaml /openapi/openapi.json get /leaderboard/series
openapi: 3.0.2
info:
  title: AGG API
  version: 1.0.0
  description: >-
    Prediction market aggregator REST API — authentication, users, venue events,
    venue markets, orderbooks, charts, and execution workflows.
servers:
  - url: https://api.agg.market
    description: Production
security: []
tags:
  - name: Authentication
    description: Sign users in and manage their session tokens.
  - name: Markets
    description: Find events, markets and outcomes to trade.
  - name: Market Data
    description: Live orderbooks, prices, charts and scores for those markets.
  - name: Trading
    description: Quote, place, sign, track and cancel orders.
  - name: Portfolio
    description: A user's orders, positions, balances and activity.
  - name: Funding
    description: Deposit addresses, withdrawals, balance refills and fiat on-ramp.
  - name: Users
    description: The signed-in user's profile, linked accounts, KYC and venue keys.
  - name: Hosted Venue Accounts
    description: Provision, fund and withdraw from venue accounts hosted for the user.
  - name: Webhooks
    description: Configure and operate webhook delivery to your server.
  - name: Partner Admin
    description: Server-side reads across your app's users, orders and analytics.
  - name: Paper Trading
    description: Simulated accounts and orders for testing without real funds.
  - name: News
    description: News feeds linked to markets.
  - name: Correlated Markets
    description: Markets related to a given market and the effect of its resolution.
paths:
  /leaderboard/series:
    get:
      tags:
        - Portfolio
      summary: Trader leaderboard series
      description: >-
        One user's leaderboard stats per UTC day — orders, volume, spent and
        realizedPnl, plus a running cumulativeRealizedPnl — oldest first, ready
        to chart in one call. Pass exactly one of userId, externalId, username
        or walletAddress (username and walletAddress follow the app's
        leaderboardIdentity setting, as on /leaderboard). Defaults to the last
        30 days ending today; at most 366 days; a `to` after today is clamped to
        today. Every day in the range is returned, days without activity as 0.
        cumulativeRealizedPnl starts from 0 at `from`. Each day's fields match
        /leaderboard for that one-day range exactly. realizedPnl is gross,
        position-level realized P&L in USD (sells against average entry on the
        order's creation day, settlement payout against entry on the settlement
        day), excluding venue and app fees. Unrealized P&L on open positions is
        not included. Positions with an unknown cost basis contribute 0. P&L is
        complete from the leaderboard deploy date; earlier settled positions
        carry their lifetime P&L on their redemption day. Data refreshes every 5
        minutes.
      operationId: getLeaderboardSeries
      parameters:
        - name: from
          in: query
          required: false
          schema:
            pattern: ^\d{4}-\d{2}-\d{2}$
            description: UTC calendar day, inclusive
            type: string
        - name: to
          in: query
          required: false
          schema:
            pattern: ^\d{4}-\d{2}-\d{2}$
            description: UTC calendar day, inclusive
            type: string
        - name: userId
          in: query
          required: false
          schema:
            minLength: 1
            type: string
        - name: externalId
          in: query
          required: false
          schema:
            minLength: 1
            type: string
        - name: username
          in: query
          required: false
          schema:
            minLength: 1
            type: string
        - name: walletAddress
          in: query
          required: false
          schema:
            minLength: 1
            type: string
      responses:
        '200':
          description: '200'
          content:
            application/json:
              schema:
                type: object
                required:
                  - userId
                  - from
                  - to
                  - points
                properties:
                  userId:
                    description: AGG user id.
                    type: string
                  from:
                    description: First day of the series (UTC, inclusive).
                    type: string
                  to:
                    description: >-
                      Last day of the series (UTC, inclusive); never after
                      today.
                    type: string
                  points:
                    maxItems: 366
                    description: >-
                      One point per UTC day in [from, to], oldest first. Days
                      without activity are 0.
                    type: array
                    items:
                      type: object
                      required:
                        - day
                        - orders
                        - volume
                        - spent
                        - realizedPnl
                        - cumulativeRealizedPnl
                      properties:
                        day:
                          pattern: ^\d{4}-\d{2}-\d{2}$
                          description: UTC calendar day.
                          type: string
                        orders:
                          description: Filled orders on this day.
                          type: integer
                        volume:
                          description: >-
                            Notional of every filled order on this day, buys and
                            sells. USD, as a float.
                          type: number
                        spent:
                          description: Notional of filled buy orders only. USD, as a float.
                          type: number
                        realizedPnl:
                          description: >-
                            Realized profit or loss booked on this day, before
                            venue and app fees. USD, as a float.
                          type: number
                        cumulativeRealizedPnl:
                          description: >-
                            Running total of realizedPnl from `from` through
                            this day. USD, as a float.
                          type: number
        '400':
          description: '400'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '401':
          description: '401'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '403':
          description: '403'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '404':
          description: '404'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
        '429':
          description: '429'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateLimitError'
          headers:
            Retry-After:
              schema:
                pattern: ^[1-9][0-9]*$
                description: Seconds to wait before another request; do not retry earlier.
                type: string
            Cache-Control:
              schema:
                type: string
                enum:
                  - private, no-store
      security:
        - appId: []
components:
  schemas:
    ErrorMessage:
      type: object
      required:
        - message
      properties:
        message:
          type: string
    RateLimitError:
      type: object
      required:
        - message
      properties:
        message:
          type: string
        statusCode:
          type: number
          enum:
            - 429
        code:
          type: string
          enum:
            - rate_limited
        retryAfter:
          minimum: 1
          description: Retry delay in seconds.
          type: integer
  securitySchemes:
    appId:
      type: apiKey
      in: header
      name: x-app-id
      description: Your application ID. Required for all app-tier and user-tier routes.

````

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