{
  "openapi": "3.1.0",
  "info": {
    "title": "PerpCity Bot API",
    "description": "Bot & AI Agent API for PerpCity market data (indexed reads).\n\nAuthenticate every request with an API key in the **X-API-Key** header. Keys are prefixed `pc_bot_` and can be self-issued via `POST /auth/keys` (Privy-authenticated). Requests are rate limited to 120 requests per minute per key; responses carry `X-RateLimit-Limit`, `X-RateLimit-Remaining`, and `X-RateLimit-Reset` headers, and a 429 includes `Retry-After`. The limit is shared across all API nodes.\n\nFull documentation: https://docs.perp.city/bot-api",
    "version": "2.1.0"
  },
  "paths": {
    "/v1/markets": {
      "get": {
        "tags": [
          "Markets (v1, frozen)"
        ],
        "summary": "List Markets",
        "operationId": "list_markets_v1_markets_get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 100,
              "title": "Limit"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "title": "Offset"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/app__schemas__common__PaginatedResponse_MarketResponse___1"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/markets/{market_id}": {
      "get": {
        "tags": [
          "Markets (v1, frozen)"
        ],
        "summary": "Get Market",
        "operationId": "get_market_v1_markets__market_id__get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "market_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Market Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/app__schemas__v1__markets__MarketDetailResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/markets/{market_id}/live": {
      "get": {
        "tags": [
          "Markets (v1, frozen)"
        ],
        "summary": "Get Live Market",
        "operationId": "get_live_market_v1_markets__market_id__live_get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "market_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Market Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/app__schemas__v1__markets__LiveMarketResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/positions": {
      "get": {
        "tags": [
          "Positions (v1, frozen)"
        ],
        "summary": "List Positions",
        "operationId": "list_positions_v1_positions_get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "wallet",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by wallet address (hex)",
              "title": "Wallet"
            },
            "description": "Filter by wallet address (hex)"
          },
          {
            "name": "market_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by market/perp ID (hex)",
              "title": "Market Id"
            },
            "description": "Filter by market/perp ID (hex)"
          },
          {
            "name": "is_open",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Is Open"
            }
          },
          {
            "name": "is_maker",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Is Maker"
            }
          },
          {
            "name": "is_long",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Is Long"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 100,
              "title": "Limit"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "title": "Offset"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/app__schemas__common__PaginatedResponse_PositionResponse___1"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/positions/liquidatable": {
      "get": {
        "tags": [
          "Positions (v1, frozen)"
        ],
        "summary": "List Liquidatable Positions",
        "description": "Indexed-only liquidatable-candidate filter (NO on-chain eth_call).\n\nReturns a PERMISSIVE candidate set computed purely from indexed Goldsky data,\nplus the execution params a liquidation bot needs (`amount`, `is_maker`,\n`perp`, `id`). The bot-api is a public surface and must never fan out to the\nRPC per request; exactness is the bot's job -- it confirms each candidate\ngas-free (simulate before send) before spending gas. A row here is \"worth\nchecking\", not \"guaranteed liquidatable\".",
        "operationId": "list_liquidatable_positions_v1_positions_liquidatable_get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "market_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by market/perp ID (hex)",
              "title": "Market Id"
            },
            "description": "Filter by market/perp ID (hex)"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 100,
              "title": "Limit"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "title": "Offset"
            }
          },
          {
            "name": "listed_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Listed Only",
              "description": "Drop positions on markets the app no longer lists (no market_metadata row). With no metadata available, nothing is dropped."
            },
            "description": "Drop positions on markets the app no longer lists (no market_metadata row). With no metadata available, nothing is dropped."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/app__schemas__common__PaginatedResponse_LiquidatablePositionResponse___1"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/positions/{position_id}": {
      "get": {
        "tags": [
          "Positions (v1, frozen)"
        ],
        "summary": "Get Position",
        "operationId": "get_position_v1_positions__position_id__get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "position_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Position Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/app__schemas__v1__positions__PositionResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/markets": {
      "get": {
        "tags": [
          "Markets"
        ],
        "summary": "List Markets",
        "operationId": "list_markets_markets_get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "beacon",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by beacon address (hex)",
              "title": "Beacon"
            },
            "description": "Filter by beacon address (hex)"
          },
          {
            "name": "min_open_interest",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "number",
                  "minimum": 0.0
                },
                {
                  "type": "string",
                  "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by open_interest_long + open_interest_short >= value",
              "title": "Min Open Interest"
            },
            "description": "Filter by open_interest_long + open_interest_short >= value"
          },
          {
            "name": "max_open_interest",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "number",
                  "minimum": 0.0
                },
                {
                  "type": "string",
                  "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by open_interest_long + open_interest_short <= value",
              "title": "Max Open Interest"
            },
            "description": "Filter by open_interest_long + open_interest_short <= value"
          },
          {
            "name": "has_liquidity",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by liquidity > 0",
              "title": "Has Liquidity"
            },
            "description": "Filter by liquidity > 0"
          },
          {
            "name": "active",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by any open interest or liquidity present",
              "title": "Active"
            },
            "description": "Filter by any open interest or liquidity present"
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Substring match over name/symbol/ticker",
              "title": "Q"
            },
            "description": "Substring match over name/symbol/ticker"
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(open_interest|funding|liquidity|created)$",
              "description": "open_interest|funding|liquidity|created",
              "default": "created",
              "title": "Sort"
            },
            "description": "open_interest|funding|liquidity|created"
          },
          {
            "name": "order",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(asc|desc)$",
              "description": "asc|desc",
              "default": "desc",
              "title": "Order"
            },
            "description": "asc|desc"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 100,
              "title": "Limit"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "title": "Offset"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/app__schemas__common__PaginatedResponse_MarketResponse___2"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (X-API-Key header)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Missing API key. Pass your key in the X-API-Key header.",
                  "error": {
                    "code": "missing_api_key",
                    "message": "Missing API key. Pass your key in the X-API-Key header."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Per-minute budget for the key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 120 requests per minute per API key.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 120 requests per minute per API key."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/markets/{perp_address}": {
      "get": {
        "tags": [
          "Markets"
        ],
        "summary": "Get Market",
        "operationId": "get_market_markets__perp_address__get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "perp_address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Perp Address"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/app__schemas__markets__MarketDetailResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (X-API-Key header)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Missing API key. Pass your key in the X-API-Key header.",
                  "error": {
                    "code": "missing_api_key",
                    "message": "Missing API key. Pass your key in the X-API-Key header."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Per-minute budget for the key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 120 requests per minute per API key.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 120 requests per minute per API key."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/markets/{perp_address}/live": {
      "get": {
        "tags": [
          "Markets"
        ],
        "summary": "Get Live Market",
        "operationId": "get_live_market_markets__perp_address__live_get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "perp_address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Perp Address"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/app__schemas__markets__LiveMarketResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (X-API-Key header)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Missing API key. Pass your key in the X-API-Key header.",
                  "error": {
                    "code": "missing_api_key",
                    "message": "Missing API key. Pass your key in the X-API-Key header."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Per-minute budget for the key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 120 requests per minute per API key.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 120 requests per minute per API key."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/markets/{perp_address}/stats": {
      "get": {
        "tags": [
          "Markets"
        ],
        "summary": "Get Market Stats",
        "operationId": "get_market_stats_markets__perp_address__stats_get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "perp_address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Perp Address"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/app__schemas__markets__StatsResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (X-API-Key header)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Missing API key. Pass your key in the X-API-Key header.",
                  "error": {
                    "code": "missing_api_key",
                    "message": "Missing API key. Pass your key in the X-API-Key header."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Per-minute budget for the key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 120 requests per minute per API key.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 120 requests per minute per API key."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/markets/{perp_address}/snapshots": {
      "get": {
        "tags": [
          "Markets"
        ],
        "summary": "Get Snapshots",
        "operationId": "get_snapshots_markets__perp_address__snapshots_get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "perp_address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Perp Address"
            }
          },
          {
            "name": "start_time",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Start Time"
            }
          },
          {
            "name": "end_time",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "End Time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000,
              "minimum": 1,
              "default": 100,
              "title": "Limit"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "title": "Offset"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/app__schemas__common__PaginatedResponse_SnapshotResponse___2"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (X-API-Key header)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Missing API key. Pass your key in the X-API-Key header.",
                  "error": {
                    "code": "missing_api_key",
                    "message": "Missing API key. Pass your key in the X-API-Key header."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Per-minute budget for the key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 120 requests per minute per API key.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 120 requests per minute per API key."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/markets/{perp_address}/trades": {
      "get": {
        "tags": [
          "Markets"
        ],
        "summary": "Get Market Trades",
        "operationId": "get_market_trades_markets__perp_address__trades_get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "perp_address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Perp Address"
            }
          },
          {
            "name": "start_time",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Start Time"
            }
          },
          {
            "name": "end_time",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "End Time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 50,
              "title": "Limit"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "title": "Offset"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/app__schemas__common__PaginatedResponse_TradeResponse___2"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (X-API-Key header)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Missing API key. Pass your key in the X-API-Key header.",
                  "error": {
                    "code": "missing_api_key",
                    "message": "Missing API key. Pass your key in the X-API-Key header."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Per-minute budget for the key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 120 requests per minute per API key.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 120 requests per minute per API key."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/markets/{ticker}/history": {
      "get": {
        "tags": [
          "Markets"
        ],
        "summary": "Get Market History",
        "description": "Full merged beacon pre-history: raw source values AND index, from before\nthe beacon existed on-chain through the live on-chain series, keyed by the\nmarket's `ticker`.\n\nIndexed-only (no eth_calls / RPC): resolves the ticker via `market_metadata`\n(app-backend DB) and reads `series_history` + `beacon_snapshot` from the\nGoldsky/Tiger DB. Requires BOTH DBs (ticker resolution + the merge), so it\ndepends on `get_app_backend_db` directly rather than the graceful-degrade\noptional wrapper used by the cosmetics-only endpoints.",
        "operationId": "get_market_history_markets__ticker__history_get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "ticker",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Ticker"
            }
          },
          {
            "name": "start_time",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Start Time"
            }
          },
          {
            "name": "end_time",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "End Time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 1000,
              "minimum": 1,
              "default": 500,
              "title": "Limit"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "title": "Offset"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedResponse_MarketHistoryPoint_"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (X-API-Key header)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Missing API key. Pass your key in the X-API-Key header.",
                  "error": {
                    "code": "missing_api_key",
                    "message": "Missing API key. Pass your key in the X-API-Key header."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Per-minute budget for the key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 120 requests per minute per API key.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 120 requests per minute per API key."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/positions/risk": {
      "get": {
        "tags": [
          "Liquidations"
        ],
        "summary": "Risk Positions",
        "description": "Page ALL open positions, including makers, healthy and unlisted positions.\n\nKeyset pagination avoids the liquidatable filter's scan cap and offset drift.\nThe feed is live, not a point-in-time snapshot: repeat sweeps to catch new\npositions inserted before the cursor. Absence never proves on-chain closure.\nRatios are approximate AMM-based scheduling hints, not liquidation authority.",
        "operationId": "risk_positions_positions_risk_get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "after_perp",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "pattern": "^0x[0-9a-fA-F]{40}$"
                },
                {
                  "type": "null"
                }
              ],
              "title": "After Perp"
            }
          },
          {
            "name": "after_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "integer",
                  "minimum": 0
                },
                {
                  "type": "null"
                }
              ],
              "title": "After Id"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 500,
              "title": "Limit"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RiskPage"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/liquidation-markets": {
      "get": {
        "tags": [
          "Liquidations"
        ],
        "summary": "Liquidation Markets",
        "description": "List registered liquidation capabilities for the configured chain.",
        "operationId": "liquidation_markets_liquidation_markets_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/LiquidationMarketResponse"
                  },
                  "type": "array",
                  "title": "Response Liquidation Markets Liquidation Markets Get"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyHeader": []
          }
        ]
      }
    },
    "/admin/liquidation-markets/{perp_address}": {
      "put": {
        "tags": [
          "Admin"
        ],
        "summary": "Put Liquidation Market",
        "description": "Create or replace an admin-reviewed registration on the configured chain.",
        "operationId": "put_liquidation_market_admin_liquidation_markets__perp_address__put",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "perp_address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Perp Address"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LiquidationMarketRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LiquidationMarketResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "Admin"
        ],
        "summary": "Delete Liquidation Market",
        "description": "Remove a registration on the configured chain, or return 404 if absent.",
        "operationId": "delete_liquidation_market_admin_liquidation_markets__perp_address__delete",
        "security": [
          {
            "APIKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "perp_address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Perp Address"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/positions": {
      "get": {
        "tags": [
          "Positions"
        ],
        "summary": "List Positions",
        "operationId": "list_positions_positions_get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "holder",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Filter by holder wallet address (hex)",
              "title": "Holder"
            },
            "description": "Filter by holder wallet address (hex)"
          },
          {
            "name": "is_open",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Is Open"
            }
          },
          {
            "name": "is_maker",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Is Maker"
            }
          },
          {
            "name": "is_long",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Is Long"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 100,
              "title": "Limit"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "title": "Offset"
            }
          },
          {
            "name": "perp_address",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Perp contract address (hex) -- canonical identifier",
              "title": "Perp Address"
            },
            "description": "Perp contract address (hex) -- canonical identifier"
          },
          {
            "name": "market_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Deprecated alias for perp_address (legacy /v1 naming)",
              "deprecated": true,
              "title": "Market Id"
            },
            "description": "Deprecated alias for perp_address (legacy /v1 naming)",
            "deprecated": true
          },
          {
            "name": "perp",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Deprecated alias for perp_address",
              "deprecated": true,
              "title": "Perp"
            },
            "description": "Deprecated alias for perp_address",
            "deprecated": true
          },
          {
            "name": "perp_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Deprecated alias for perp_address",
              "deprecated": true,
              "title": "Perp Id"
            },
            "description": "Deprecated alias for perp_address",
            "deprecated": true
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/app__schemas__common__PaginatedResponse_PositionResponse___2"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (X-API-Key header)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Missing API key. Pass your key in the X-API-Key header.",
                  "error": {
                    "code": "missing_api_key",
                    "message": "Missing API key. Pass your key in the X-API-Key header."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Per-minute budget for the key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 120 requests per minute per API key.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 120 requests per minute per API key."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/positions/liquidatable": {
      "get": {
        "tags": [
          "Positions"
        ],
        "summary": "List Liquidatable Positions",
        "description": "Indexed-only liquidatable-candidate filter (NO on-chain eth_call), enriched\nwith holder/notional/health/distance-to-liquidation/estimated-reward/staleness.\n\nReturns a PERMISSIVE candidate set computed purely from indexed Goldsky data,\nplus the execution params a liquidation bot needs (`amount`, `is_maker`,\n`perp_address`, `id`). The bot-api is a public surface and must never fan out\nto the RPC per request; exactness is the bot's job -- it confirms each\ncandidate gas-free (simulate before send) before spending gas. A row here is\n\"worth checking\", not \"guaranteed liquidatable\".",
        "operationId": "list_liquidatable_positions_positions_liquidatable_get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "pattern": "^(most_underwater|largest_reward)$",
              "description": "most_underwater (default) | largest_reward",
              "default": "most_underwater",
              "title": "Sort"
            },
            "description": "most_underwater (default) | largest_reward"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 100,
              "title": "Limit"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "title": "Offset"
            }
          },
          {
            "name": "perp_address",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Perp contract address (hex) -- canonical identifier",
              "title": "Perp Address"
            },
            "description": "Perp contract address (hex) -- canonical identifier"
          },
          {
            "name": "market_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Deprecated alias for perp_address (legacy /v1 naming)",
              "deprecated": true,
              "title": "Market Id"
            },
            "description": "Deprecated alias for perp_address (legacy /v1 naming)",
            "deprecated": true
          },
          {
            "name": "perp",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Deprecated alias for perp_address",
              "deprecated": true,
              "title": "Perp"
            },
            "description": "Deprecated alias for perp_address",
            "deprecated": true
          },
          {
            "name": "perp_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Deprecated alias for perp_address",
              "deprecated": true,
              "title": "Perp Id"
            },
            "description": "Deprecated alias for perp_address",
            "deprecated": true
          },
          {
            "name": "listed_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Listed Only",
              "description": "Drop positions on markets the app no longer lists (no market_metadata row). With no metadata available, nothing is dropped."
            },
            "description": "Drop positions on markets the app no longer lists (no market_metadata row). With no metadata available, nothing is dropped."
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/app__schemas__common__PaginatedResponse_LiquidatablePositionResponse___2"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (X-API-Key header)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Missing API key. Pass your key in the X-API-Key header.",
                  "error": {
                    "code": "missing_api_key",
                    "message": "Missing API key. Pass your key in the X-API-Key header."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Per-minute budget for the key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 120 requests per minute per API key.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 120 requests per minute per API key."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/positions/{position_id}": {
      "get": {
        "tags": [
          "Positions"
        ],
        "summary": "Get Position",
        "operationId": "get_position_positions__position_id__get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "position_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Position Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/app__schemas__positions__PositionResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (X-API-Key header)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Missing API key. Pass your key in the X-API-Key header.",
                  "error": {
                    "code": "missing_api_key",
                    "message": "Missing API key. Pass your key in the X-API-Key header."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Per-minute budget for the key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 120 requests per minute per API key.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 120 requests per minute per API key."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/admin/keys": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Create Key",
        "description": "Create a new API key.",
        "operationId": "create_key_admin_keys_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/app__routers__admin__CreateKeyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/KeyResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "APIKeyHeader": []
          }
        ]
      }
    },
    "/auth/keys": {
      "get": {
        "tags": [
          "Developer Signup"
        ],
        "summary": "List Keys",
        "description": "List the authenticated developer's keys (previews only, never the secret).",
        "operationId": "list_keys_auth_keys_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/KeyInfo"
                  },
                  "type": "array",
                  "title": "Response List Keys Auth Keys Get"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      },
      "post": {
        "tags": [
          "Developer Signup"
        ],
        "summary": "Create Key",
        "description": "Issue a new pc_bot_ key for the Privy-authenticated developer.",
        "operationId": "create_key_auth_keys_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/app__routers__auth__CreateKeyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NewKeyResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "HTTPBearer": []
          }
        ]
      }
    },
    "/auth/keys/{key_id}": {
      "delete": {
        "tags": [
          "Developer Signup"
        ],
        "summary": "Revoke Key",
        "description": "Revoke one of the authenticated developer's keys (idempotent-ish).",
        "operationId": "revoke_key_auth_keys__key_id__delete",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "parameters": [
          {
            "name": "key_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Key Id"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/auth/wallet/challenge": {
      "post": {
        "tags": [
          "Wallet Signup"
        ],
        "summary": "Create Challenge",
        "description": "Issue a single-use message for the wallet to sign.",
        "operationId": "create_challenge_auth_wallet_challenge_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChallengeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChallengeResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/auth/wallet/keys": {
      "get": {
        "tags": [
          "Wallet Signup"
        ],
        "summary": "List Keys",
        "description": "List the calling key's developer's keys (previews only).",
        "operationId": "list_keys_auth_wallet_keys_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/KeyInfo"
                  },
                  "type": "array",
                  "title": "Response List Keys Auth Wallet Keys Get"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyHeader": []
          }
        ]
      },
      "post": {
        "tags": [
          "Wallet Signup"
        ],
        "summary": "Create Key",
        "description": "Verify the signed challenge + ETH balance, then mint a pc_bot_ key.",
        "operationId": "create_key_auth_wallet_keys_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WalletKeyRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NewKeyResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/auth/wallet/keys/{key_id}": {
      "delete": {
        "tags": [
          "Wallet Signup"
        ],
        "summary": "Revoke Key",
        "description": "Revoke a key belonging to the calling key's developer (rotation).",
        "operationId": "revoke_key_auth_wallet_keys__key_id__delete",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "key_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer",
              "title": "Key Id"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful Response"
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "summary": "Health",
        "operationId": "health_health_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "ok"
                    },
                    "lag_seconds": {
                      "type": "integer",
                      "nullable": true,
                      "description": "Seconds between now and the indexed head's block time; null when unknown."
                    }
                  },
                  "required": [
                    "status",
                    "lag_seconds"
                  ]
                }
              }
            }
          }
        },
        "description": "Liveness. Always 200 while the service answers. `lag_seconds` is the age of the indexed head (`now - indexed_at`, see `/height`) or `null` when unknown; it never fails the probe."
      }
    },
    "/": {
      "get": {
        "summary": "Root",
        "operationId": "root__get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {}
              }
            }
          }
        }
      }
    },
    "/time": {
      "get": {
        "summary": "Server time",
        "operationId": "time_time_get",
        "description": "This node's clock, so a client can measure its own skew before interpreting `lag_seconds`. No auth, not rate limited.",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "server_time": {
                      "type": "string",
                      "format": "date-time",
                      "example": "2026-10-20T14:00:00.123456Z"
                    },
                    "server_time_ms": {
                      "type": "integer",
                      "description": "Unix time in milliseconds."
                    }
                  },
                  "required": [
                    "server_time",
                    "server_time_ms"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/height": {
      "get": {
        "summary": "Indexed head",
        "operationId": "height_height_get",
        "description": "The highest block reflected in the indexed data this API serves, and its block time. Every response also carries it as the `X-Indexed-Block` and `X-Indexed-At` headers. The API never makes per-request on-chain calls; this is the block a read is good to. It is a lower bound: a block with no PerpCity event writes no indexed row. No auth, not rate limited.",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "indexed_block": {
                      "type": "integer"
                    },
                    "indexed_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "Block time of `indexed_block`."
                    },
                    "observed_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "When this node last read the head from the index database."
                    },
                    "lag_seconds": {
                      "type": "integer",
                      "description": "`now - indexed_at`, floored at zero."
                    }
                  },
                  "required": [
                    "indexed_block",
                    "indexed_at",
                    "observed_at",
                    "lag_seconds"
                  ]
                }
              }
            }
          },
          "503": {
            "description": "Indexed head unknown: the index database is unreachable or has no recent rows.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "detail": {
                      "type": "string"
                    },
                    "error": {
                      "type": "object",
                      "properties": {
                        "code": {
                          "type": "string",
                          "example": "index_unknown"
                        },
                        "message": {
                          "type": "string"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/me": {
      "get": {
        "tags": [
          "Developer Signup"
        ],
        "summary": "Me",
        "description": "Describe the calling key and the Privy user and trading account it is bound to. Never returns the secret.",
        "operationId": "me_me_get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MeResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (X-API-Key header)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Missing API key. Pass your key in the X-API-Key header.",
                  "error": {
                    "code": "missing_api_key",
                    "message": "Missing API key. Pass your key in the X-API-Key header."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Per-minute budget for the key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 120 requests per minute per API key.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 120 requests per minute per API key."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/me/positions": {
      "get": {
        "tags": [
          "Positions"
        ],
        "summary": "My Positions",
        "description": "GET /positions pinned to the calling key's trading_address. Accepts the same filters as /positions except holder, which is ignored. 409 no_trading_address when the key is not bound to a trading account.",
        "operationId": "my_positions_me_positions_get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "is_open",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Is Open"
            }
          },
          {
            "name": "is_maker",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Is Maker"
            }
          },
          {
            "name": "is_long",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "boolean"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Is Long"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 500,
              "minimum": 1,
              "default": 100,
              "title": "Limit"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "title": "Offset"
            }
          },
          {
            "name": "perp_address",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Perp contract address (hex) -- canonical identifier",
              "title": "Perp Address"
            },
            "description": "Perp contract address (hex) -- canonical identifier"
          },
          {
            "name": "market_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Deprecated alias for perp_address (legacy /v1 naming)",
              "deprecated": true,
              "title": "Market Id"
            },
            "description": "Deprecated alias for perp_address (legacy /v1 naming)",
            "deprecated": true
          },
          {
            "name": "perp",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Deprecated alias for perp_address",
              "deprecated": true,
              "title": "Perp"
            },
            "description": "Deprecated alias for perp_address",
            "deprecated": true
          },
          {
            "name": "perp_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "description": "Deprecated alias for perp_address",
              "deprecated": true,
              "title": "Perp Id"
            },
            "description": "Deprecated alias for perp_address",
            "deprecated": true
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/app__schemas__common__PaginatedResponse_PositionResponse___2"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (X-API-Key header)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Missing API key. Pass your key in the X-API-Key header.",
                  "error": {
                    "code": "missing_api_key",
                    "message": "Missing API key. Pass your key in the X-API-Key header."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Per-minute budget for the key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 120 requests per minute per API key.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 120 requests per minute per API key."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "409": {
            "description": "The key is not bound to a trading account",
            "content": {
              "application/json": {
                "example": {
                  "detail": "This API key is not bound to a trading account.",
                  "error": {
                    "code": "no_trading_address",
                    "message": "This API key is not bound to a trading account."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/auth/device": {
      "post": {
        "tags": [
          "Developer Signup"
        ],
        "summary": "Start Device Pairing",
        "description": "A CLI or agent with no credential asks to be paired (RFC 8628 shape). Show the user verification_uri_complete, then poll POST /auth/device/token every `interval` seconds. Throttled per IP.",
        "operationId": "device_start_auth_device_post",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "client_name": {
                    "type": "string",
                    "maxLength": 100,
                    "default": "cli",
                    "description": "Becomes the minted key's name."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeviceCodeResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Issuance budget per client IP (WALLET_MINT_RATE_LIMIT_PER_MINUTE).",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 10 wallet-auth requests per minute per IP.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 10 wallet-auth requests per minute per IP."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/auth/device/token": {
      "post": {
        "tags": [
          "Developer Signup"
        ],
        "summary": "Poll Device Pairing",
        "description": "Poll with the device_code. 400 with error.code authorization_pending (keep polling), access_denied (stop), expired_token (start again) or invalid_grant (unknown or already collected). On approval the first poll mints an `agent` key with read and trade scopes bound to the approving user's trading address, and returns the secret exactly once.",
        "operationId": "device_token_auth_device_token_post",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "device_code"
                ],
                "properties": {
                  "device_code": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Approved and collected",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeviceTokenResponse"
                }
              }
            }
          },
          "400": {
            "description": "Not ready, denied, expired or unknown",
            "content": {
              "application/json": {
                "examples": {
                  "pending": {
                    "value": {
                      "detail": "The user has not approved this device yet.",
                      "error": {
                        "code": "authorization_pending",
                        "message": "The user has not approved this device yet."
                      }
                    }
                  },
                  "denied": {
                    "value": {
                      "detail": "The user denied this device.",
                      "error": {
                        "code": "access_denied",
                        "message": "The user denied this device."
                      }
                    }
                  },
                  "expired": {
                    "value": {
                      "detail": "This device code has expired; start pairing again.",
                      "error": {
                        "code": "expired_token",
                        "message": "This device code has expired; start pairing again."
                      }
                    }
                  },
                  "invalid": {
                    "value": {
                      "detail": "Unknown or already-used device code.",
                      "error": {
                        "code": "invalid_grant",
                        "message": "Unknown or already-used device code."
                      }
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Poll budget per client IP (DEVICE_POLL_RATE_LIMIT_PER_MINUTE); poll at the advertised interval.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 60 device polls per minute per IP.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 60 device polls per minute per IP."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/auth/device/approve": {
      "post": {
        "tags": [
          "Developer Signup"
        ],
        "summary": "Decide Device Pairing",
        "description": "The verification page, with the user logged in to Privy, approves or denies a user_code. 404 unknown_device_code, 409 device_code_already_decided.",
        "operationId": "device_approve_auth_device_approve_post",
        "security": [
          {
            "HTTPBearer": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeviceDecisionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeviceDecisionResponse"
                }
              }
            }
          },
          "404": {
            "description": "No pending device matches that code",
            "content": {
              "application/json": {
                "example": {
                  "detail": "No pending device matches that code.",
                  "error": {
                    "code": "unknown_device_code",
                    "message": "No pending device matches that code."
                  }
                }
              }
            }
          },
          "409": {
            "description": "Already decided",
            "content": {
              "application/json": {
                "example": {
                  "detail": "That code was already decided.",
                  "error": {
                    "code": "device_code_already_decided",
                    "message": "That code was already decided."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Approval budget per Privy user (DEVICE_APPROVE_RATE_LIMIT_PER_MINUTE).",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the current window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 20 device approvals per minute per user.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 20 device approvals per minute per user."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/me/key": {
      "delete": {
        "tags": [
          "Developer Signup"
        ],
        "summary": "Revoke This Key",
        "description": "The calling key revokes itself (the CLI's logout). Key auth, not rate limited.",
        "operationId": "revoke_self_me_key_delete",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "responses": {
          "204": {
            "description": "Revoked"
          },
          "401": {
            "description": "Missing or invalid API key (X-API-Key header)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Missing API key. Pass your key in the X-API-Key header.",
                  "error": {
                    "code": "missing_api_key",
                    "message": "Missing API key. Pass your key in the X-API-Key header."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/trade/open": {
      "post": {
        "tags": [
          "Trade"
        ],
        "summary": "Open Taker",
        "description": "Open a taker position on the key's trading account. Sized from margin and leverage; the USD leg is bounded by slippage_pct.",
        "operationId": "trade_open_trade_open_post",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "Caller-chosen key per intended trade. A retry with the same key replays the stored outcome instead of trading again."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TradeOpenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The execution (fresh or replayed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Execution"
                }
              }
            }
          },
          "400": {
            "description": "Refused by the trading policy or the market is not listed",
            "content": {
              "application/json": {
                "examples": {
                  "policy": {
                    "value": {
                      "detail": "Refused by trading policy: USDC transfer",
                      "error": {
                        "code": "policy_violation",
                        "message": "Refused by trading policy: USDC transfer"
                      }
                    }
                  },
                  "unlisted": {
                    "value": {
                      "detail": "This market is not listed for trading.",
                      "error": {
                        "code": "market_not_listed",
                        "message": "This market is not listed for trading."
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Market not found",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Market not found",
                  "error": {
                    "code": "market_not_found",
                    "message": "Market not found"
                  }
                }
              }
            }
          },
          "502": {
            "description": "The trade executor failed or could not be reached; nothing was traded and the execution is recorded as failed",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Trade executor unreachable; try again.",
                  "error": {
                    "code": "execution_failed",
                    "message": "Trade executor unreachable; try again."
                  }
                }
              }
            }
          },
          "504": {
            "description": "The trade executor may have submitted the user operation but its outcome never came back; the execution is recorded as unknown (with the user-op hash when there is one). Retrying with the same Idempotency-Key replays this outcome and never trades again.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "The trade may have been submitted but its outcome is not known. Check GET /trade/executions/{id} and your positions before trading again.",
                  "error": {
                    "code": "execution_outcome_unknown",
                    "message": "The trade may have been submitted but its outcome is not known. Check GET /trade/executions/{id} and your positions before trading again."
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (X-API-Key header)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Missing API key. Pass your key in the X-API-Key header.",
                  "error": {
                    "code": "missing_api_key",
                    "message": "Missing API key. Pass your key in the X-API-Key header."
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the trade scope (X-Required-Scopes names it)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "This API key lacks the required scope(s): trade.",
                  "error": {
                    "code": "insufficient_scope",
                    "message": "This API key lacks the required scope(s): trade."
                  }
                }
              }
            }
          },
          "409": {
            "description": "The key is not bound to a trading account with a delegated signer, an execution with this Idempotency-Key is still in flight, or the Idempotency-Key was already used for a different request",
            "content": {
              "application/json": {
                "examples": {
                  "unbound": {
                    "value": {
                      "detail": "This API key is not bound to a trading account with a delegated signer.",
                      "error": {
                        "code": "no_trading_address",
                        "message": "This API key is not bound to a trading account with a delegated signer."
                      }
                    }
                  },
                  "in_flight": {
                    "value": {
                      "detail": "An execution with this Idempotency-Key is still in flight.",
                      "error": {
                        "code": "execution_in_progress",
                        "message": "An execution with this Idempotency-Key is still in flight."
                      }
                    }
                  },
                  "key_reused": {
                    "value": {
                      "detail": "This Idempotency-Key was already used for a different request; use a new key for a new trade.",
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was already used for a different request; use a new key for a new trade."
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Trading is not enabled on this deployment",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Trading is not enabled on this deployment.",
                  "error": {
                    "code": "trading_unavailable",
                    "message": "Trading is not enabled on this deployment."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Per-minute budget for the key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 120 requests per minute per API key.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 120 requests per minute per API key."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/trade/close": {
      "post": {
        "tags": [
          "Trade"
        ],
        "summary": "Close Position",
        "description": "Close one of the account's positions (maker or taker).",
        "operationId": "trade_close_trade_close_post",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "Caller-chosen key per intended trade. A retry with the same key replays the stored outcome instead of trading again."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TradeCloseRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The execution (fresh or replayed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Execution"
                }
              }
            }
          },
          "400": {
            "description": "Refused by the trading policy or the market is not listed",
            "content": {
              "application/json": {
                "examples": {
                  "policy": {
                    "value": {
                      "detail": "Refused by trading policy: USDC transfer",
                      "error": {
                        "code": "policy_violation",
                        "message": "Refused by trading policy: USDC transfer"
                      }
                    }
                  },
                  "unlisted": {
                    "value": {
                      "detail": "This market is not listed for trading.",
                      "error": {
                        "code": "market_not_listed",
                        "message": "This market is not listed for trading."
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Market not found",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Market not found",
                  "error": {
                    "code": "market_not_found",
                    "message": "Market not found"
                  }
                }
              }
            }
          },
          "502": {
            "description": "The trade executor failed or could not be reached; nothing was traded and the execution is recorded as failed",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Trade executor unreachable; try again.",
                  "error": {
                    "code": "execution_failed",
                    "message": "Trade executor unreachable; try again."
                  }
                }
              }
            }
          },
          "504": {
            "description": "The trade executor may have submitted the user operation but its outcome never came back; the execution is recorded as unknown (with the user-op hash when there is one). Retrying with the same Idempotency-Key replays this outcome and never trades again.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "The trade may have been submitted but its outcome is not known. Check GET /trade/executions/{id} and your positions before trading again.",
                  "error": {
                    "code": "execution_outcome_unknown",
                    "message": "The trade may have been submitted but its outcome is not known. Check GET /trade/executions/{id} and your positions before trading again."
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (X-API-Key header)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Missing API key. Pass your key in the X-API-Key header.",
                  "error": {
                    "code": "missing_api_key",
                    "message": "Missing API key. Pass your key in the X-API-Key header."
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the trade scope (X-Required-Scopes names it)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "This API key lacks the required scope(s): trade.",
                  "error": {
                    "code": "insufficient_scope",
                    "message": "This API key lacks the required scope(s): trade."
                  }
                }
              }
            }
          },
          "409": {
            "description": "The key is not bound to a trading account with a delegated signer, an execution with this Idempotency-Key is still in flight, or the Idempotency-Key was already used for a different request",
            "content": {
              "application/json": {
                "examples": {
                  "unbound": {
                    "value": {
                      "detail": "This API key is not bound to a trading account with a delegated signer.",
                      "error": {
                        "code": "no_trading_address",
                        "message": "This API key is not bound to a trading account with a delegated signer."
                      }
                    }
                  },
                  "in_flight": {
                    "value": {
                      "detail": "An execution with this Idempotency-Key is still in flight.",
                      "error": {
                        "code": "execution_in_progress",
                        "message": "An execution with this Idempotency-Key is still in flight."
                      }
                    }
                  },
                  "key_reused": {
                    "value": {
                      "detail": "This Idempotency-Key was already used for a different request; use a new key for a new trade.",
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was already used for a different request; use a new key for a new trade."
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Trading is not enabled on this deployment",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Trading is not enabled on this deployment.",
                  "error": {
                    "code": "trading_unavailable",
                    "message": "Trading is not enabled on this deployment."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Per-minute budget for the key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 120 requests per minute per API key.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 120 requests per minute per API key."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/trade/adjust": {
      "post": {
        "tags": [
          "Trade"
        ],
        "summary": "Adjust Taker",
        "description": "Add or remove margin and/or size on a taker position.",
        "operationId": "trade_adjust_trade_adjust_post",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "maxLength": 200
            },
            "description": "Caller-chosen key per intended trade. A retry with the same key replays the stored outcome instead of trading again."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TradeAdjustRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The execution (fresh or replayed)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Execution"
                }
              }
            }
          },
          "400": {
            "description": "Refused by the trading policy or the market is not listed",
            "content": {
              "application/json": {
                "examples": {
                  "policy": {
                    "value": {
                      "detail": "Refused by trading policy: USDC transfer",
                      "error": {
                        "code": "policy_violation",
                        "message": "Refused by trading policy: USDC transfer"
                      }
                    }
                  },
                  "unlisted": {
                    "value": {
                      "detail": "This market is not listed for trading.",
                      "error": {
                        "code": "market_not_listed",
                        "message": "This market is not listed for trading."
                      }
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Market not found",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Market not found",
                  "error": {
                    "code": "market_not_found",
                    "message": "Market not found"
                  }
                }
              }
            }
          },
          "502": {
            "description": "The trade executor failed or could not be reached; nothing was traded and the execution is recorded as failed",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Trade executor unreachable; try again.",
                  "error": {
                    "code": "execution_failed",
                    "message": "Trade executor unreachable; try again."
                  }
                }
              }
            }
          },
          "504": {
            "description": "The trade executor may have submitted the user operation but its outcome never came back; the execution is recorded as unknown (with the user-op hash when there is one). Retrying with the same Idempotency-Key replays this outcome and never trades again.",
            "content": {
              "application/json": {
                "example": {
                  "detail": "The trade may have been submitted but its outcome is not known. Check GET /trade/executions/{id} and your positions before trading again.",
                  "error": {
                    "code": "execution_outcome_unknown",
                    "message": "The trade may have been submitted but its outcome is not known. Check GET /trade/executions/{id} and your positions before trading again."
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (X-API-Key header)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Missing API key. Pass your key in the X-API-Key header.",
                  "error": {
                    "code": "missing_api_key",
                    "message": "Missing API key. Pass your key in the X-API-Key header."
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the trade scope (X-Required-Scopes names it)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "This API key lacks the required scope(s): trade.",
                  "error": {
                    "code": "insufficient_scope",
                    "message": "This API key lacks the required scope(s): trade."
                  }
                }
              }
            }
          },
          "409": {
            "description": "The key is not bound to a trading account with a delegated signer, an execution with this Idempotency-Key is still in flight, or the Idempotency-Key was already used for a different request",
            "content": {
              "application/json": {
                "examples": {
                  "unbound": {
                    "value": {
                      "detail": "This API key is not bound to a trading account with a delegated signer.",
                      "error": {
                        "code": "no_trading_address",
                        "message": "This API key is not bound to a trading account with a delegated signer."
                      }
                    }
                  },
                  "in_flight": {
                    "value": {
                      "detail": "An execution with this Idempotency-Key is still in flight.",
                      "error": {
                        "code": "execution_in_progress",
                        "message": "An execution with this Idempotency-Key is still in flight."
                      }
                    }
                  },
                  "key_reused": {
                    "value": {
                      "detail": "This Idempotency-Key was already used for a different request; use a new key for a new trade.",
                      "error": {
                        "code": "idempotency_key_reused",
                        "message": "This Idempotency-Key was already used for a different request; use a new key for a new trade."
                      }
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Trading is not enabled on this deployment",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Trading is not enabled on this deployment.",
                  "error": {
                    "code": "trading_unavailable",
                    "message": "Trading is not enabled on this deployment."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Per-minute budget for the key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 120 requests per minute per API key.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 120 requests per minute per API key."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/trade/quote": {
      "post": {
        "tags": [
          "Trade"
        ],
        "summary": "Quote Open Taker",
        "description": "The taker estimate for an open (perp delta, fill price, fees, the slippage-limited amt1_limit). Records nothing.",
        "operationId": "trade_quote_trade_quote_post",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TradeOpenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Quote",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Market not found"
          },
          "401": {
            "description": "Missing or invalid API key (X-API-Key header)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Missing API key. Pass your key in the X-API-Key header.",
                  "error": {
                    "code": "missing_api_key",
                    "message": "Missing API key. Pass your key in the X-API-Key header."
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the trade scope (X-Required-Scopes names it)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "This API key lacks the required scope(s): trade.",
                  "error": {
                    "code": "insufficient_scope",
                    "message": "This API key lacks the required scope(s): trade."
                  }
                }
              }
            }
          },
          "409": {
            "description": "The key is not bound to a trading account with a delegated signer",
            "content": {
              "application/json": {
                "example": {
                  "detail": "This API key is not bound to a trading account with a delegated signer.",
                  "error": {
                    "code": "no_trading_address",
                    "message": "This API key is not bound to a trading account with a delegated signer."
                  }
                }
              }
            }
          },
          "503": {
            "description": "Trading is not enabled on this deployment",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Trading is not enabled on this deployment.",
                  "error": {
                    "code": "trading_unavailable",
                    "message": "Trading is not enabled on this deployment."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Per-minute budget for the key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 120 requests per minute per API key.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 120 requests per minute per API key."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/trade/executions": {
      "get": {
        "tags": [
          "Trade"
        ],
        "summary": "List Executions",
        "description": "The calling key's executions, newest first.",
        "operationId": "trade_executions_trade_executions_get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 200,
              "default": 50
            }
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0,
              "maximum": 1000000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExecutionPage"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (X-API-Key header)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Missing API key. Pass your key in the X-API-Key header.",
                  "error": {
                    "code": "missing_api_key",
                    "message": "Missing API key. Pass your key in the X-API-Key header."
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the trade scope (X-Required-Scopes names it)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "This API key lacks the required scope(s): trade.",
                  "error": {
                    "code": "insufficient_scope",
                    "message": "This API key lacks the required scope(s): trade."
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Per-minute budget for the key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 120 requests per minute per API key.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 120 requests per minute per API key."
                  }
                }
              }
            }
          }
        }
      }
    },
    "/trade/executions/{id}": {
      "get": {
        "tags": [
          "Trade"
        ],
        "summary": "Get Execution",
        "operationId": "trade_execution_trade_executions_id_get",
        "security": [
          {
            "ApiKeyHeader": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Execution"
                }
              }
            }
          },
          "404": {
            "description": "Execution not found"
          },
          "401": {
            "description": "Missing or invalid API key (X-API-Key header)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "Missing API key. Pass your key in the X-API-Key header.",
                  "error": {
                    "code": "missing_api_key",
                    "message": "Missing API key. Pass your key in the X-API-Key header."
                  }
                }
              }
            }
          },
          "403": {
            "description": "The key lacks the trade scope (X-Required-Scopes names it)",
            "content": {
              "application/json": {
                "example": {
                  "detail": "This API key lacks the required scope(s): trade.",
                  "error": {
                    "code": "insufficient_scope",
                    "message": "This API key lacks the required scope(s): trade."
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded (see Retry-After and X-RateLimit-* headers)",
            "headers": {
              "Retry-After": {
                "description": "Seconds until the window frees up.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Per-minute budget for the key.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Requests left in the window.",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Seconds until the window resets.",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "example": {
                  "detail": "Rate limit exceeded: 120 requests per minute per API key.",
                  "error": {
                    "code": "rate_limited",
                    "message": "Rate limit exceeded: 120 requests per minute per API key."
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ChallengeRequest": {
        "properties": {
          "address": {
            "type": "string",
            "title": "Address"
          }
        },
        "type": "object",
        "required": [
          "address"
        ],
        "title": "ChallengeRequest"
      },
      "ChallengeResponse": {
        "properties": {
          "nonce": {
            "type": "string",
            "title": "Nonce"
          },
          "message": {
            "type": "string",
            "title": "Message"
          },
          "expires_at": {
            "type": "string",
            "title": "Expires At"
          }
        },
        "type": "object",
        "required": [
          "nonce",
          "message",
          "expires_at"
        ],
        "title": "ChallengeResponse"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "KeyInfo": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "key_preview": {
            "type": "string",
            "title": "Key Preview"
          },
          "is_active": {
            "type": "boolean",
            "title": "Is Active"
          },
          "created_at": {
            "type": "string",
            "title": "Created At"
          },
          "last_used_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Used At"
          },
          "trading_address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trading Address",
            "description": "Lowercase hex address of the smart wallet this key's user trades from (the holder of their positions); null when the key is not bound to one."
          },
          "kind": {
            "type": "string",
            "enum": [
              "developer",
              "agent"
            ],
            "title": "Kind",
            "description": "developer for self-service and admin keys, agent for keys minted by device pairing."
          }
        },
        "type": "object",
        "required": [
          "id",
          "name",
          "key_preview",
          "is_active",
          "created_at",
          "kind"
        ],
        "title": "KeyInfo",
        "description": "Key metadata for listing -- never includes the full secret."
      },
      "KeyResponse": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "key": {
            "type": "string",
            "title": "Key"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "is_active": {
            "type": "boolean",
            "title": "Is Active"
          },
          "created_at": {
            "type": "string",
            "title": "Created At"
          },
          "last_used_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Used At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "key",
          "name",
          "is_active",
          "created_at"
        ],
        "title": "KeyResponse"
      },
      "LiquidatableHealth": {
        "properties": {
          "margin_ratio": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Margin Ratio",
            "description": "Approx indexed margin ratio (equity/notional); None if uncomputable"
          },
          "liq_margin_ratio": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Liq Margin Ratio",
            "description": "Maintenance (liquidation) margin ratio threshold, decimal form"
          }
        },
        "type": "object",
        "title": "LiquidatableHealth",
        "description": "Margin-ratio health snapshot for a liquidatable candidate."
      },
      "LiquidationMarketRequest": {
        "properties": {
          "contract_version": {
            "type": "string",
            "enum": [
              "legacy_v0_1",
              "partial_v1",
              "upgradeable_v0_2_2"
            ],
            "title": "Contract Version"
          },
          "code_hash": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{64}$",
            "title": "Code Hash"
          },
          "mode": {
            "type": "string",
            "enum": [
              "shadow",
              "execute",
              "disabled"
            ],
            "title": "Mode",
            "default": "shadow"
          },
          "release_ref": {
            "type": "string",
            "maxLength": 200,
            "minLength": 1,
            "title": "Release Ref"
          }
        },
        "type": "object",
        "required": [
          "contract_version",
          "code_hash",
          "release_ref"
        ],
        "title": "LiquidationMarketRequest"
      },
      "LiquidationMarketResponse": {
        "properties": {
          "contract_version": {
            "type": "string",
            "enum": [
              "legacy_v0_1",
              "partial_v1",
              "upgradeable_v0_2_2"
            ],
            "title": "Contract Version"
          },
          "code_hash": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{64}$",
            "title": "Code Hash"
          },
          "mode": {
            "type": "string",
            "enum": [
              "shadow",
              "execute",
              "disabled"
            ],
            "title": "Mode",
            "default": "shadow"
          },
          "release_ref": {
            "type": "string",
            "maxLength": 200,
            "minLength": 1,
            "title": "Release Ref"
          },
          "chain_id": {
            "type": "integer",
            "title": "Chain Id"
          },
          "perp_address": {
            "type": "string",
            "title": "Perp Address"
          }
        },
        "type": "object",
        "required": [
          "contract_version",
          "code_hash",
          "release_ref",
          "chain_id",
          "perp_address"
        ],
        "title": "LiquidationMarketResponse"
      },
      "MarketHistoryPoint": {
        "properties": {
          "ts": {
            "type": "string",
            "format": "date-time",
            "title": "Ts"
          },
          "raw_value": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Raw Value",
            "description": "Raw source measurement (series_history; whole life)"
          },
          "index_x96": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Index X96",
            "description": "Q96 index for this tick (None if NULL/<=0)"
          },
          "origin": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Origin",
            "description": "Provenance: backfill | mirror | folded (pre-boundary) or chain (live)"
          }
        },
        "type": "object",
        "required": [
          "ts"
        ],
        "title": "MarketHistoryPoint",
        "description": "One point of a market's merged pre-history + live series.\n\nBoth legs are returned as raw points (no forward-fill): `raw_value` is the\nraw source measurement (from `series_history`, present for the whole life),\nand `index_x96` is the Q96 index following the time-split (pre-boundary from\n`series_history`, at/after the boundary from on-chain `beacon_snapshot`).\n`index_x96` is None when that tick carries no index (NULL / <= 0) -- the raw\npoint still stands. See `MarketDataService.get_market_history` for the full\nmerge contract shared with the backend-api."
      },
      "NewKeyResponse": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "key": {
            "type": "string",
            "title": "Key"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "created_at": {
            "type": "string",
            "title": "Created At"
          },
          "trading_address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trading Address",
            "description": "Lowercase hex address of the smart wallet this key's user trades from (the holder of their positions); null when the key is not bound to one."
          }
        },
        "type": "object",
        "required": [
          "id",
          "key",
          "name",
          "created_at"
        ],
        "title": "NewKeyResponse",
        "description": "Returned once, at creation -- the only time the full key is exposed."
      },
      "OIResponse": {
        "properties": {
          "perp_id": {
            "type": "string",
            "title": "Perp Id"
          },
          "taker_long_oi": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Taker Long Oi"
          },
          "taker_short_oi": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Taker Short Oi"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "title": "Timestamp"
          }
        },
        "type": "object",
        "required": [
          "perp_id",
          "taker_long_oi",
          "taker_short_oi",
          "timestamp"
        ],
        "title": "OIResponse",
        "description": "Historical OI point.\n\nNOTE: Under v0.1.0, OI history is no longer stored on `PerpSnapshot`;\nit must be summed from `TakerAction.long_oi_delta` /\n`short_oi_delta`. The endpoint backed by this shape currently returns\nan empty page -- see `MarketDataService.get_oi_history` for the\ndeprecation note."
      },
      "PaginatedResponse_MarketHistoryPoint_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/MarketHistoryPoint"
            },
            "type": "array",
            "title": "Items"
          },
          "total": {
            "type": "integer",
            "title": "Total"
          },
          "limit": {
            "type": "integer",
            "title": "Limit"
          },
          "offset": {
            "type": "integer",
            "title": "Offset"
          },
          "has_more": {
            "type": "boolean",
            "title": "Has More"
          }
        },
        "type": "object",
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "has_more"
        ],
        "title": "PaginatedResponse[MarketHistoryPoint]"
      },
      "PaginatedResponse_OIResponse_": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/OIResponse"
            },
            "type": "array",
            "title": "Items"
          },
          "total": {
            "type": "integer",
            "title": "Total"
          },
          "limit": {
            "type": "integer",
            "title": "Limit"
          },
          "offset": {
            "type": "integer",
            "title": "Offset"
          },
          "has_more": {
            "type": "boolean",
            "title": "Has More"
          }
        },
        "type": "object",
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "has_more"
        ],
        "title": "PaginatedResponse[OIResponse]"
      },
      "RiskPage": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/RiskPositionResponse"
            },
            "type": "array",
            "title": "Items"
          },
          "total_open": {
            "type": "integer",
            "title": "Total Open"
          },
          "scanned": {
            "type": "integer",
            "title": "Scanned"
          },
          "has_more": {
            "type": "boolean",
            "title": "Has More"
          },
          "next_perp": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Perp"
          },
          "next_id": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Id"
          },
          "generated_at": {
            "type": "integer",
            "title": "Generated At"
          }
        },
        "type": "object",
        "required": [
          "items",
          "total_open",
          "scanned",
          "has_more",
          "generated_at"
        ],
        "title": "RiskPage"
      },
      "RiskPositionResponse": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id",
            "description": "On-chain position id (pos_id)"
          },
          "perp_address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Perp Address",
            "description": "Market (Perp) contract address, hex"
          },
          "perp": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Perp",
            "description": "Deprecated alias for perp_address"
          },
          "is_maker": {
            "type": "boolean",
            "title": "Is Maker"
          },
          "amount": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Amount",
            "description": "Indexed size in base units; null when unknown"
          },
          "mode": {
            "type": "string",
            "title": "Mode",
            "description": "Liquidation mode (V1 == full)",
            "default": "full"
          },
          "margin_ratio": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Margin Ratio",
            "description": "Approx indexed margin ratio (equity/notional); None if uncomputable"
          },
          "liq_margin_ratio": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Liq Margin Ratio",
            "description": "Maintenance (liquidation) margin ratio threshold, decimal form"
          },
          "as_of": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of",
            "description": "Unix ts of the mark snapshot used (indexed-data freshness)"
          },
          "holder": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Holder",
            "description": "Position holder wallet address, hex"
          },
          "notional": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notional",
            "description": "|perp_delta| * mark_price; None if uncomputable"
          },
          "health": {
            "$ref": "#/components/schemas/LiquidatableHealth"
          },
          "distance_to_liquidation": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Distance To Liquidation",
            "description": "Unbuffered margin_ratio - liq_margin_ratio; non-positive means already past the raw (unbuffered) threshold"
          },
          "estimated_reward": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Estimated Reward",
            "description": "Rough indexed-only estimate of the liquidator reward -- a prioritization signal, NOT a guarantee of the on-chain payout"
          },
          "is_stale": {
            "type": "boolean",
            "title": "Is Stale",
            "description": "True if the indexed mark snapshot predates the staleness threshold, or freshness is unknown",
            "default": true
          }
        },
        "type": "object",
        "required": [
          "id",
          "is_maker"
        ],
        "title": "RiskPositionResponse"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      },
      "WalletKeyRequest": {
        "properties": {
          "nonce": {
            "type": "string",
            "title": "Nonce"
          },
          "signature": {
            "type": "string",
            "title": "Signature"
          },
          "name": {
            "type": "string",
            "maxLength": 100,
            "title": "Name",
            "default": "default"
          }
        },
        "type": "object",
        "required": [
          "nonce",
          "signature"
        ],
        "title": "WalletKeyRequest"
      },
      "app__routers__admin__CreateKeyRequest": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name"
          }
        },
        "type": "object",
        "required": [
          "name"
        ],
        "title": "CreateKeyRequest"
      },
      "app__routers__auth__CreateKeyRequest": {
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 100,
            "title": "Name",
            "default": "default"
          }
        },
        "type": "object",
        "title": "CreateKeyRequest"
      },
      "app__routers__v1__admin__CreateKeyRequest": {
        "properties": {
          "name": {
            "type": "string",
            "title": "Name"
          }
        },
        "type": "object",
        "required": [
          "name"
        ],
        "title": "CreateKeyRequest"
      },
      "app__schemas__common__PaginatedResponse_LiquidatablePositionResponse___1": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/app__schemas__v1__positions__LiquidatablePositionResponse"
            },
            "type": "array",
            "title": "Items"
          },
          "total": {
            "type": "integer",
            "title": "Total"
          },
          "limit": {
            "type": "integer",
            "title": "Limit"
          },
          "offset": {
            "type": "integer",
            "title": "Offset"
          },
          "has_more": {
            "type": "boolean",
            "title": "Has More"
          }
        },
        "type": "object",
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "has_more"
        ],
        "title": "PaginatedResponse[LiquidatablePositionResponse]"
      },
      "app__schemas__common__PaginatedResponse_LiquidatablePositionResponse___2": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/app__schemas__positions__LiquidatablePositionResponse"
            },
            "type": "array",
            "title": "Items"
          },
          "total": {
            "type": "integer",
            "title": "Total"
          },
          "limit": {
            "type": "integer",
            "title": "Limit"
          },
          "offset": {
            "type": "integer",
            "title": "Offset"
          },
          "has_more": {
            "type": "boolean",
            "title": "Has More"
          }
        },
        "type": "object",
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "has_more"
        ],
        "title": "PaginatedResponse[LiquidatablePositionResponse]"
      },
      "app__schemas__common__PaginatedResponse_MarketResponse___1": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/app__schemas__v1__markets__MarketResponse"
            },
            "type": "array",
            "title": "Items"
          },
          "total": {
            "type": "integer",
            "title": "Total"
          },
          "limit": {
            "type": "integer",
            "title": "Limit"
          },
          "offset": {
            "type": "integer",
            "title": "Offset"
          },
          "has_more": {
            "type": "boolean",
            "title": "Has More"
          }
        },
        "type": "object",
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "has_more"
        ],
        "title": "PaginatedResponse[MarketResponse]"
      },
      "app__schemas__common__PaginatedResponse_MarketResponse___2": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/app__schemas__markets__MarketResponse"
            },
            "type": "array",
            "title": "Items"
          },
          "total": {
            "type": "integer",
            "title": "Total"
          },
          "limit": {
            "type": "integer",
            "title": "Limit"
          },
          "offset": {
            "type": "integer",
            "title": "Offset"
          },
          "has_more": {
            "type": "boolean",
            "title": "Has More"
          }
        },
        "type": "object",
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "has_more"
        ],
        "title": "PaginatedResponse[MarketResponse]"
      },
      "app__schemas__common__PaginatedResponse_PositionResponse___1": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/app__schemas__v1__positions__PositionResponse"
            },
            "type": "array",
            "title": "Items"
          },
          "total": {
            "type": "integer",
            "title": "Total"
          },
          "limit": {
            "type": "integer",
            "title": "Limit"
          },
          "offset": {
            "type": "integer",
            "title": "Offset"
          },
          "has_more": {
            "type": "boolean",
            "title": "Has More"
          }
        },
        "type": "object",
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "has_more"
        ],
        "title": "PaginatedResponse[PositionResponse]"
      },
      "app__schemas__common__PaginatedResponse_PositionResponse___2": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/app__schemas__positions__PositionResponse"
            },
            "type": "array",
            "title": "Items"
          },
          "total": {
            "type": "integer",
            "title": "Total"
          },
          "limit": {
            "type": "integer",
            "title": "Limit"
          },
          "offset": {
            "type": "integer",
            "title": "Offset"
          },
          "has_more": {
            "type": "boolean",
            "title": "Has More"
          }
        },
        "type": "object",
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "has_more"
        ],
        "title": "PaginatedResponse[PositionResponse]"
      },
      "app__schemas__common__PaginatedResponse_SnapshotResponse___1": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/app__schemas__v1__markets__SnapshotResponse"
            },
            "type": "array",
            "title": "Items"
          },
          "total": {
            "type": "integer",
            "title": "Total"
          },
          "limit": {
            "type": "integer",
            "title": "Limit"
          },
          "offset": {
            "type": "integer",
            "title": "Offset"
          },
          "has_more": {
            "type": "boolean",
            "title": "Has More"
          }
        },
        "type": "object",
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "has_more"
        ],
        "title": "PaginatedResponse[SnapshotResponse]"
      },
      "app__schemas__common__PaginatedResponse_SnapshotResponse___2": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/app__schemas__markets__SnapshotResponse"
            },
            "type": "array",
            "title": "Items"
          },
          "total": {
            "type": "integer",
            "title": "Total"
          },
          "limit": {
            "type": "integer",
            "title": "Limit"
          },
          "offset": {
            "type": "integer",
            "title": "Offset"
          },
          "has_more": {
            "type": "boolean",
            "title": "Has More"
          }
        },
        "type": "object",
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "has_more"
        ],
        "title": "PaginatedResponse[SnapshotResponse]"
      },
      "app__schemas__common__PaginatedResponse_TradeResponse___1": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/app__schemas__v1__markets__TradeResponse"
            },
            "type": "array",
            "title": "Items"
          },
          "total": {
            "type": "integer",
            "title": "Total"
          },
          "limit": {
            "type": "integer",
            "title": "Limit"
          },
          "offset": {
            "type": "integer",
            "title": "Offset"
          },
          "has_more": {
            "type": "boolean",
            "title": "Has More"
          }
        },
        "type": "object",
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "has_more"
        ],
        "title": "PaginatedResponse[TradeResponse]"
      },
      "app__schemas__common__PaginatedResponse_TradeResponse___2": {
        "properties": {
          "items": {
            "items": {
              "$ref": "#/components/schemas/app__schemas__markets__TradeResponse"
            },
            "type": "array",
            "title": "Items"
          },
          "total": {
            "type": "integer",
            "title": "Total"
          },
          "limit": {
            "type": "integer",
            "title": "Limit"
          },
          "offset": {
            "type": "integer",
            "title": "Offset"
          },
          "has_more": {
            "type": "boolean",
            "title": "Has More"
          }
        },
        "type": "object",
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "has_more"
        ],
        "title": "PaginatedResponse[TradeResponse]"
      },
      "app__schemas__markets__LiveMarketResponse": {
        "properties": {
          "perp_address": {
            "type": "string",
            "title": "Perp Address"
          },
          "perp": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Perp",
            "description": "Deprecated alias for perp_address"
          },
          "mark_price": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Mark Price",
            "description": "Deprecated: use spot_price or fair_mark_price. Pool spot price from the latest perp_snapshot."
          },
          "index_price": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Index Price",
            "description": "Index from the latest beacon_snapshot for the perp's beacon."
          },
          "funding_rate_daily": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Funding Rate Daily",
            "description": "Deprecated: use funding_per_day_usd (same unit) or funding_rate_per_day. Despite the name, USD per 1 perp per day, not a rate."
          },
          "fair_mark_price": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fair Mark Price",
            "description": "The contract mark: the pricing module's fairPrice, avg(spot, max(index + ema_mark - ema_index, 0)), from the latest pool state and the beacon's latest print. PnL, position value and margin checks use this price. Null when the pricing module is unknown or the pool has no price yet."
          },
          "spot_price": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Spot Price",
            "description": "Pool spot price, decoded from sqrt_price_x96."
          },
          "funding_per_day_usd": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Funding Per Day Usd",
            "description": "Funding in USD per 1 perp per day (positive = longs pay)."
          },
          "funding_rate_per_day": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Funding Rate Per Day",
            "description": "Daily funding rate as a fraction of price: funding_per_day_usd / ema_mark_price (0.01 = 1%/day). Null before the first EMA."
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "title": "Timestamp"
          }
        },
        "type": "object",
        "required": [
          "perp_address",
          "mark_price",
          "timestamp"
        ],
        "title": "LiveMarketResponse"
      },
      "app__schemas__markets__MarketDetailResponse": {
        "properties": {
          "market": {
            "$ref": "#/components/schemas/app__schemas__markets__MarketResponse"
          },
          "latest_snapshot": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/app__schemas__markets__SnapshotResponse"
              },
              {
                "type": "null"
              }
            ]
          },
          "live": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/app__schemas__markets__LiveMarketResponse"
              },
              {
                "type": "null"
              }
            ],
            "description": "Live mark/index/funding folded in (None if no snapshot data yet)"
          }
        },
        "type": "object",
        "required": [
          "market"
        ],
        "title": "MarketDetailResponse"
      },
      "app__schemas__markets__MarketResponse": {
        "properties": {
          "perp_address": {
            "type": "string",
            "title": "Perp Address",
            "description": "Perp contract address, hex"
          },
          "perp": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Perp",
            "description": "Deprecated alias for perp_address"
          },
          "beacon_address": {
            "type": "string",
            "title": "Beacon Address",
            "description": "Beacon address, hex"
          },
          "owner": {
            "type": "string",
            "title": "Owner"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "symbol": {
            "type": "string",
            "title": "Symbol"
          },
          "token_uri": {
            "type": "string",
            "title": "Token Uri"
          },
          "pool_id": {
            "type": "string",
            "title": "Pool Id"
          },
          "pricing_module": {
            "type": "string",
            "title": "Pricing Module"
          },
          "funding_module": {
            "type": "string",
            "title": "Funding Module"
          },
          "fees_module": {
            "type": "string",
            "title": "Fees Module"
          },
          "margin_ratios_module": {
            "type": "string",
            "title": "Margin Ratios Module"
          },
          "price_impact_module": {
            "type": "string",
            "title": "Price Impact Module"
          },
          "ema_window": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Ema Window"
          },
          "protocol_fee": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Protocol Fee"
          },
          "mark_price": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mark Price",
            "description": "Deprecated: use ema_mark_price (same value) or fair_mark_price. The EMA of the pool price, decoded from ema_amm_price_x96."
          },
          "index_price": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Index Price",
            "description": "Deprecated: use ema_index_price (same value). The EMA of the index, decoded from ema_index_price_x96."
          },
          "funding_rate_daily": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Funding Rate Daily",
            "description": "Deprecated: use funding_per_day_usd or funding_rate_per_day. The raw on-chain funding_per_day (WAD, 1e18 = 1 USD per perp per day)."
          },
          "fair_mark_price": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fair Mark Price",
            "description": "The contract mark: the pricing module's fairPrice, avg(spot, max(index + ema_mark - ema_index, 0)), from the latest pool state and the beacon's latest print. PnL, position value and margin checks use this price. Null when the pricing module is unknown or the pool has no price yet."
          },
          "spot_price": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Spot Price",
            "description": "Pool spot price, decoded from sqrt_price_x96."
          },
          "ema_mark_price": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ema Mark Price",
            "description": "EMA of the pool price, decoded from ema_amm_price_x96. The price funding is computed against."
          },
          "ema_index_price": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ema Index Price",
            "description": "EMA of the index, decoded from ema_index_price_x96."
          },
          "funding_per_day_usd": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Funding Per Day Usd",
            "description": "Funding in USD per 1 perp per day (positive = longs pay)."
          },
          "funding_rate_per_day": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Funding Rate Per Day",
            "description": "Daily funding rate as a fraction of price: funding_per_day_usd / ema_mark_price (0.01 = 1%/day). Null before the first EMA."
          },
          "open_interest_long": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Open Interest Long"
          },
          "open_interest_short": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Open Interest Short"
          },
          "capacity_long": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Capacity Long"
          },
          "capacity_short": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Capacity Short"
          },
          "liquidity": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Liquidity"
          },
          "tick": {
            "type": "integer",
            "title": "Tick"
          },
          "insurance": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Insurance"
          },
          "bad_debt": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Bad Debt"
          },
          "total_margin": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Total Margin"
          },
          "created_at": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Created At"
          },
          "last_touched_at": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Touched At"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Market description"
          },
          "photo_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Photo Url",
            "description": "Market photo URL"
          },
          "data_source": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Data Source",
            "description": "Data source identifier"
          },
          "card_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Card Label",
            "description": "Card display label"
          },
          "ticker": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ticker",
            "description": "Short ticker symbol"
          }
        },
        "type": "object",
        "required": [
          "perp_address",
          "beacon_address",
          "owner",
          "name",
          "symbol",
          "token_uri",
          "pool_id",
          "pricing_module",
          "funding_module",
          "fees_module",
          "margin_ratios_module",
          "price_impact_module",
          "ema_window",
          "protocol_fee",
          "open_interest_long",
          "open_interest_short",
          "capacity_long",
          "capacity_short",
          "liquidity",
          "tick",
          "insurance",
          "bad_debt",
          "total_margin"
        ],
        "title": "MarketResponse",
        "description": "Rich market state from the indexed `Perp` entity, plus optional\napp-backend cosmetics (graceful no-op if that DB isn't configured)."
      },
      "app__schemas__markets__SnapshotResponse": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "title": "Timestamp"
          },
          "perp_address": {
            "type": "string",
            "title": "Perp Address"
          },
          "perp": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Perp",
            "description": "Deprecated alias for perp_address"
          },
          "amm_price_x96": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Amm Price X96"
          },
          "mark_price": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mark Price",
            "description": "Derived from amm_price_x96: (x / 2**96)**2"
          }
        },
        "type": "object",
        "required": [
          "id",
          "timestamp",
          "perp_address",
          "amm_price_x96"
        ],
        "title": "SnapshotResponse",
        "description": "Per-AMM-tick market snapshot. See `app/schemas/v1/markets.py` for the\nv0.1.0 subgraph field-trimming notes -- unchanged here except the\nidentifier (`perp_address` canonical, `perp` deprecated alias)."
      },
      "app__schemas__markets__StatsResponse": {
        "properties": {
          "perp_address": {
            "type": "string",
            "title": "Perp Address"
          },
          "perp": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Perp",
            "description": "Deprecated alias for perp_address"
          },
          "price_24h_high": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Price 24H High"
          },
          "price_24h_low": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Price 24H Low"
          },
          "price_24h_change": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Price 24H Change"
          },
          "price_24h_change_percent": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Price 24H Change Percent"
          }
        },
        "type": "object",
        "required": [
          "perp_address",
          "price_24h_high",
          "price_24h_low",
          "price_24h_change",
          "price_24h_change_percent"
        ],
        "title": "StatsResponse"
      },
      "app__schemas__markets__TradeResponse": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "title": "Timestamp"
          },
          "perp_address": {
            "type": "string",
            "title": "Perp Address"
          },
          "perp": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Perp",
            "description": "Deprecated alias for perp_address"
          },
          "pos_id": {
            "type": "integer",
            "title": "Pos Id"
          },
          "was_liquidated": {
            "type": "boolean",
            "title": "Was Liquidated"
          },
          "perp_delta": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Perp Delta"
          },
          "usd_delta": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Usd Delta"
          },
          "mark_price": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mark Price"
          },
          "funding": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Funding"
          },
          "util_fees": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Util Fees"
          },
          "liq_fee": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Liq Fee"
          }
        },
        "type": "object",
        "required": [
          "id",
          "timestamp",
          "perp_address",
          "pos_id",
          "was_liquidated",
          "perp_delta",
          "usd_delta"
        ],
        "title": "TradeResponse",
        "description": "Recent close trade derived from `TakerAction` where `action_type='Close'`.\nSee `app/schemas/v1/markets.py` for field-provenance notes -- unchanged\nhere except the identifier (`perp_address` canonical, `perp` deprecated\nalias)."
      },
      "app__schemas__positions__LiquidatablePositionResponse": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id",
            "description": "On-chain position id (pos_id)"
          },
          "perp_address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Perp Address",
            "description": "Market (Perp) contract address, hex"
          },
          "perp": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Perp",
            "description": "Deprecated alias for perp_address"
          },
          "is_maker": {
            "type": "boolean",
            "title": "Is Maker"
          },
          "amount": {
            "type": "string",
            "title": "Amount",
            "description": "Full liquidation size as an integer string (base units): |perp_delta| for takers, liquidity for makers"
          },
          "mode": {
            "type": "string",
            "title": "Mode",
            "description": "Liquidation mode (V1 == full)",
            "default": "full"
          },
          "margin_ratio": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Margin Ratio",
            "description": "Approx indexed margin ratio (equity/notional); None if uncomputable"
          },
          "liq_margin_ratio": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Liq Margin Ratio",
            "description": "Maintenance (liquidation) margin ratio threshold, decimal form"
          },
          "as_of": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of",
            "description": "Unix ts of the mark snapshot used (indexed-data freshness)"
          },
          "holder": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Holder",
            "description": "Position holder wallet address, hex"
          },
          "notional": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Notional",
            "description": "|perp_delta| * mark_price; None if uncomputable"
          },
          "health": {
            "$ref": "#/components/schemas/LiquidatableHealth"
          },
          "distance_to_liquidation": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Distance To Liquidation",
            "description": "Unbuffered margin_ratio - liq_margin_ratio; non-positive means already past the raw (unbuffered) threshold"
          },
          "estimated_reward": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Estimated Reward",
            "description": "Rough indexed-only estimate of the liquidator reward -- a prioritization signal, NOT a guarantee of the on-chain payout"
          },
          "is_stale": {
            "type": "boolean",
            "title": "Is Stale",
            "description": "True if the indexed mark snapshot predates the staleness threshold, or freshness is unknown",
            "default": true
          }
        },
        "type": "object",
        "required": [
          "id",
          "is_maker",
          "amount"
        ],
        "title": "LiquidatablePositionResponse",
        "description": "A liquidatable CANDIDATE plus the params a liquidation bot needs.\n\nComputed from indexed data only (no on-chain `eth_call`) and PERMISSIVE by\ndesign: a row here means \"worth confirming\", NOT \"guaranteed liquidatable\".\nThe consuming bot MUST confirm exactly on-chain (gas-free simulate before\nsend) before spending gas.\n\nKeeps every `/v1` field for parity plus additive enrichment: `holder`,\n`notional`, `health`, `distance_to_liquidation`, `estimated_reward`,\n`is_stale`."
      },
      "app__schemas__positions__PositionResponse": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id",
            "description": "On-chain position id (pos_id)"
          },
          "open_timestamp": {
            "type": "integer",
            "title": "Open Timestamp"
          },
          "perp_address": {
            "type": "string",
            "title": "Perp Address",
            "description": "Market (Perp) contract address, hex"
          },
          "perp": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Perp",
            "description": "Deprecated alias for perp_address"
          },
          "holder": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Holder"
          },
          "is_maker": {
            "type": "boolean",
            "title": "Is Maker"
          },
          "is_long": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Long"
          },
          "is_closed": {
            "type": "boolean",
            "title": "Is Closed"
          },
          "close_timestamp": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Close Timestamp"
          },
          "was_liquidated": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Was Liquidated"
          },
          "margin": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Margin"
          },
          "perp_delta": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Perp Delta"
          },
          "usd_delta": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Usd Delta"
          },
          "avg_entry_amm_price_x96": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avg Entry Amm Price X96"
          },
          "liq_margin_ratio": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Liq Margin Ratio"
          },
          "backstop_margin_ratio": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Backstop Margin Ratio"
          },
          "current_mark_price": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Current Mark Price",
            "description": "The price unrealized_pnl and effective_margin are computed at: fair_mark_price, or spot_price when the pricing module is unknown."
          },
          "fair_mark_price": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Fair Mark Price",
            "description": "The contract mark: the pricing module's fairPrice, avg(spot, max(index + ema_mark - ema_index, 0)), from the latest pool state and the beacon's latest print. PnL, position value and margin checks use this price. Null when the pricing module is unknown or the pool has no price yet."
          },
          "spot_price": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Spot Price",
            "description": "Pool spot price, decoded from sqrt_price_x96."
          },
          "unrealized_pnl": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Unrealized Pnl",
            "description": "PnL of the open exposure at current_mark_price: perp_delta * current_mark_price + usd_delta, minus the realized_pnl already taken by earlier reduces, minus the utilization fee a taker owes since its last settle. Funding is in effective_margin."
          },
          "effective_margin": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Effective Margin",
            "description": "margin + perp_delta * current_mark_price + usd_delta + funding since the last settle, minus the utilization fee a taker owes. The equity the contract checks margin ratios against."
          }
        },
        "type": "object",
        "required": [
          "id",
          "open_timestamp",
          "perp_address",
          "is_maker",
          "is_closed"
        ],
        "title": "PositionResponse",
        "description": "Response shape for a single position from `/positions`.\n\nSourced from the v0.1.0 Goldsky `Position` entity (see\n`app/schemas/v1/positions.py` for field provenance notes -- unchanged\nhere except the identifier: `perp_address` is canonical, `perp` is a\ndeprecated alias carrying the same value."
      },
      "app__schemas__v1__markets__LiveMarketResponse": {
        "properties": {
          "perp_id": {
            "type": "string",
            "title": "Perp Id"
          },
          "mark_price": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Mark Price"
          },
          "index_price": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Index Price"
          },
          "funding_rate_daily": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Funding Rate Daily"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "title": "Timestamp"
          }
        },
        "type": "object",
        "required": [
          "perp_id",
          "mark_price",
          "timestamp"
        ],
        "title": "LiveMarketResponse"
      },
      "app__schemas__v1__markets__MarketDetailResponse": {
        "properties": {
          "market": {
            "$ref": "#/components/schemas/app__schemas__v1__markets__MarketResponse"
          },
          "latest_snapshot": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/app__schemas__v1__markets__SnapshotResponse"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "type": "object",
        "required": [
          "market"
        ],
        "title": "MarketDetailResponse"
      },
      "app__schemas__v1__markets__MarketResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id",
            "description": "Perp ID (hex)"
          },
          "beacon": {
            "type": "string",
            "title": "Beacon",
            "description": "Beacon address (hex)"
          },
          "name": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Name",
            "description": "Human-readable market name"
          },
          "ticker": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ticker",
            "description": "Short ticker symbol"
          },
          "description": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Description",
            "description": "Market description"
          },
          "photo_url": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Photo Url",
            "description": "Market photo URL"
          },
          "data_source": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Data Source",
            "description": "Data source identifier"
          },
          "card_label": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Card Label",
            "description": "Card display label"
          }
        },
        "type": "object",
        "required": [
          "id",
          "beacon"
        ],
        "title": "MarketResponse"
      },
      "app__schemas__v1__markets__SnapshotResponse": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "title": "Timestamp"
          },
          "perp": {
            "type": "string",
            "title": "Perp"
          },
          "amm_price_x96": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Amm Price X96"
          },
          "mark_price": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mark Price",
            "description": "Derived from amm_price_x96: (x / 2**96)**2"
          }
        },
        "type": "object",
        "required": [
          "id",
          "timestamp",
          "perp",
          "amm_price_x96"
        ],
        "title": "SnapshotResponse",
        "description": "Per-AMM-tick market snapshot.\n\nv0.1.0 trimmed `PerpSnapshot` down to `id`, `timestamp`, `perp`, and\n`amm_price_x96`. We expose a derived `mark_price` (= `(x / 2^96)^2`)\nfor backward-compat. The OI/notional fields previously on snapshot\nare now on `Perp` directly (current value only); historical OI must\nbe summed from `TakerAction.long_oi_delta` / `short_oi_delta` and is\nnot currently surfaced."
      },
      "app__schemas__v1__markets__StatsResponse": {
        "properties": {
          "perp_id": {
            "type": "string",
            "title": "Perp Id"
          },
          "price_24h_high": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Price 24H High"
          },
          "price_24h_low": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Price 24H Low"
          },
          "price_24h_change": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Price 24H Change"
          },
          "price_24h_change_percent": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Price 24H Change Percent"
          }
        },
        "type": "object",
        "required": [
          "perp_id",
          "price_24h_high",
          "price_24h_low",
          "price_24h_change",
          "price_24h_change_percent"
        ],
        "title": "StatsResponse"
      },
      "app__schemas__v1__markets__TradeResponse": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "timestamp": {
            "type": "string",
            "format": "date-time",
            "title": "Timestamp"
          },
          "perp": {
            "type": "string",
            "title": "Perp"
          },
          "pos_id": {
            "type": "integer",
            "title": "Pos Id"
          },
          "was_liquidated": {
            "type": "boolean",
            "title": "Was Liquidated"
          },
          "perp_delta": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Perp Delta"
          },
          "usd_delta": {
            "type": "string",
            "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$",
            "title": "Usd Delta"
          },
          "mark_price": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Mark Price"
          },
          "funding": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Funding"
          },
          "util_fees": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Util Fees"
          },
          "liq_fee": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Liq Fee"
          }
        },
        "type": "object",
        "required": [
          "id",
          "timestamp",
          "perp",
          "pos_id",
          "was_liquidated",
          "perp_delta",
          "usd_delta"
        ],
        "title": "TradeResponse",
        "description": "Recent close trade derived from `TakerAction` where\n`action_type='Close'`.\n\nField changes vs. the legacy schema:\n\n- `tx_hash` and `was_partial_close` are no longer in the subgraph and\n  have been dropped.\n- `was_maker` is removed -- this endpoint surfaces taker closes only.\n- `was_liquidated` maps to the new `liquidation` boolean.\n- `exit_perp_delta` / `exit_usd_delta` map to `perp_delta` / `usd_delta`.\n- `mark_price` is derived from `avg_execution_price_x96`."
      },
      "app__schemas__v1__positions__LiquidatablePositionResponse": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id",
            "description": "On-chain position id (pos_id)"
          },
          "perp": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Perp",
            "description": "Market (Perp) contract address, hex"
          },
          "is_maker": {
            "type": "boolean",
            "title": "Is Maker"
          },
          "amount": {
            "type": "string",
            "title": "Amount",
            "description": "Full liquidation size as an integer string (base units): |perp_delta| for takers, liquidity for makers"
          },
          "mode": {
            "type": "string",
            "title": "Mode",
            "description": "Liquidation mode (V1 == full)",
            "default": "full"
          },
          "margin_ratio": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Margin Ratio",
            "description": "Approx indexed margin ratio (equity/notional); None if uncomputable"
          },
          "liq_margin_ratio": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Liq Margin Ratio",
            "description": "Maintenance (liquidation) margin ratio threshold, decimal form"
          },
          "as_of": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "As Of",
            "description": "Unix ts of the mark snapshot used (indexed-data freshness)"
          }
        },
        "type": "object",
        "required": [
          "id",
          "is_maker",
          "amount"
        ],
        "title": "LiquidatablePositionResponse",
        "description": "A liquidatable CANDIDATE plus the params a liquidation bot needs.\n\nComputed from indexed data only (no on-chain `eth_call`) and PERMISSIVE by\ndesign: a row here means \"worth confirming\", NOT \"guaranteed liquidatable\".\nThe consuming bot MUST confirm exactly on-chain (gas-free simulate before\nsend) before spending gas."
      },
      "app__schemas__v1__positions__PositionResponse": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id",
            "description": "On-chain position id (pos_id)"
          },
          "open_timestamp": {
            "type": "integer",
            "title": "Open Timestamp"
          },
          "perp": {
            "type": "string",
            "title": "Perp"
          },
          "holder": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Holder"
          },
          "is_maker": {
            "type": "boolean",
            "title": "Is Maker"
          },
          "is_long": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Is Long"
          },
          "is_closed": {
            "type": "boolean",
            "title": "Is Closed"
          },
          "close_timestamp": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Close Timestamp"
          },
          "was_liquidated": {
            "anyOf": [
              {
                "type": "boolean"
              },
              {
                "type": "null"
              }
            ],
            "title": "Was Liquidated"
          },
          "margin": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Margin"
          },
          "perp_delta": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Perp Delta"
          },
          "usd_delta": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Usd Delta"
          },
          "avg_entry_amm_price_x96": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Avg Entry Amm Price X96"
          },
          "liq_margin_ratio": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Liq Margin Ratio"
          },
          "backstop_margin_ratio": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Backstop Margin Ratio"
          },
          "current_mark_price": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Current Mark Price"
          },
          "unrealized_pnl": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Unrealized Pnl"
          },
          "effective_margin": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!^[-+.]*$)[+-]?0*\\d*\\.?\\d*$"
              },
              {
                "type": "null"
              }
            ],
            "title": "Effective Margin"
          }
        },
        "type": "object",
        "required": [
          "id",
          "open_timestamp",
          "perp",
          "is_maker",
          "is_closed"
        ],
        "title": "PositionResponse",
        "description": "Response shape for a single position from `/v1/positions`.\n\nThe wire shape preserves the keys clients have historically depended on\n(`id`, `perp`, `is_long`, `was_liquidated`, `open_timestamp`,\n`close_timestamp`) while sourcing them from the v0.1.0 Goldsky entity:\n\n- `id` is the on-chain `pos_id` (BigInt) -- the subgraph's bytes-typed\n  `id` is the internal entity hash and not what consumers want.\n- `is_long` is derived from `sign(perp_delta)` since the subgraph no\n  longer exposes it directly.\n- `was_liquidated` coalesces the new `wasMakerLiquidated` and\n  `wasTakerLiquidated` booleans.\n- `open_timestamp` / `close_timestamp` are aliased onto the renamed\n  `openedAtTimestamp` / `closedAtTimestamp`.\n\nNew fields surfaced from v0.1.0: `margin`, `perp_delta`, `usd_delta`,\n`liq_margin_ratio`, `backstop_margin_ratio`, `avg_entry_amm_price_x96`."
      },
      "MeResponse": {
        "properties": {
          "api_key": {
            "$ref": "#/components/schemas/MeKeyInfo"
          },
          "privy_did": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Privy Did"
          },
          "trading_address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Trading Address",
            "description": "Lowercase hex address of the smart wallet this key acts for; null when unbound."
          }
        },
        "type": "object",
        "required": [
          "api_key",
          "privy_did",
          "trading_address"
        ],
        "title": "MeResponse",
        "description": "The calling key (never its secret) and the account it acts for."
      },
      "MeKeyInfo": {
        "properties": {
          "id": {
            "type": "integer",
            "title": "Id"
          },
          "name": {
            "type": "string",
            "title": "Name"
          },
          "key_preview": {
            "type": "string",
            "title": "Key Preview"
          },
          "is_active": {
            "type": "boolean",
            "title": "Is Active"
          },
          "created_at": {
            "type": "string",
            "title": "Created At"
          },
          "last_used_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Used At"
          },
          "kind": {
            "type": "string",
            "enum": [
              "developer",
              "agent"
            ],
            "title": "Kind"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "read",
                "trade"
              ]
            },
            "title": "Scopes"
          },
          "expires_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Expires At"
          }
        },
        "type": "object",
        "required": [
          "id",
          "name",
          "key_preview",
          "is_active",
          "created_at",
          "kind",
          "scopes",
          "expires_at"
        ],
        "title": "MeKeyInfo",
        "description": "Key metadata as seen by the key itself."
      },
      "DeviceCodeResponse": {
        "type": "object",
        "title": "DeviceCodeResponse",
        "required": [
          "device_code",
          "user_code",
          "verification_uri",
          "verification_uri_complete",
          "expires_in",
          "interval"
        ],
        "properties": {
          "device_code": {
            "type": "string",
            "description": "Secret the device keeps and polls with. Never shown to the user."
          },
          "user_code": {
            "type": "string",
            "description": "Short code the user types or confirms on the verification page, e.g. BCDF-2345."
          },
          "verification_uri": {
            "type": "string"
          },
          "verification_uri_complete": {
            "type": "string",
            "description": "verification_uri with the user code pre-filled."
          },
          "expires_in": {
            "type": "integer",
            "description": "Seconds until the codes expire."
          },
          "interval": {
            "type": "integer",
            "description": "Minimum seconds between polls."
          }
        }
      },
      "DeviceTokenResponse": {
        "type": "object",
        "title": "DeviceTokenResponse",
        "required": [
          "api_key",
          "privy_did",
          "trading_address"
        ],
        "properties": {
          "api_key": {
            "$ref": "#/components/schemas/NewKeyResponse"
          },
          "privy_did": {
            "type": "string"
          },
          "trading_address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "DeviceDecisionRequest": {
        "type": "object",
        "title": "DeviceDecisionRequest",
        "required": [
          "user_code",
          "action"
        ],
        "properties": {
          "user_code": {
            "type": "string",
            "description": "Any case, dash optional."
          },
          "action": {
            "type": "string",
            "enum": [
              "approve",
              "deny"
            ]
          }
        }
      },
      "DeviceDecisionResponse": {
        "type": "object",
        "title": "DeviceDecisionResponse",
        "required": [
          "status",
          "client_name",
          "trading_address"
        ],
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "approved",
              "denied"
            ]
          },
          "client_name": {
            "type": "string"
          },
          "trading_address": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "TradeOpenRequest": {
        "type": "object",
        "title": "TradeOpenRequest",
        "required": [
          "perp_address",
          "is_long",
          "margin",
          "leverage"
        ],
        "properties": {
          "perp_address": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$"
          },
          "is_long": {
            "type": "boolean"
          },
          "margin": {
            "type": "number",
            "exclusiveMinimum": 0,
            "description": "USDC, human units."
          },
          "leverage": {
            "type": "number",
            "exclusiveMinimum": 0
          },
          "slippage_pct": {
            "type": "number",
            "minimum": 0,
            "exclusiveMaximum": 100,
            "default": 1,
            "description": "Slippage tolerance in percent."
          }
        }
      },
      "TradeCloseRequest": {
        "type": "object",
        "title": "TradeCloseRequest",
        "required": [
          "perp_address",
          "position_id"
        ],
        "properties": {
          "perp_address": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$"
          },
          "position_id": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              {
                "type": "integer"
              }
            ]
          },
          "slippage_pct": {
            "type": "number",
            "minimum": 0,
            "exclusiveMaximum": 100,
            "default": 1,
            "description": "Slippage tolerance in percent."
          }
        }
      },
      "TradeAdjustRequest": {
        "type": "object",
        "title": "TradeAdjustRequest",
        "required": [
          "perp_address",
          "position_id"
        ],
        "properties": {
          "perp_address": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$"
          },
          "position_id": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[0-9]+$"
              },
              {
                "type": "integer"
              }
            ]
          },
          "margin_delta": {
            "type": "number",
            "default": 0,
            "description": "USDC, human units; positive adds margin, negative removes it."
          },
          "perp_delta": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^-?[0-9]+$"
              },
              {
                "type": "integer"
              }
            ],
            "default": "0",
            "description": "Contract-native perp delta to add; 0 for a margin-only adjustment."
          },
          "slippage_pct": {
            "type": "number",
            "minimum": 0,
            "exclusiveMaximum": 100,
            "default": 1,
            "description": "Slippage tolerance in percent."
          }
        }
      },
      "Execution": {
        "type": "object",
        "title": "Execution",
        "required": [
          "id",
          "status",
          "action",
          "perp_address",
          "trading_address",
          "params",
          "idempotency_key",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "id": {
            "type": "integer"
          },
          "status": {
            "type": "string",
            "enum": [
              "pending",
              "succeeded",
              "failed",
              "unknown"
            ]
          },
          "action": {
            "type": "string",
            "enum": [
              "open_taker",
              "close",
              "adjust_taker"
            ]
          },
          "perp_address": {
            "type": "string"
          },
          "trading_address": {
            "type": "string"
          },
          "params": {
            "type": "object"
          },
          "idempotency_key": {
            "type": "string"
          },
          "user_op_hash": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "tx_hash": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "position_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "description": "The position opened by this execution, when it opened one."
          },
          "error": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ]
          },
          "created_at": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          }
        }
      },
      "ExecutionPage": {
        "type": "object",
        "title": "ExecutionPage",
        "required": [
          "items",
          "total",
          "limit",
          "offset",
          "has_more"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Execution"
            }
          },
          "total": {
            "type": "integer"
          },
          "limit": {
            "type": "integer"
          },
          "offset": {
            "type": "integer"
          },
          "has_more": {
            "type": "boolean"
          }
        }
      }
    },
    "securitySchemes": {
      "ApiKeyHeader": {
        "type": "apiKey",
        "description": "API key passed in the X-API-Key request header. Keys are prefixed pc_bot_ and can be self-issued via POST /auth/keys (Privy-authenticated). See https://docs.perp.city/bot-api/authentication.",
        "in": "header",
        "name": "X-API-Key"
      },
      "APIKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-Admin-Secret"
      },
      "HTTPBearer": {
        "type": "http",
        "scheme": "bearer"
      }
    }
  }
}
