{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/pmwallets-com/json-schema/pmwallets-com-leaderboard-schema.json",
  "title": "Leaderboard",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/pmwallets-com-openapi.json#/components/schemas/Leaderboard",
  "type": "object",
  "properties": {
    "periodId": {
      "type": "string"
    },
    "tier": {
      "type": "string",
      "enum": [
        "anon",
        "free",
        "subscriber"
      ],
      "description": "anon = no valid key; subscriber = an active push subscription or active plan."
    },
    "plan": {
      "$ref": "#/$defs/PlanUsage"
    },
    "sampled": {
      "type": "boolean",
      "description": "true for the anonymous 20-row sample."
    },
    "filters": {
      "type": "object",
      "additionalProperties": true,
      "description": "The filters actually applied."
    },
    "sort": {
      "type": "string",
      "enum": [
        "realizedPnl",
        "roiOnBuys",
        "eligible",
        "winsLosses",
        "nFills",
        "conditions",
        "grossBuyUsdc",
        "unrealizedPnl",
        "winLo",
        "fillsPerDay",
        "lastFill"
      ]
    },
    "dir": {
      "type": "string",
      "enum": [
        "asc",
        "desc"
      ]
    },
    "sorts": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "historyFrom": {
      "type": [
        "string",
        "null"
      ],
      "description": "First UTC day of the ledger behind this window."
    },
    "refresh": {
      "type": "object",
      "properties": {
        "everyBlocks": {
          "type": "integer"
        },
        "maxIdleMin": {
          "type": "integer"
        },
        "blockSec": {
          "type": "number"
        }
      }
    },
    "pricing": {
      "type": "object",
      "properties": {
        "revealCents": {
          "type": "integer",
          "description": "Price of the cheapest paid band."
        },
        "subscriptionCentsPerHour": {
          "type": "integer"
        },
        "bands": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "band": {
                "type": "integer"
              },
              "from": {
                "type": [
                  "number",
                  "null"
                ],
                "description": "pnlExTop where the band starts; null = no floor."
              },
              "cents": {
                "type": "integer"
              }
            }
          }
        }
      }
    },
    "limits": {
      "type": "object",
      "properties": {
        "maxRows": {
          "type": "integer"
        },
        "maxOffset": {
          "type": "integer"
        },
        "capped": {
          "type": "boolean",
          "description": "limit/offset were reduced to the tier maximum."
        },
        "dailyRows": {
          "type": "integer"
        },
        "usedToday": {
          "type": "integer"
        }
      }
    },
    "tracked": {
      "type": "integer",
      "description": "Entities in the window (independent of filters). With mine=1: how many addresses you have unlocked."
    },
    "rows": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/LeaderboardRow"
      }
    },
    "outside": {
      "type": "array",
      "description": "mine=1, first page only: your unlocked addresses with no fill in this window.",
      "items": {
        "type": "object",
        "properties": {
          "entityId": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "revealed": {
            "type": "boolean"
          },
          "subscribed": {
            "type": "boolean"
          },
          "unlockedBy": {
            "type": [
              "string",
              "null"
            ]
          },
          "pausedReason": {
            "type": "string"
          }
        }
      }
    }
  },
  "$defs": {
    "Activity": {
      "type": "object",
      "properties": {
        "nFills": {
          "type": "integer"
        },
        "firstFillTs": {
          "type": [
            "string",
            "null"
          ]
        },
        "lastFillTs": {
          "type": [
            "string",
            "null"
          ]
        },
        "lastFillBlock": {
          "type": "integer"
        },
        "activeDays": {
          "type": "integer"
        },
        "fills24h": {
          "type": "integer"
        },
        "fills7d": {
          "type": "integer"
        },
        "windowEndTs": {
          "type": [
            "string",
            "null"
          ]
        },
        "makerFills": {
          "type": [
            "number",
            "null"
          ]
        },
        "makerUsdc": {
          "type": [
            "number",
            "null"
          ]
        },
        "usdc": {
          "type": [
            "number",
            "null"
          ]
        }
      }
    },
    "LeaderboardRow": {
      "type": "object",
      "properties": {
        "entityId": {
          "type": "string",
          "description": "Handle until you hold the address, then the 0x address. Pass it back to other endpoints as-is."
        },
        "label": {
          "type": "string",
          "description": "Masked address (0x4b96…984e) until you hold it, then the full address."
        },
        "revealed": {
          "type": "boolean",
          "description": "You hold the address (paid unlock, a still-free free unlock, or an active plan unlock)."
        },
        "revealCents": {
          "type": "integer",
          "description": "What unlocking this address costs now (0 = free band). Absent when not for sale (prices not published for the window)."
        },
        "subscribed": {
          "type": "boolean",
          "description": "You have an active push subscription to it."
        },
        "subscriptionId": {
          "type": "string",
          "description": "Present when subscribed."
        },
        "viaPlan": {
          "type": "boolean",
          "description": "Held only through your plan; masked again when the plan ends."
        },
        "unlockedBy": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "paid",
            "free",
            "plan",
            null
          ],
          "description": "mine=1 only: how you hold it; null = lapsed (masked again)."
        },
        "pausedReason": {
          "type": "string",
          "description": "mine=1 only: your subscription to it is paused for this reason."
        },
        "wallets": {
          "type": "integer",
          "description": "Addresses of the entity that traded in the window."
        },
        "conditions": {
          "type": "integer",
          "description": "Markets traded in the window."
        },
        "eligible": {
          "type": "integer",
          "description": "Settled markets counted (wins + losses + breakevens)."
        },
        "wins": {
          "type": "integer"
        },
        "losses": {
          "type": "integer"
        },
        "breakevens": {
          "type": "integer"
        },
        "excludedConditions": {
          "type": "integer"
        },
        "realizedPnl": {
          "type": "number",
          "description": "Dollars."
        },
        "unrealizedPnl": {
          "type": "number",
          "description": "Dollars."
        },
        "totalPnl": {
          "type": "number",
          "description": "Dollars."
        },
        "grossBuyUsdc": {
          "type": "number",
          "description": "Dollars spent buying in the window."
        },
        "feeUsdc": {
          "type": "number"
        },
        "roiOnBuys": {
          "type": "number",
          "description": "realizedPnl / grossBuyUsdc (0.2 = 20%)."
        },
        "nFills": {
          "type": "integer"
        },
        "pnlExTop": {
          "type": "number",
          "description": "Realised PnL minus its single best settled market; decides the price band."
        },
        "pricePnlExTop": {
          "type": [
            "number",
            "null"
          ]
        },
        "wr": {
          "type": [
            "number",
            "null"
          ]
        },
        "lo": {
          "type": [
            "number",
            "null"
          ]
        },
        "hi": {
          "type": [
            "number",
            "null"
          ]
        },
        "status": {
          "type": "string",
          "enum": [
            "active",
            "quiet",
            "dormant"
          ],
          "description": "Last fill <24h / <7d / older."
        },
        "statusAsOf": {
          "type": [
            "string",
            "null"
          ]
        },
        "style": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "maker",
            "taker",
            "two-sided",
            null
          ],
          "description": "By share of traded value made as maker (>=0.8 maker, <=0.2 taker)."
        },
        "makerShare": {
          "type": [
            "number",
            "null"
          ]
        },
        "categories": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "category": {
                "type": "string",
                "enum": [
                  "crypto-updown",
                  "crypto",
                  "esports",
                  "sports",
                  "politics",
                  "economy",
                  "geopolitics",
                  "science-tech",
                  "culture",
                  "other",
                  "unknown"
                ]
              },
              "share": {
                "type": "number"
              }
            }
          }
        },
        "activity": {
          "$ref": "#/$defs/Activity"
        },
        "dataSource": {
          "type": "string",
          "enum": [
            "live",
            "frozen"
          ]
        },
        "dataPeriodId": {
          "type": "string"
        },
        "dataAsOf": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    },
    "PlanUsage": {
      "type": "object",
      "description": "The caller's plan and what is left of its unlock allowance (present when signed in).",
      "properties": {
        "state": {
          "type": "string",
          "enum": [
            "active",
            "grace",
            "none"
          ]
        },
        "tier": {
          "type": [
            "string",
            "null"
          ]
        },
        "graceUntil": {
          "type": [
            "string",
            "null"
          ]
        },
        "daily": {
          "type": "integer"
        },
        "dailyUsed": {
          "type": "integer"
        },
        "monthly": {
          "type": "integer"
        },
        "monthlyUsed": {
          "type": "integer"
        },
        "pushSlots": {
          "type": "integer"
        },
        "pushActive": {
          "type": "integer"
        }
      }
    }
  }
}