{
  "openapi" : "3.0.1",
  "info" : {
    "title" : "ValidTake Market API",
    "description" : "API for managing prediction markets with orderbooks",
    "version" : "1.0.0"
  },
  "paths" : {
    "/v1/health" : {
      "get" : {
        "tags" : [ "System" ],
        "summary" : "Health check",
        "description" : "Returns API health and Execution Venue connectivity status",
        "operationId" : "healthOperation",
        "responses" : {
          "200" : {
            "description" : "Service data",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/AppHealthResponse"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "403" : {
            "description" : "Forbidden",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orderbook/{orderbookId}/order/{orderId}" : {
      "delete" : {
        "tags" : [ "Trading" ],
        "summary" : "Cancel order",
        "description" : "Cancels an existing order on an orderbook",
        "operationId" : "cancelOrder",
        "parameters" : [ {
          "name" : "orderbookId",
          "in" : "path",
          "description" : "Orderbook ID",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          }
        }, {
          "name" : "orderId",
          "in" : "path",
          "description" : "Order ID",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "Order cancelled",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "503" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/faucet/claim" : {
      "post" : {
        "tags" : [ "Trading" ],
        "summary" : "Claim test tokens",
        "description" : "Sends the test site's fixed faucet amount to the authenticated user's deposit address, crediting their trading balance, at most once per cooldown.",
        "operationId" : "claimTestTokens",
        "responses" : {
          "200" : {
            "description" : "Transfer submitted",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/FaucetClaimResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "429" : {
            "description" : "Already claimed during the cooldown",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/FaucetCooldownResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "503" : {
            "description" : "No faucet on this site",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/deposit/address" : {
      "post" : {
        "tags" : [ "Trading" ],
        "summary" : "Create deposit address",
        "description" : "Creates or retrieves a Solana deposit address for the authenticated user.",
        "operationId" : "createDepositAddress",
        "responses" : {
          "200" : {
            "description" : "Deposit address",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/DepositAddressResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/market/{marketId}" : {
      "get" : {
        "tags" : [ "Market" ],
        "summary" : "Get market",
        "description" : "Returns a single market by ID when the caller has an older version",
        "operationId" : "getMarket",
        "parameters" : [ {
          "name" : "marketId",
          "in" : "path",
          "description" : "Market ID",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          }
        }, {
          "name" : "version",
          "in" : "query",
          "description" : "Caller market version; returns 204 when already current",
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "Market data",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/MarketResponse"
                }
              }
            }
          },
          "204" : {
            "description" : "Caller already has the latest market version"
          },
          "404" : {
            "description" : "Not found",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "503" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/markets" : {
      "get" : {
        "tags" : [ "Market" ],
        "summary" : "Get markets",
        "description" : "Returns a page of markets",
        "operationId" : "getMarkets",
        "parameters" : [ {
          "name" : "offset",
          "in" : "query",
          "description" : "Zero-based market offset",
          "schema" : {
            "type" : "integer",
            "format" : "int32"
          }
        }, {
          "name" : "limit",
          "in" : "query",
          "description" : "Maximum number of markets to return",
          "schema" : {
            "type" : "integer",
            "format" : "int32"
          }
        }, {
          "name" : "q",
          "in" : "query",
          "description" : "Filter markets by market name or orderbook question",
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "List of markets",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/MarketsResponse"
                }
              }
            }
          },
          "503" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orders" : {
      "get" : {
        "tags" : [ "Trading" ],
        "summary" : "Get open orders",
        "description" : "Get the authenticated user's currently resting (open) orders across all orderbooks.",
        "operationId" : "getOpenOrders",
        "responses" : {
          "200" : {
            "description" : "Open orders",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/OrdersResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/positions" : {
      "get" : {
        "tags" : [ "Trading" ],
        "summary" : "Get positions",
        "description" : "Get the authenticated user's current YES/NO share positions across all orderbooks.",
        "operationId" : "getPositions",
        "responses" : {
          "200" : {
            "description" : "Positions",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/PositionsResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/prices" : {
      "get" : {
        "tags" : [ "Market" ],
        "summary" : "Get price updates",
        "description" : "Returns price updates since the given counter",
        "operationId" : "getPrices",
        "parameters" : [ {
          "name" : "since",
          "in" : "query",
          "description" : "Counter value; returns entries after this counter",
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "Price updates",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/PricesResponse"
                }
              }
            }
          },
          "503" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/heartbeat" : {
      "get" : {
        "tags" : [ "Authentication" ],
        "summary" : "Heartbeat",
        "description" : "Prevent session token from expiry. Requires Bearer token in Authorization header.",
        "operationId" : "heartbeat",
        "responses" : {
          "204" : {
            "description" : "Session extended"
          },
          "401" : {
            "description" : "Unauthorized",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "429" : {
            "description" : "Too many requests",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "503" : {
            "description" : "Service unavailable",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/logout" : {
      "post" : {
        "tags" : [ "Authentication" ],
        "summary" : "Logout",
        "description" : "Invalidate the session token used to call this endpoint. Requires Bearer token in Authorization header.",
        "operationId" : "logout",
        "responses" : {
          "204" : {
            "description" : "Logged out"
          },
          "401" : {
            "description" : "Unauthorized",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "429" : {
            "description" : "Too many requests",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "503" : {
            "description" : "Service unavailable",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/orderbook/{orderbookId}/order" : {
      "post" : {
        "tags" : [ "Trading" ],
        "summary" : "Place order",
        "description" : "Places a new order on an orderbook",
        "operationId" : "placeOrder",
        "parameters" : [ {
          "name" : "orderbookId",
          "in" : "path",
          "description" : "Orderbook ID",
          "required" : true,
          "schema" : {
            "type" : "integer",
            "format" : "int64"
          }
        } ],
        "requestBody" : {
          "description" : "Order to place",
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/PlaceOrderRequest"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Order placed",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/PlaceOrderResponse"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "503" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/profile" : {
      "get" : {
        "tags" : [ "Authentication" ],
        "summary" : "Get profile",
        "description" : "Get the signed-in wallet's profile and balance.",
        "operationId" : "getProfile",
        "responses" : {
          "200" : {
            "description" : "Profile",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ProfileResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/time" : {
      "get" : {
        "tags" : [ "System" ],
        "summary" : "Server time",
        "description" : "Returns current server time",
        "operationId" : "getTime",
        "responses" : {
          "200" : {
            "description" : "Current server time",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/wallet/challenge" : {
      "get" : {
        "tags" : [ "Authentication" ],
        "summary" : "Get a login message",
        "description" : "Returns a one-line message for the withdrawal address to sign. The server keeps no record of it; the message proves its own freshness and is accepted once, for about an hour.",
        "operationId" : "walletLoginChallenge",
        "parameters" : [ {
          "name" : "address",
          "in" : "query",
          "description" : "Withdrawal address that will sign the message",
          "required" : true,
          "schema" : {
            "type" : "string"
          }
        }, {
          "name" : "domain",
          "in" : "query",
          "description" : "Domain the person is logging in to; defaults to the request host",
          "schema" : {
            "type" : "string"
          }
        } ],
        "responses" : {
          "200" : {
            "description" : "Message to sign",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/WalletLoginChallengeResponse"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "429" : {
            "description" : "Too many requests",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/auth/wallet" : {
      "post" : {
        "tags" : [ "Authentication" ],
        "summary" : "Log in with a signed message",
        "description" : "Exchange a login message from /v1/auth/wallet/challenge, signed by the withdrawal address, for a session token. The signature may cover the raw message or the Solana offchain message envelope. Each message is accepted once.",
        "operationId" : "walletSignIn",
        "requestBody" : {
          "description" : "Signed login message",
          "content" : {
            "application/json" : {
              "schema" : {
                "$ref" : "#/components/schemas/WalletSignInRequest"
              }
            }
          },
          "required" : true
        },
        "responses" : {
          "200" : {
            "description" : "Authenticated",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/WalletSignInResponse"
                }
              }
            }
          },
          "400" : {
            "description" : "Bad request",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "401" : {
            "description" : "Unauthorized",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "429" : {
            "description" : "Too many requests",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "500" : {
            "description" : "Internal server error",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          },
          "503" : {
            "description" : "Service unavailable",
            "content" : {
              "application/json" : {
                "schema" : {
                  "$ref" : "#/components/schemas/ApiResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components" : {
    "schemas" : {
      "AppHealthResponse" : {
        "type" : "object",
        "properties" : {
          "status" : {
            "type" : "string"
          },
          "ev" : {
            "type" : "string"
          }
        }
      },
      "ApiResponse" : {
        "type" : "object",
        "properties" : {
          "error_code" : {
            "type" : "string",
            "enum" : [ "HEALTHY", "SUCCESS", "UNAUTHORIZED", "EVENT_NOT_FOUND", "CURRENCIES_NOT_FOUND", "USER_NOT_FOUND", "NOT_FOUND", "METHOD_NOT_ALLOWED", "BAD_REQUEST", "ILLEGAL_OPERATION", "INSUFFICIENT_FUNDS", "AUTHENTICATION_FAILED", "USER_NOT_AUTHENTICATED", "INTERNAL_SERVER_ERROR", "SERVICE_UNAVAILABLE" ]
          },
          "error_message" : {
            "type" : "string"
          }
        }
      },
      "FaucetClaimResponse" : {
        "type" : "object",
        "properties" : {
          "signature" : {
            "type" : "string"
          },
          "amount_base_units" : {
            "type" : "integer",
            "format" : "int64"
          },
          "mint" : {
            "type" : "string"
          },
          "decimals" : {
            "type" : "integer",
            "format" : "int32"
          }
        }
      },
      "FaucetCooldownResponse" : {
        "type" : "object",
        "properties" : {
          "error_message" : {
            "type" : "string"
          },
          "next_eligible_at_millis" : {
            "type" : "integer",
            "format" : "int64"
          }
        }
      },
      "DepositAddressResponse" : {
        "type" : "object",
        "properties" : {
          "deposit_address" : {
            "type" : "string"
          }
        }
      },
      "DepthLevelResponse" : {
        "type" : "object",
        "properties" : {
          "price" : {
            "type" : "string"
          },
          "quantity" : {
            "type" : "integer",
            "format" : "int32"
          },
          "orderCount" : {
            "type" : "integer",
            "format" : "int32"
          }
        }
      },
      "MarketResponse" : {
        "type" : "object",
        "properties" : {
          "marketId" : {
            "type" : "string"
          },
          "name" : {
            "type" : "string"
          },
          "version" : {
            "type" : "integer",
            "format" : "int64"
          },
          "orderbooks" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/OrderbookResponse"
            }
          }
        }
      },
      "OrderbookResponse" : {
        "type" : "object",
        "properties" : {
          "orderbookId" : {
            "type" : "string"
          },
          "question" : {
            "type" : "string"
          },
          "conditions" : {
            "type" : "string"
          },
          "expiry" : {
            "type" : "string"
          },
          "opensAt" : {
            "type" : "string"
          },
          "closesAt" : {
            "type" : "string"
          },
          "status" : {
            "type" : "string",
            "enum" : [ "PENDING", "OPEN", "CLOSED", "SUSPENDED", "RESOLVED" ]
          },
          "outcome" : {
            "type" : "string",
            "enum" : [ "NONE", "YES", "NO" ]
          },
          "buyOrderCount" : {
            "type" : "integer",
            "format" : "int32"
          },
          "sellOrderCount" : {
            "type" : "integer",
            "format" : "int32"
          },
          "bestBid" : {
            "type" : "integer",
            "format" : "int32"
          },
          "bestAsk" : {
            "type" : "integer",
            "format" : "int32"
          },
          "priceHistory" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/PricePointResponse"
            }
          },
          "bidLevels" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/DepthLevelResponse"
            }
          },
          "askLevels" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/DepthLevelResponse"
            }
          }
        }
      },
      "PricePointResponse" : {
        "type" : "object",
        "properties" : {
          "time" : {
            "type" : "string"
          },
          "price" : {
            "type" : "integer",
            "format" : "int64"
          }
        }
      },
      "MarketsResponse" : {
        "type" : "object",
        "properties" : {
          "total" : {
            "type" : "integer",
            "format" : "int32"
          },
          "markets" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/MarketResponse"
            }
          }
        }
      },
      "Order" : {
        "type" : "object",
        "properties" : {
          "orderbook_id" : {
            "type" : "integer",
            "format" : "int64"
          },
          "order_id" : {
            "type" : "integer",
            "format" : "int64"
          },
          "side" : {
            "type" : "string",
            "enum" : [ "BUY", "SELL" ]
          },
          "outcome" : {
            "type" : "string",
            "enum" : [ "YES", "NO" ]
          },
          "price" : {
            "type" : "integer",
            "format" : "int64"
          },
          "quantity" : {
            "type" : "integer",
            "format" : "int32"
          }
        }
      },
      "OrdersResponse" : {
        "type" : "object",
        "properties" : {
          "orders" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/Order"
            }
          }
        }
      },
      "Position" : {
        "type" : "object",
        "properties" : {
          "orderbook_id" : {
            "type" : "integer",
            "format" : "int64"
          },
          "yes" : {
            "type" : "integer",
            "format" : "int64"
          },
          "no" : {
            "type" : "integer",
            "format" : "int64"
          },
          "reserved_yes" : {
            "type" : "integer",
            "format" : "int64"
          },
          "reserved_no" : {
            "type" : "integer",
            "format" : "int64"
          }
        }
      },
      "PositionsResponse" : {
        "type" : "object",
        "properties" : {
          "positions" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/Position"
            }
          }
        }
      },
      "PriceEntryResponse" : {
        "type" : "object",
        "properties" : {
          "counter" : {
            "type" : "integer",
            "format" : "int64"
          },
          "orderbookId" : {
            "type" : "string"
          },
          "price" : {
            "type" : "string"
          }
        }
      },
      "PricesResponse" : {
        "type" : "object",
        "properties" : {
          "counter" : {
            "type" : "integer",
            "format" : "int64"
          },
          "prices" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/PriceEntryResponse"
            }
          }
        }
      },
      "PlaceOrderRequest" : {
        "required" : [ "outcome", "price", "quantity", "side" ],
        "type" : "object",
        "properties" : {
          "side" : {
            "type" : "string",
            "enum" : [ "BUY", "SELL" ]
          },
          "outcome" : {
            "type" : "string",
            "enum" : [ "YES", "NO" ]
          },
          "price" : {
            "type" : "integer",
            "format" : "int64"
          },
          "quantity" : {
            "type" : "integer",
            "format" : "int32"
          }
        }
      },
      "PlaceOrderResponse" : {
        "type" : "object",
        "properties" : {
          "orderId" : {
            "type" : "integer",
            "format" : "int64"
          },
          "remainingQuantity" : {
            "type" : "integer",
            "format" : "int32"
          },
          "trades" : {
            "type" : "array",
            "items" : {
              "$ref" : "#/components/schemas/TradeResponse"
            }
          }
        }
      },
      "TradeResponse" : {
        "type" : "object",
        "properties" : {
          "price" : {
            "type" : "integer",
            "format" : "int64"
          },
          "quantity" : {
            "type" : "integer",
            "format" : "int32"
          },
          "buyUserId" : {
            "type" : "integer",
            "format" : "int64"
          },
          "sellUserId" : {
            "type" : "integer",
            "format" : "int64"
          }
        }
      },
      "ProfileResponse" : {
        "type" : "object",
        "properties" : {
          "user_id" : {
            "type" : "integer",
            "format" : "int64"
          },
          "wallet_address" : {
            "type" : "string"
          },
          "balance_cents" : {
            "type" : "integer",
            "format" : "int64"
          },
          "reserved_cents" : {
            "type" : "integer",
            "format" : "int64"
          },
          "currency" : {
            "type" : "string"
          },
          "deposit_address" : {
            "type" : "string"
          },
          "is_market_admin" : {
            "type" : "boolean"
          }
        }
      },
      "WalletLoginChallengeResponse" : {
        "required" : [ "message" ],
        "type" : "object",
        "properties" : {
          "message" : {
            "type" : "string",
            "description" : "One-line message to sign with the withdrawal address, valid for about an hour",
            "example" : "validtake.com login P2RD-7HQ3-KX9M"
          }
        }
      },
      "WalletSignInRequest" : {
        "required" : [ "address", "message", "signature" ],
        "type" : "object",
        "properties" : {
          "address" : {
            "type" : "string",
            "description" : "Withdrawal address that signed a login message from /v1/auth/wallet/challenge"
          },
          "message" : {
            "type" : "string",
            "description" : "Login message from /v1/auth/wallet/challenge, exactly as signed"
          },
          "signature" : {
            "type" : "string",
            "description" : "Base58 Ed25519 signature of the message"
          }
        }
      },
      "WalletSignInResponse" : {
        "type" : "object",
        "properties" : {
          "token" : {
            "type" : "string"
          },
          "address" : {
            "type" : "string"
          }
        }
      }
    }
  }
}