{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://morpheusradar.com/dados/v1/schema/mercados-24h.schema.json",
  "title": "Morpheus Radar open data v1 · liquidations by market, rolling 24 hours",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "$schema",
    "schema_version",
    "dataset",
    "content",
    "window_start",
    "window_end",
    "generated_at",
    "min_delay_seconds",
    "license",
    "csv",
    "columns",
    "rows"
  ],
  "properties": {
    "$schema": {
      "const": "https://morpheusradar.com/dados/v1/schema/mercados-24h.schema.json"
    },
    "schema_version": {
      "type": "string",
      "pattern": "^1\\.[0-9]+$"
    },
    "dataset": {
      "type": "string"
    },
    "content": {
      "const": "markets"
    },
    "window_start": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "window_end": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "generated_at": {
      "type": "string",
      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}Z$"
    },
    "min_delay_seconds": {
      "type": "integer",
      "minimum": 3600
    },
    "license": {
      "const": {
        "id": "CC-BY-4.0",
        "url": "https://creativecommons.org/licenses/by/4.0/",
        "attribution": "Source: Morpheus Radar (morpheusradar.com)"
      }
    },
    "csv": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "url",
        "bytes",
        "rows",
        "sha256"
      ],
      "properties": {
        "url": {
          "type": "string",
          "pattern": "^/dados/v1/.+\\.csv$"
        },
        "bytes": {
          "type": "integer",
          "minimum": 1
        },
        "rows": {
          "type": "integer",
          "minimum": 0
        },
        "sha256": {
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      }
    },
    "columns": {
      "const": [
        "protocol",
        "chain",
        "market_id",
        "market_name",
        "loan_token",
        "liquidations",
        "transactions",
        "repaid",
        "repaid_usd",
        "gross_bonus_usd",
        "auction_transactions",
        "auction_gross_bonus_usd",
        "top_liquidators"
      ]
    },
    "rows": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "protocol",
          "chain",
          "market_id",
          "market_name",
          "loan_token",
          "liquidations",
          "transactions",
          "repaid",
          "repaid_usd",
          "gross_bonus_usd",
          "auction_transactions",
          "auction_gross_bonus_usd",
          "top_liquidators"
        ],
        "properties": {
          "protocol": {
            "description": "Lending protocol.",
            "type": "string"
          },
          "chain": {
            "description": "Network.",
            "type": "string"
          },
          "market_id": {
            "description": "Morpho market ID.",
            "type": "string",
            "pattern": "^0x[0-9a-f]{64}$"
          },
          "market_name": {
            "description": "Collateral / loan pair, for easier reading.",
            "type": [
              "string",
              "null"
            ]
          },
          "loan_token": {
            "description": "Address of the loan token.",
            "type": "string",
            "pattern": "^0x[0-9a-f]{40}$"
          },
          "liquidations": {
            "description": "Number of Liquidate events.",
            "type": "integer",
            "minimum": 0
          },
          "transactions": {
            "description": "Number of distinct transactions.",
            "type": "integer",
            "minimum": 0
          },
          "repaid": {
            "description": "Debt repaid, in loan-token units (decimals applied).",
            "type": [
              "string",
              "null"
            ],
            "pattern": "^[0-9]+(\\.[0-9]+)?$"
          },
          "repaid_usd": {
            "description": "Debt repaid in USD. USDC loans only.",
            "type": [
              "number",
              "null"
            ]
          },
          "gross_bonus_usd": {
            "description": "Gross liquidation bonus in USD. USDC loans only. Not profit.",
            "type": [
              "number",
              "null"
            ]
          },
          "auction_transactions": {
            "description": "Transactions that went through an Atlas auction.",
            "type": "integer",
            "minimum": 0
          },
          "auction_gross_bonus_usd": {
            "description": "Gross bonus in USD of those transactions. USDC loans only. Not profit.",
            "type": [
              "number",
              "null"
            ]
          },
          "top_liquidators": {
            "description": "Up to three addresses with the most liquidations in the market, with counts. Unlabeled.",
            "type": "array",
            "maxItems": 3,
            "items": {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "address",
                "liquidations"
              ],
              "properties": {
                "address": {
                  "type": "string",
                  "pattern": "^0x[0-9a-f]{40}$"
                },
                "liquidations": {
                  "type": "integer",
                  "minimum": 1
                }
              }
            }
          }
        },
        "if": {
          "properties": {
            "loan_token": {
              "not": {
                "const": "0x833589fcd6edb6e08f4c7c32d4f71b54bda02913"
              }
            }
          },
          "required": [
            "loan_token"
          ]
        },
        "then": {
          "properties": {
            "repaid_usd": {
              "type": "null"
            },
            "gross_bonus_usd": {
              "type": "null"
            },
            "auction_gross_bonus_usd": {
              "type": "null"
            }
          }
        }
      }
    }
  }
}
