{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/aspern-org/json-schema/aspern-org-trading-data-schema.json",
  "title": "TradingData",
  "description": "Observed, not designed. This shape was derived by calling the operation and recording what came back, and it is re-derived and compared on every deploy. Types are what was seen. Fields listed under `required` are the ones this API commits to returning, declared by hand rather than inferred — everything else is what was observed, and an absent measurement is a real answer here rather than a fault. Required means present, never non-null.",
  "x-generated": "2026-11-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/aspern-org-openapi.json#/components/schemas/TradingData",
  "type": "object",
  "required": [
    "data",
    "meta",
    "warnings"
  ],
  "properties": {
    "data": {
      "type": "object",
      "properties": {
        "note": {
          "type": "string"
        },
        "gmx": {
          "type": "object",
          "properties": {
            "at": {
              "type": "string"
            },
            "chains": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "chain": {
                    "type": "string"
                  },
                  "markets": {
                    "type": "number"
                  },
                  "listed": {
                    "type": "number"
                  },
                  "openInterestUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "liquidityUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "longUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "shortUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  }
                }
              }
            },
            "unreachable": {
              "type": "array"
            },
            "complete": {
              "type": "boolean"
            },
            "openInterestUsd": {
              "type": "number",
              "x-unit": "usd"
            },
            "liquidityUsd": {
              "type": "number",
              "x-unit": "usd"
            },
            "utilisation": {
              "type": "number",
              "x-unit": "decimal-fraction"
            },
            "longUsd": {
              "type": "number",
              "x-unit": "usd"
            },
            "shortUsd": {
              "type": "number",
              "x-unit": "usd"
            },
            "markets": {
              "type": "number"
            },
            "top": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "chain": {
                    "type": "string"
                  },
                  "name": {
                    "type": "string"
                  },
                  "oiUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "longUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "shortUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "liquidityUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  }
                }
              }
            },
            "assetClass": {
              "type": "string"
            },
            "note": {
              "type": "string"
            }
          }
        },
        "gmxAccounts": {
          "type": "object",
          "properties": {
            "at": {
              "type": "string"
            },
            "chains": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "chain": {
                    "type": "string"
                  },
                  "positions": {
                    "type": "number",
                    "x-unit": "count"
                  },
                  "accounts": {
                    "type": "number"
                  },
                  "sizeUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "collateralUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "unpricedCollateral": {
                    "type": "number"
                  },
                  "unrealizedPnlUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  }
                }
              }
            },
            "unreachable": {
              "type": "array"
            },
            "complete": {
              "type": "boolean"
            },
            "positions": {
              "type": "number",
              "x-unit": "count"
            },
            "accounts": {
              "type": "number"
            },
            "sizeUsd": {
              "type": "number",
              "x-unit": "usd"
            },
            "collateralUsd": {
              "type": "number",
              "x-unit": "usd"
            },
            "unrealizedPnlUsd": {
              "type": "number",
              "x-unit": "usd"
            },
            "venueLeverage": {
              "type": "number"
            },
            "leverageBands": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "band": {
                    "type": "string"
                  },
                  "count": {
                    "type": "number",
                    "x-unit": "count"
                  }
                }
              }
            },
            "leverage": {
              "type": "object",
              "properties": {
                "median": {
                  "type": "number"
                },
                "p90": {
                  "type": "number"
                },
                "max": {
                  "type": "number"
                },
                "over10x": {
                  "type": "number"
                },
                "over25x": {
                  "type": "number"
                },
                "measured": {
                  "type": "number",
                  "x-unit": "count"
                }
              }
            },
            "thinnest": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "chain": {
                    "type": "string"
                  },
                  "market": {
                    "type": "string"
                  },
                  "sizeUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "equityUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "buffer": {
                    "type": "number"
                  }
                }
              }
            },
            "thinnestFloorUsd": {
              "type": "number",
              "x-unit": "usd"
            },
            "attributable": {
              "type": "object",
              "properties": {
                "addressesHeld": {
                  "type": "number",
                  "x-unit": "count"
                },
                "matched": {
                  "type": "number"
                },
                "positions": {
                  "type": "number",
                  "x-unit": "count"
                },
                "sizeUsd": {
                  "type": "number",
                  "x-unit": "usd"
                },
                "rows": {
                  "type": "array"
                }
              }
            },
            "leverageFieldCheck": {
              "type": "object",
              "properties": {
                "checked": {
                  "type": "number"
                },
                "within25pct": {
                  "type": "number",
                  "x-unit": "decimal-fraction"
                },
                "ratioMedian": {
                  "type": "number",
                  "x-unit": "decimal-fraction"
                },
                "ratioP10": {
                  "type": "number",
                  "x-unit": "decimal-fraction"
                },
                "ratioP90": {
                  "type": "number",
                  "x-unit": "decimal-fraction"
                },
                "reading": {
                  "type": "string"
                }
              }
            },
            "basis": {
              "type": "string"
            },
            "method": {
              "type": "string"
            },
            "caveat": {
              "type": "string"
            },
            "withheld": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "agentCredit": {
          "type": "object",
          "properties": {
            "at": {
              "type": "string"
            },
            "protocol": {
              "type": "string"
            },
            "chains": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "chain": {
                    "type": "string"
                  },
                  "addresses": {
                    "type": "number",
                    "x-unit": "count"
                  },
                  "asked": {
                    "type": "number"
                  },
                  "withPosition": {
                    "type": "number"
                  },
                  "collateralUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "debtUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "headroomUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "baseUnit": {
                    "type": "string"
                  },
                  "unread": {
                    "type": "boolean"
                  }
                }
              }
            },
            "unread": {
              "type": "array"
            },
            "complete": {
              "type": "boolean"
            },
            "addresses": {
              "type": "number",
              "x-unit": "count"
            },
            "asked": {
              "type": "number"
            },
            "withPosition": {
              "type": "number"
            },
            "collateralUsd": {
              "type": "number",
              "x-unit": "usd"
            },
            "debtUsd": {
              "type": "number",
              "x-unit": "usd"
            },
            "headroomUsd": {
              "type": "number",
              "x-unit": "usd"
            },
            "utilisation": {
              "type": "number",
              "x-unit": "decimal-fraction"
            },
            "withDebt": {
              "type": "number"
            },
            "belowTwo": {
              "type": "number"
            },
            "belowOnePointTwo": {
              "type": "number"
            },
            "riskiest": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "string"
                  },
                  "chain": {
                    "type": "string"
                  },
                  "collateralUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "debtUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "headroomUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "ltv": {
                    "type": "number"
                  },
                  "liquidationThreshold": {
                    "type": "number"
                  },
                  "healthFactor": {
                    "type": "number"
                  }
                }
              }
            },
            "largest": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "string"
                  },
                  "chain": {
                    "type": "string"
                  },
                  "collateralUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "debtUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "headroomUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "ltv": {
                    "type": "number"
                  },
                  "liquidationThreshold": {
                    "type": "number"
                  },
                  "healthFactor": {
                    "type": [
                      "null",
                      "number"
                    ]
                  }
                }
              }
            },
            "positions": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "string"
                  },
                  "chain": {
                    "type": "string"
                  },
                  "collateralUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "debtUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "headroomUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "ltv": {
                    "type": "number"
                  },
                  "liquidationThreshold": {
                    "type": "number"
                  },
                  "healthFactor": {
                    "type": [
                      "null",
                      "number"
                    ]
                  }
                }
              }
            },
            "method": {
              "type": "string"
            },
            "caveat": {
              "type": "string"
            },
            "protocols": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string"
                  },
                  "basis": {
                    "type": "string"
                  },
                  "asked": {
                    "type": "number"
                  },
                  "positions": {
                    "type": "number",
                    "x-unit": "count"
                  },
                  "collateralUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "debtUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  },
                  "complete": {
                    "type": "boolean"
                  }
                }
              }
            },
            "notRead": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "euler": {
              "type": "object",
              "properties": {
                "asked": {
                  "type": "number"
                },
                "positions": {
                  "type": "number",
                  "x-unit": "count"
                },
                "addresses": {
                  "type": "number",
                  "x-unit": "count"
                },
                "complete": {
                  "type": "boolean"
                },
                "pricedUsd": {
                  "description": "Observed only as null so far; the type it carries when present has not been recorded. Null means unavailable or not measured, never zero. Observed only as null so far; the type it carries when present has not been recorded. Null means unavailable or not measured, never zero. Observed only as null so far; the type it carries when present has not been recorded. Null means unavailable or not measured, never zero. Observed only as null so far; the type it carries when present has not been recorded. Null means unavailable or not measured, never zero. Observed only as null so far; the type it carries when present has not been recorded. Null means unavailable or not measured, never zero. Observed only as null so far; the type it carries when present has not been recorded. Null means unavailable or not measured, never zero. Observed only as null so far; the type it carries when present has not been recorded. Null means unavailable or not measured, never zero. Observed only as null so far; the type it carries when present has not been recorded. Null means unavailable or not measured, never zero."
                },
                "borrowersKnown": {
                  "type": "number"
                },
                "oursAmongThem": {
                  "type": "number"
                },
                "zeroMeans": {
                  "type": "string"
                },
                "why": {
                  "type": "string"
                },
                "rows": {
                  "type": "array"
                }
              }
            },
            "compound": {
              "type": "object",
              "properties": {
                "markets": {
                  "type": "number"
                },
                "asked": {
                  "type": "number"
                },
                "positions": {
                  "type": "number",
                  "x-unit": "count"
                },
                "addresses": {
                  "type": "number",
                  "x-unit": "count"
                },
                "debtUsd": {
                  "type": "number",
                  "x-unit": "usd"
                },
                "complete": {
                  "type": "boolean"
                },
                "rows": {
                  "type": "array"
                }
              }
            },
            "morpho": {
              "type": "object",
              "properties": {
                "positions": {
                  "type": "number",
                  "x-unit": "count"
                },
                "addresses": {
                  "type": "number",
                  "x-unit": "count"
                },
                "collateralUsd": {
                  "type": "number",
                  "x-unit": "usd"
                },
                "debtUsd": {
                  "type": "number",
                  "x-unit": "usd"
                },
                "suppliedUsd": {
                  "type": "number",
                  "x-unit": "usd"
                },
                "complete": {
                  "type": "boolean"
                },
                "batchesFailed": {
                  "type": "number"
                },
                "addressesAsked": {
                  "type": "number"
                },
                "addressesHeld": {
                  "type": "number",
                  "x-unit": "count"
                },
                "rows": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "address": {
                        "type": "string"
                      },
                      "chain": {
                        "type": "string"
                      },
                      "market": {
                        "type": "string"
                      },
                      "collateralUsd": {
                        "type": "number",
                        "x-unit": "usd"
                      },
                      "debtUsd": {
                        "type": "number",
                        "x-unit": "usd"
                      },
                      "suppliedUsd": {
                        "type": "number",
                        "x-unit": "usd"
                      },
                      "healthFactor": {
                        "type": [
                          "null",
                          "number"
                        ]
                      }
                    }
                  }
                }
              }
            },
            "withheld": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "calibration": {
          "type": "object",
          "properties": {
            "at": {
              "type": "string"
            },
            "wallets": {
              "type": "number"
            },
            "walletsAsked": {
              "type": "number"
            },
            "trades": {
              "type": "number"
            },
            "buys": {
              "type": "number"
            },
            "scored": {
              "type": "number"
            },
            "unresolvedMarket": {
              "type": "number"
            },
            "unknownToken": {
              "type": "number"
            },
            "marketsLookedUp": {
              "type": "number"
            },
            "brier": {
              "type": "number"
            },
            "baseline": {
              "type": "number"
            },
            "baselineMeans": {
              "type": "string"
            },
            "hitRate": {
              "type": "number",
              "x-unit": "decimal-fraction"
            },
            "meanForecast": {
              "type": "number"
            },
            "bands": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "number",
                    "x-unit": "timestamp"
                  },
                  "to": {
                    "type": "number",
                    "x-unit": "timestamp"
                  },
                  "forecasts": {
                    "type": "number"
                  },
                  "meanForecast": {
                    "type": "number"
                  },
                  "happened": {
                    "type": "number"
                  }
                }
              }
            },
            "byAddress": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "string"
                  },
                  "forecasts": {
                    "type": "number"
                  },
                  "brier": {
                    "type": "number"
                  },
                  "hitRate": {
                    "type": "number",
                    "x-unit": "decimal-fraction"
                  },
                  "meanForecast": {
                    "type": "number"
                  },
                  "stakedUsd": {
                    "type": "number",
                    "x-unit": "usd"
                  }
                }
              }
            },
            "basis": {
              "type": "string"
            },
            "method": {
              "type": "string"
            },
            "caveat": {
              "type": "string"
            },
            "edge": {
              "type": "object",
              "properties": {
                "outcomes": {
                  "type": "number"
                },
                "markets": {
                  "type": "number"
                },
                "meanPrice": {
                  "type": "number"
                },
                "happened": {
                  "type": "number"
                },
                "excess": {
                  "type": "number"
                },
                "z": {
                  "type": "number"
                }
              }
            }
          }
        }
      }
    },
    "meta": {
      "$ref": "#/$defs/Meta"
    },
    "warnings": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Warning"
      }
    }
  },
  "$defs": {
    "Meta": {
      "type": "object",
      "required": [
        "requestId",
        "snapshotId",
        "servedAt",
        "methodologyVersion",
        "coverage"
      ],
      "properties": {
        "requestId": {
          "type": "string",
          "description": "Also the X-Request-Id header."
        },
        "environment": {
          "type": "string",
          "description": "production, staging or development. Also the X-ASPERN-Environment header and info.x-aspern-environment in the OpenAPI document, so a client can tell which contract answered."
        },
        "build": {
          "type": [
            "string",
            "null"
          ],
          "description": "The deploy that served this. Also the X-ASPERN-Build header."
        },
        "snapshotId": {
          "type": "string",
          "description": "Which state of our data answered. Two responses with the same snapshotId saw the same completed ingest runs — so a figure that differs between two surfaces under the SAME snapshot is a defect, and under different ones is a clock."
        },
        "observedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "When the source was observed."
        },
        "computedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "When we computed this from it."
        },
        "servedAt": {
          "type": "string",
          "format": "date-time",
          "description": "When this response was built."
        },
        "methodologyVersion": {
          "type": "string",
          "description": "What the figures mean. Changes are listed at /changelog."
        },
        "source": {
          "type": [
            "string",
            "null"
          ]
        },
        "chainId": {
          "type": [
            "integer",
            "null"
          ],
          "x-unit": "chain-id"
        },
        "blockNumber": {
          "type": [
            "integer",
            "null"
          ],
          "x-unit": "block-number"
        },
        "coverage": {
          "type": "object",
          "properties": {
            "scope": {
              "type": [
                "string",
                "null"
              ],
              "description": "What this covers and, explicitly, what it does not."
            },
            "population": {
              "type": [
                "string",
                "null"
              ],
              "description": "The population these figures were measured over, as a key you can join on rather than a sentence you have to read. Every key is declared once and resolves to a definition at /reconciliation#<key>, where the ones that narrow show every row that falls out and why. The same key appears beside the figure on the website, so an integrator and a reader are talking about one population rather than two descriptions of it. Null only when `populationAbsence` says why."
            },
            "populationAbsence": {
              "type": [
                "string",
                "null"
              ],
              "description": "Why there is no single population, where there is none. A lookup of one address measures nothing; a document carrying several rails in units that are never summed carries several populations. A null population with nothing here would be an absence you could not tell from an oversight, which is the defect this field exists to close."
            },
            "knownExclusions": {
              "type": [
                "array",
                "null"
              ],
              "items": {
                "type": "string"
              },
              "description": "THREE VALUES. A list is what this route deliberately leaves out. `[]` is a CLAIM that nothing is excluded. `null` is “we have not said”, which is our gap and must never be read as the second. It was hardcoded to `[]` on every route until 2026-09-27, so every response claimed to exclude nothing while its own `scope` sentence named exclusions."
            }
          }
        },
        "confidence": {
          "type": [
            "object",
            "null"
          ],
          "description": "Never a bare number; it names what it is a confidence in."
        },
        "freshness": {
          "anyOf": [
            {
              "type": "object",
              "required": [
                "oldestObservedAt",
                "newestObservedAt",
                "readings",
                "fields",
                "complete",
                "state",
                "newestAgeHours"
              ],
              "description": "When the readings behind this answer were taken, where they differ. A page of a hundred vaults read over four hours has no single observation time — `observedAt` is filled in only where every reading agrees, and this reports the spread otherwise.",
              "properties": {
                "oldestObservedAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "newestObservedAt": {
                  "type": "string",
                  "format": "date-time"
                },
                "readings": {
                  "type": "integer",
                  "minimum": 1,
                  "description": "How many readings the range was taken over.",
                  "x-unit": "count"
                },
                "fields": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "The fields it was read from, so a caller can go and check any of them directly."
                },
                "complete": {
                  "type": "boolean",
                  "description": "Whether every reading in the payload was seen. False means the range is a LOWER BOUND — the true spread is at least this wide and may be wider — because a partial walk always returns the narrower range, which would read as fresher and more uniform than the data is."
                },
                "state": {
                  "enum": [
                    "fresh",
                    "mixed",
                    "stale"
                  ],
                  "description": "`stale` when the NEWEST reading is more than 26 hours old at the moment the response was built — every reader runs at least daily, so that means a reader has stopped. `mixed` when the newest is inside that window and the OLDEST is not: parts of this answer are current and parts are not, which is the usual shape of a document joining several sources. It was summarised as `fresh` until 2026-10-10, computed from the newest reading alone, so one current field hid a catalogue two months old. A source that could not be read is not a state here: it is a check that could not run (`/v1/checks`) or an analysis whose `availability` says so, and never a zero."
                },
                "newestAgeHours": {
                  "type": "number",
                  "minimum": 0,
                  "description": "Hours between the newest reading and the moment this response was built, to one decimal.",
                  "x-unit": "hours"
                },
                "oldestAgeHours": {
                  "type": "number",
                  "minimum": 0,
                  "description": "The same for the OLDEST reading. The other end of the spread as a number, because a caller comparing two ISO strings to find out whether part of an answer is two months old will mostly not bother.",
                  "x-unit": "hours"
                }
              }
            },
            {
              "type": "object",
              "required": [
                "reason",
                "state",
                "says",
                "readings"
              ],
              "description": "No range, and which of the two reasons it is.",
              "properties": {
                "reason": {
                  "enum": [
                    "not-applicable",
                    "no-dated-field"
                  ],
                  "description": "`not-applicable` is reference material: a plan, a capability list, a schema. Nothing in it was read from anywhere at a time. `no-dated-field` means the response carries data and nothing in it names when that data was read, which is a gap in that endpoint."
                },
                "state": {
                  "enum": [
                    "not_applicable",
                    "not_measured"
                  ],
                  "description": "The reason in the vocabulary shared with `fresh`/`stale`: `not-applicable` is `not_applicable`, `no-dated-field` is `not_measured`."
                },
                "says": {
                  "type": "string",
                  "description": "The same thing in a sentence."
                },
                "readings": {
                  "const": 0
                }
              }
            }
          ]
        },
        "pagination": {
          "anyOf": [
            {
              "$ref": "#/$defs/Page"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "Page": {
      "type": "object",
      "required": [
        "total",
        "limit",
        "offset",
        "hasMore"
      ],
      "properties": {
        "total": {
          "type": "integer",
          "minimum": 0,
          "description": "Rows matching the filter, not rows returned.",
          "x-unit": "count"
        },
        "limit": {
          "type": "integer",
          "minimum": 0,
          "description": "Applied page size. May be below what was asked — X-Page-Limit says so when it is.",
          "x-unit": "count"
        },
        "offset": {
          "type": "integer",
          "minimum": 0,
          "x-unit": "count"
        },
        "hasMore": {
          "type": "boolean"
        },
        "nextOffset": {
          "type": [
            "integer",
            "null"
          ],
          "description": "Null on the last page.",
          "x-unit": "count"
        },
        "orderedBy": {
          "type": "string",
          "description": "The sort, including its tie-breaker. The order is total, so paging cannot show a row twice or skip one."
        }
      }
    },
    "Warning": {
      "type": "object",
      "required": [
        "code",
        "message"
      ],
      "properties": {
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    }
  }
}