{
  "openapi": "3.1.0",
  "info": {
    "title": "MNX Exchange API",
    "version": "0",
    "description": "Public REST API for the MNX derivatives exchange. Generated from the API registry in common/src/api/schema.ts."
  },
  "servers": [
    {
      "url": "https://api.app.mnx.fi",
      "description": "Production"
    },
    {
      "url": "https://api.testnet.mnx.fi",
      "description": "Testnet"
    }
  ],
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Authenticated endpoints require an Authorization header. Full authentication documentation is planned for a later docs increment."
      }
    }
  },
  "paths": {
    "/v0/account/adjust-leverage": {
      "post": {
        "operationId": "account_adjust_leverage",
        "summary": "account/adjust-leverage",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "symbol": {
                    "type": "string"
                  },
                  "market_id": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "address": {
                    "type": "string"
                  },
                  "leverage": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "signature": {
                    "type": "string"
                  },
                  "nonce": {
                    "type": "number",
                    "minimum": 0
                  },
                  "order_action": {
                    "default": "cancel",
                    "type": "string",
                    "enum": [
                      "cancel"
                    ]
                  }
                },
                "required": [
                  "symbol",
                  "address",
                  "leverage",
                  "signature",
                  "nonce"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "adjustment_id": {
                      "type": "string"
                    },
                    "read_after": {
                      "type": "object",
                      "properties": {
                        "shard_id": {
                          "type": "string"
                        },
                        "shard_seq": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "shard_id",
                        "shard_seq"
                      ]
                    },
                    "execution": {
                      "type": "object",
                      "properties": {
                        "relayer_id": {
                          "type": "string"
                        },
                        "nonce": {
                          "type": "string"
                        },
                        "tx_hash": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "relayer_id",
                        "nonce",
                        "tx_hash"
                      ]
                    },
                    "market_id": {
                      "type": "number"
                    },
                    "symbol": {
                      "type": "string"
                    },
                    "perpetual_address": {
                      "type": "string"
                    },
                    "tx_hash": {
                      "type": "string"
                    },
                    "called_by": {
                      "type": "string"
                    },
                    "gas_used": {
                      "type": "string"
                    },
                    "cancelled_orders": {
                      "type": "number"
                    },
                    "recreated_orders": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "success",
                    "adjustment_id",
                    "read_after",
                    "execution",
                    "market_id",
                    "symbol",
                    "perpetual_address",
                    "tx_hash",
                    "called_by",
                    "cancelled_orders",
                    "recreated_orders"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/account/adjust-margin": {
      "post": {
        "operationId": "account_adjust_margin",
        "summary": "account/adjust-margin",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "symbol": {
                    "type": "string"
                  },
                  "market_id": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "address": {
                    "type": "string"
                  },
                  "amount": {
                    "type": "number"
                  },
                  "signature": {
                    "type": "string"
                  },
                  "nonce": {
                    "type": "number",
                    "minimum": 0
                  },
                  "remove_mode": {
                    "default": "exact",
                    "type": "string",
                    "enum": [
                      "exact",
                      "up_to"
                    ]
                  },
                  "min_amount": {
                    "default": 0,
                    "type": "number",
                    "minimum": 0
                  }
                },
                "required": [
                  "symbol",
                  "address",
                  "amount",
                  "signature",
                  "nonce"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "adjustment_id": {
                      "type": "string"
                    },
                    "read_after": {
                      "type": "object",
                      "properties": {
                        "shard_id": {
                          "type": "string"
                        },
                        "shard_seq": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "shard_id",
                        "shard_seq"
                      ]
                    },
                    "execution": {
                      "type": "object",
                      "properties": {
                        "relayer_id": {
                          "type": "string"
                        },
                        "nonce": {
                          "type": "string"
                        },
                        "tx_hash": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "relayer_id",
                        "nonce",
                        "tx_hash"
                      ]
                    },
                    "market_id": {
                      "type": "number"
                    },
                    "symbol": {
                      "type": "string"
                    },
                    "perpetual_address": {
                      "type": "string"
                    },
                    "amount": {
                      "type": "number"
                    },
                    "max_removable_amount": {
                      "type": "number"
                    },
                    "tx_hash": {
                      "type": "string"
                    },
                    "called_by": {
                      "type": "string"
                    },
                    "gas_used": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "success",
                    "adjustment_id",
                    "read_after",
                    "execution",
                    "market_id",
                    "symbol",
                    "perpetual_address",
                    "amount",
                    "tx_hash",
                    "called_by"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/account/adjustment-attempts": {
      "get": {
        "operationId": "account_adjustment_attempts",
        "summary": "account/adjustment-attempts",
        "parameters": [
          {
            "name": "adjustment_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "market_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "add_margin",
                "remove_margin",
                "adjust_leverage"
              ]
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "PREPARED",
                "SIGNED",
                "SUBMITTED",
                "COMMITTED",
                "ABORTED",
                "RECEIPT_RECONCILIATION_FAILED"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "attempts": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "adjustment_id": {
                            "type": "string"
                          },
                          "user_id": {
                            "type": "number"
                          },
                          "market_id": {
                            "type": "number"
                          },
                          "kind": {
                            "type": "string",
                            "enum": [
                              "adjust_leverage",
                              "add_margin",
                              "remove_margin"
                            ]
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "PREPARED",
                              "SUBMITTED",
                              "SIGNED",
                              "COMMITTED",
                              "ABORTED",
                              "RECEIPT_RECONCILIATION_FAILED"
                            ]
                          },
                          "amount_e18_raw": {
                            "type": "string"
                          },
                          "new_leverage_raw": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "tx_hash": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "failure_kind": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string",
                                "const": "no_account_adjustment_position_updates"
                              },
                              {
                                "type": "string",
                                "const": "no_liquidation_settlement_events"
                              },
                              {
                                "type": "string",
                                "const": "backstop_inheritance_failed_only"
                              },
                              {
                                "type": "string",
                                "const": "no_adl_settlement_events"
                              },
                              {
                                "type": "string",
                                "const": "no_adl_trade_events"
                              },
                              {
                                "type": "string",
                                "const": "no_trade_execution_events"
                              },
                              {
                                "type": "string",
                                "const": "trade_events_without_position_updates"
                              },
                              {
                                "type": "string",
                                "const": "missing_expected_participants"
                              },
                              {
                                "type": "string",
                                "const": "missing_expected_position_updates"
                              },
                              {
                                "type": "string",
                                "const": "invalid_position_update_participant_coverage"
                              },
                              {
                                "type": "string",
                                "const": "invalid_batch_trade_participant_coverage"
                              },
                              {
                                "type": "string",
                                "const": "invalid_forced_book_liquidation_fill_coverage"
                              },
                              {
                                "type": "string",
                                "const": "receipt_decode_exception"
                              }
                            ]
                          },
                          "failure_reason": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "created_at": {
                            "type": "string"
                          },
                          "updated_at": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "adjustment_id",
                          "user_id",
                          "market_id",
                          "kind",
                          "status",
                          "amount_e18_raw",
                          "new_leverage_raw",
                          "tx_hash",
                          "failure_kind",
                          "failure_reason",
                          "created_at",
                          "updated_at"
                        ]
                      }
                    }
                  },
                  "required": [
                    "attempts"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/account/transactions": {
      "get": {
        "operationId": "account_transactions",
        "summary": "account/transactions",
        "parameters": [
          {
            "name": "transaction_type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "deposit",
                "withdrawal",
                "add_margin",
                "remove_margin",
                "adjust_leverage",
                "funding_payment",
                "liquidation",
                "market_delisting_payout"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "cursor_created_at",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time",
              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z))$"
            }
          },
          {
            "name": "cursor_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "minLength": 1
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "exclusiveMinimum": 0,
              "maximum": 9007199254740991
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "transactions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string"
                          },
                          "transaction_type": {
                            "type": "string",
                            "enum": [
                              "deposit",
                              "withdrawal",
                              "adjust_leverage",
                              "funding_payment",
                              "add_margin",
                              "remove_margin",
                              "liquidation",
                              "market_delisting_payout"
                            ]
                          },
                          "amount_e18_raw": {
                            "type": "string"
                          },
                          "available_margin_delta_e18_raw": {
                            "type": "string"
                          },
                          "funding_payment_delta_e18_raw": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "asset": {
                            "type": "string",
                            "const": "USDM"
                          },
                          "market_id": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "market_symbol": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "tx_hash": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "log_index": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "block_number": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "created_at": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "transaction_type",
                          "amount_e18_raw",
                          "available_margin_delta_e18_raw",
                          "funding_payment_delta_e18_raw",
                          "asset",
                          "market_id",
                          "market_symbol",
                          "tx_hash",
                          "log_index",
                          "block_number",
                          "created_at"
                        ]
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "limit": {
                          "type": "number"
                        },
                        "count": {
                          "type": "number"
                        },
                        "has_more": {
                          "type": "boolean"
                        },
                        "next_cursor": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "created_at": {
                                  "type": "string"
                                },
                                "id": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "created_at",
                                "id"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "limit",
                        "count",
                        "has_more",
                        "next_cursor"
                      ]
                    }
                  },
                  "required": [
                    "transactions",
                    "pagination"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/account/withdraw": {
      "post": {
        "operationId": "account_withdraw",
        "summary": "account/withdraw",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "string"
                  },
                  "destination_address": {
                    "type": "string"
                  },
                  "amount": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^(?:0\\.\\d*[1-9]\\d*|[1-9]\\d*(?:\\.\\d+)?)$"
                      },
                      {
                        "type": "number",
                        "exclusiveMinimum": 0
                      }
                    ]
                  },
                  "signature": {
                    "type": "string"
                  },
                  "nonce": {
                    "type": "string",
                    "pattern": "^\\d+$"
                  },
                  "deadline": {
                    "type": "string",
                    "pattern": "^\\d+$"
                  }
                },
                "required": [
                  "address",
                  "destination_address",
                  "amount",
                  "signature",
                  "nonce",
                  "deadline"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "withdrawal_id": {
                      "type": "string"
                    },
                    "read_after": {
                      "type": "object",
                      "properties": {
                        "shard_id": {
                          "type": "string"
                        },
                        "shard_seq": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "shard_id",
                        "shard_seq"
                      ]
                    },
                    "execution": {
                      "type": "object",
                      "properties": {
                        "relayer_id": {
                          "type": "string"
                        },
                        "nonce": {
                          "type": "string"
                        },
                        "tx_hash": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "relayer_id",
                        "nonce",
                        "tx_hash"
                      ]
                    },
                    "owner_address": {
                      "type": "string"
                    },
                    "destination_address": {
                      "type": "string"
                    },
                    "margin_bank_address": {
                      "type": "string"
                    },
                    "collateral_token_address": {
                      "type": "string"
                    },
                    "collateral_token_decimals": {
                      "type": "number"
                    },
                    "amount": {
                      "anyOf": [
                        {
                          "type": "string"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    },
                    "amount_e18_raw": {
                      "type": "string"
                    },
                    "amount_token_raw": {
                      "type": "string"
                    },
                    "tx_hash": {
                      "type": "string"
                    },
                    "called_by": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "success",
                    "withdrawal_id",
                    "execution",
                    "owner_address",
                    "destination_address",
                    "margin_bank_address",
                    "collateral_token_address",
                    "collateral_token_decimals",
                    "amount",
                    "amount_e18_raw",
                    "amount_token_raw",
                    "tx_hash",
                    "called_by"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/account/withdraw/next-nonce": {
      "get": {
        "operationId": "account_withdraw_next_nonce",
        "summary": "account/withdraw/next-nonce",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "owner_address": {
                      "type": "string"
                    },
                    "margin_bank_address": {
                      "type": "string"
                    },
                    "collateral_token_address": {
                      "type": "string"
                    },
                    "collateral_token_decimals": {
                      "type": "number"
                    },
                    "next_withdrawal_nonce": {
                      "type": "string"
                    },
                    "suggested_deadline": {
                      "type": "number"
                    },
                    "read_after": {
                      "type": "object",
                      "properties": {
                        "shard_id": {
                          "type": "string"
                        },
                        "shard_seq": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "shard_id",
                        "shard_seq"
                      ]
                    }
                  },
                  "required": [
                    "owner_address",
                    "margin_bank_address",
                    "collateral_token_address",
                    "collateral_token_decimals",
                    "next_withdrawal_nonce",
                    "suggested_deadline"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/auth/authorize": {
      "post": {
        "operationId": "auth_authorize",
        "summary": "auth/authorize",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "signature": {
                    "type": "string"
                  },
                  "userAddress": {
                    "type": "string"
                  },
                  "isTermAccepted": {
                    "type": "boolean"
                  },
                  "invite_code": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "accepted_risk_disclaimer": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "signature",
                  "userAddress",
                  "isTermAccepted"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "token": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "token"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/balance/{user_id}/margin": {
      "get": {
        "operationId": "balance_user_id_margin",
        "summary": "balance/:user_id/margin",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "balance": {
                      "type": "object",
                      "properties": {
                        "user_id": {
                          "type": "number"
                        },
                        "total": {
                          "type": "number"
                        },
                        "available": {
                          "type": "number"
                        },
                        "reserved": {
                          "type": "number"
                        },
                        "last_updated": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "user_id",
                        "total",
                        "available",
                        "reserved",
                        "last_updated"
                      ]
                    }
                  },
                  "required": [
                    "balance"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/balance/{user_id}/market-state/{market_id}": {
      "get": {
        "operationId": "balance_user_id_market_state_market_id",
        "summary": "balance/:user_id/market-state/:market_id",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "market_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "balance": {
                      "type": "object",
                      "properties": {
                        "user_id": {
                          "type": "number"
                        },
                        "total": {
                          "type": "number"
                        },
                        "available": {
                          "type": "number"
                        },
                        "reserved": {
                          "type": "number"
                        },
                        "last_updated": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "user_id",
                        "total",
                        "available",
                        "reserved",
                        "last_updated"
                      ]
                    },
                    "position": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "user_id": {
                              "type": "number"
                            },
                            "market_id": {
                              "type": "number"
                            },
                            "size": {
                              "type": "number"
                            },
                            "size_e18_raw": {
                              "type": "string"
                            },
                            "used_margin": {
                              "type": "number"
                            },
                            "used_margin_e18_raw": {
                              "type": "string"
                            },
                            "realized_pnl": {
                              "type": "number"
                            },
                            "realized_pnl_e18_raw": {
                              "type": "string"
                            },
                            "last_applied_funding_index": {
                              "type": "number"
                            },
                            "last_applied_funding_index_e18_raw": {
                              "type": "string"
                            },
                            "updated_time": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "oi_open": {
                              "type": "number"
                            },
                            "oi_open_e18_raw": {
                              "type": "string"
                            },
                            "leverage_e18_raw": {
                              "type": "string"
                            },
                            "margin_ratio_open": {
                              "type": "number"
                            },
                            "margin_ratio_open_e18_raw": {
                              "type": "string"
                            },
                            "last_event_id": {
                              "type": "number"
                            },
                            "last_block_number": {
                              "type": "number"
                            },
                            "last_tx_index": {
                              "type": "number"
                            },
                            "last_log_index": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "user_id",
                            "market_id",
                            "size",
                            "size_e18_raw",
                            "used_margin",
                            "used_margin_e18_raw",
                            "realized_pnl",
                            "realized_pnl_e18_raw",
                            "last_applied_funding_index",
                            "last_applied_funding_index_e18_raw",
                            "updated_time",
                            "oi_open",
                            "oi_open_e18_raw",
                            "leverage_e18_raw",
                            "margin_ratio_open",
                            "margin_ratio_open_e18_raw",
                            "last_event_id",
                            "last_block_number",
                            "last_tx_index",
                            "last_log_index"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "balance",
                    "position"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/balance/{user_id}/onchain-margin": {
      "get": {
        "operationId": "balance_user_id_onchain_margin",
        "summary": "balance/:user_id/onchain-margin",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user_id": {
                      "type": "number"
                    },
                    "eoa_address": {
                      "type": "string"
                    },
                    "balance": {
                      "type": "number"
                    },
                    "balance_e18_raw": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "user_id",
                    "eoa_address",
                    "balance",
                    "balance_e18_raw"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/balance/{user_id}/position/{market_id}": {
      "get": {
        "operationId": "balance_user_id_position_market_id",
        "summary": "balance/:user_id/position/:market_id",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "market_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "position": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "user_id": {
                              "type": "number"
                            },
                            "market_id": {
                              "type": "number"
                            },
                            "size": {
                              "type": "number"
                            },
                            "size_e18_raw": {
                              "type": "string"
                            },
                            "used_margin": {
                              "type": "number"
                            },
                            "used_margin_e18_raw": {
                              "type": "string"
                            },
                            "realized_pnl": {
                              "type": "number"
                            },
                            "realized_pnl_e18_raw": {
                              "type": "string"
                            },
                            "last_applied_funding_index": {
                              "type": "number"
                            },
                            "last_applied_funding_index_e18_raw": {
                              "type": "string"
                            },
                            "updated_time": {
                              "type": "string",
                              "format": "date-time"
                            },
                            "oi_open": {
                              "type": "number"
                            },
                            "oi_open_e18_raw": {
                              "type": "string"
                            },
                            "leverage_e18_raw": {
                              "type": "string"
                            },
                            "margin_ratio_open": {
                              "type": "number"
                            },
                            "margin_ratio_open_e18_raw": {
                              "type": "string"
                            },
                            "last_event_id": {
                              "type": "number"
                            },
                            "last_block_number": {
                              "type": "number"
                            },
                            "last_tx_index": {
                              "type": "number"
                            },
                            "last_log_index": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "user_id",
                            "market_id",
                            "size",
                            "size_e18_raw",
                            "used_margin",
                            "used_margin_e18_raw",
                            "realized_pnl",
                            "realized_pnl_e18_raw",
                            "last_applied_funding_index",
                            "last_applied_funding_index_e18_raw",
                            "updated_time",
                            "oi_open",
                            "oi_open_e18_raw",
                            "leverage_e18_raw",
                            "margin_ratio_open",
                            "margin_ratio_open_e18_raw",
                            "last_event_id",
                            "last_block_number",
                            "last_tx_index",
                            "last_log_index"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "position"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/balance/{user_id}/positions": {
      "get": {
        "operationId": "balance_user_id_positions",
        "summary": "balance/:user_id/positions",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user_id": {
                      "type": "number"
                    },
                    "positions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "user_id": {
                            "type": "number"
                          },
                          "market_id": {
                            "type": "number"
                          },
                          "size": {
                            "type": "number"
                          },
                          "size_e18_raw": {
                            "type": "string"
                          },
                          "used_margin": {
                            "type": "number"
                          },
                          "used_margin_e18_raw": {
                            "type": "string"
                          },
                          "realized_pnl": {
                            "type": "number"
                          },
                          "realized_pnl_e18_raw": {
                            "type": "string"
                          },
                          "last_applied_funding_index": {
                            "type": "number"
                          },
                          "last_applied_funding_index_e18_raw": {
                            "type": "string"
                          },
                          "updated_time": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "oi_open": {
                            "type": "number"
                          },
                          "oi_open_e18_raw": {
                            "type": "string"
                          },
                          "leverage_e18_raw": {
                            "type": "string"
                          },
                          "margin_ratio_open": {
                            "type": "number"
                          },
                          "margin_ratio_open_e18_raw": {
                            "type": "string"
                          },
                          "last_event_id": {
                            "type": "number"
                          },
                          "last_block_number": {
                            "type": "number"
                          },
                          "last_tx_index": {
                            "type": "number"
                          },
                          "last_log_index": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "user_id",
                          "market_id",
                          "size",
                          "size_e18_raw",
                          "used_margin",
                          "used_margin_e18_raw",
                          "realized_pnl",
                          "realized_pnl_e18_raw",
                          "last_applied_funding_index",
                          "last_applied_funding_index_e18_raw",
                          "updated_time",
                          "oi_open",
                          "oi_open_e18_raw",
                          "leverage_e18_raw",
                          "margin_ratio_open",
                          "margin_ratio_open_e18_raw",
                          "last_event_id",
                          "last_block_number",
                          "last_tx_index",
                          "last_log_index"
                        ]
                      }
                    }
                  },
                  "required": [
                    "user_id",
                    "positions"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/contracts/addresses": {
      "get": {
        "operationId": "contracts_addresses",
        "summary": "contracts/addresses",
        "parameters": [
          {
            "name": "symbol",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "auxiliaryContractsAddresses": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "auxiliaryContractsAddresses"
                  ],
                  "additionalProperties": {
                    "type": "object",
                    "additionalProperties": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v0/contracts/shared": {
      "get": {
        "operationId": "contracts_shared",
        "summary": "contracts/shared",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "addressCollateralToken": {
                      "type": "string"
                    },
                    "addressGuardian": {
                      "type": "string"
                    },
                    "addressMarginBank": {
                      "type": "string"
                    },
                    "trustedForwarder": {
                      "type": "string"
                    },
                    "addressAccountManager": {
                      "type": "string"
                    },
                    "addressMarginMath": {
                      "type": "string"
                    },
                    "addressSignatureVerifier": {
                      "type": "string"
                    },
                    "addressLiquidityVault": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "addressCollateralToken",
                    "addressGuardian",
                    "addressMarginBank",
                    "trustedForwarder",
                    "addressAccountManager",
                    "addressMarginMath",
                    "addressSignatureVerifier",
                    "addressLiquidityVault"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/faucet": {
      "post": {
        "operationId": "faucet",
        "summary": "faucet",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "amount": {
                      "type": "number"
                    },
                    "tx_hash": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "success",
                    "amount",
                    "tx_hash",
                    "message"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/fills/by-market/{market_id}": {
      "get": {
        "operationId": "fills_by_market_market_id",
        "summary": "fills/by-market/:market_id",
        "parameters": [
          {
            "name": "market_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "user_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 100
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 9007199254740991
            }
          },
          {
            "name": "taker_only",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "market_id": {
                      "type": "number"
                    },
                    "fills": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "fill_id": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "maker_order_id": {
                            "type": "number"
                          },
                          "taker_order_id": {
                            "type": "number"
                          },
                          "user_id": {
                            "type": "number"
                          },
                          "market_id": {
                            "type": "number"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "LONG",
                              "SHORT"
                            ]
                          },
                          "quantity": {
                            "type": "number"
                          },
                          "quantity_e18_raw": {
                            "type": "string"
                          },
                          "price": {
                            "type": "number"
                          },
                          "price_e18_raw": {
                            "type": "string"
                          },
                          "notional": {
                            "type": "number"
                          },
                          "notional_e18_raw": {
                            "type": "string"
                          },
                          "fee": {
                            "type": "number"
                          },
                          "fee_e18_raw": {
                            "type": "string"
                          },
                          "reserved_margin": {
                            "type": "number"
                          },
                          "reserved_margin_e18_raw": {
                            "type": "string"
                          },
                          "created_time": {
                            "type": "string"
                          },
                          "symbol": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "username": {
                            "type": "string"
                          },
                          "leverage": {
                            "type": "number"
                          },
                          "reduce_only": {
                            "type": "boolean"
                          },
                          "order_id": {
                            "type": "number"
                          },
                          "batch_id": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "fill_status": {
                            "type": "string",
                            "enum": [
                              "SUBMITTED",
                              "FAILED",
                              "PENDING",
                              "ONCHAIN",
                              "SETTLED",
                              "ORPHANED"
                            ]
                          },
                          "batch_status": {
                            "type": "string",
                            "enum": [
                              "FAILED",
                              "PENDING",
                              "ONCHAIN"
                            ]
                          },
                          "tx_hash": {
                            "type": "string"
                          },
                          "block_number": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "fill_id",
                          "maker_order_id",
                          "taker_order_id",
                          "user_id",
                          "market_id",
                          "role",
                          "quantity",
                          "quantity_e18_raw",
                          "price",
                          "price_e18_raw",
                          "notional",
                          "notional_e18_raw",
                          "fee",
                          "fee_e18_raw",
                          "reserved_margin",
                          "reserved_margin_e18_raw",
                          "created_time",
                          "symbol",
                          "leverage",
                          "order_id"
                        ]
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "limit": {
                          "type": "number"
                        },
                        "offset": {
                          "type": "number"
                        },
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "limit",
                        "offset",
                        "count"
                      ]
                    }
                  },
                  "required": [
                    "market_id",
                    "fills",
                    "pagination"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/fills/by-user/{user_id}": {
      "get": {
        "operationId": "fills_by_user_user_id",
        "summary": "fills/by-user/:user_id",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "market_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user_id": {
                      "type": "number"
                    },
                    "fills": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "batch_id": {
                            "type": "string"
                          },
                          "market_id": {
                            "type": "number"
                          },
                          "symbol": {
                            "type": "string"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "LONG",
                              "SHORT"
                            ]
                          },
                          "quantity": {
                            "type": "number"
                          },
                          "quantity_e18_raw": {
                            "type": "string"
                          },
                          "price": {
                            "type": "number"
                          },
                          "price_e18_raw": {
                            "type": "string"
                          },
                          "notional": {
                            "type": "number"
                          },
                          "notional_e18_raw": {
                            "type": "string"
                          },
                          "fee": {
                            "type": "number"
                          },
                          "fee_e18_raw": {
                            "type": "string"
                          },
                          "created_time": {
                            "type": "string"
                          },
                          "order_mode": {
                            "type": "string",
                            "enum": [
                              "STANDARD",
                              "REDUCE_ONLY",
                              "MIXED"
                            ]
                          },
                          "closed_pnl": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "closed_pnl_e18_raw": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "fill_status": {
                            "type": "string",
                            "enum": [
                              "FAILED",
                              "PENDING",
                              "ONCHAIN",
                              "SETTLED",
                              "ORPHANED"
                            ]
                          },
                          "batch_status": {
                            "type": "string",
                            "enum": [
                              "FAILED",
                              "PENDING",
                              "ONCHAIN"
                            ]
                          },
                          "tx_hash": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "block_number": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          }
                        },
                        "required": [
                          "batch_id",
                          "market_id",
                          "symbol",
                          "role",
                          "quantity",
                          "quantity_e18_raw",
                          "price",
                          "price_e18_raw",
                          "notional",
                          "notional_e18_raw",
                          "fee",
                          "fee_e18_raw",
                          "created_time",
                          "order_mode",
                          "closed_pnl",
                          "closed_pnl_e18_raw",
                          "fill_status",
                          "batch_status",
                          "tx_hash",
                          "block_number"
                        ]
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "limit": {
                          "type": "number"
                        },
                        "offset": {
                          "type": "number"
                        },
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "limit",
                        "offset",
                        "count"
                      ]
                    }
                  },
                  "required": [
                    "user_id",
                    "fills",
                    "pagination"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/invites/validate": {
      "post": {
        "operationId": "invites_validate",
        "summary": "invites/validate",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 64
                  }
                },
                "required": [
                  "code"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "valid": {
                          "type": "boolean",
                          "const": true
                        }
                      },
                      "required": [
                        "valid"
                      ]
                    },
                    {
                      "type": "object",
                      "properties": {
                        "valid": {
                          "type": "boolean",
                          "const": false
                        },
                        "reason": {
                          "type": "string",
                          "enum": [
                            "expired",
                            "not_found",
                            "redeemed"
                          ]
                        }
                      },
                      "required": [
                        "valid",
                        "reason"
                      ]
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/ledger/{user_id}/entries": {
      "get": {
        "operationId": "ledger_user_id_entries",
        "summary": "ledger/:user_id/entries",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "event_type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "deposit",
                "withdrawal",
                "funding_settlement",
                "trade_fee",
                "liquidation_transfer",
                "adl_oi_offset",
                "reserve_order",
                "finalize_trade",
                "finalize_liquidation",
                "release_order",
                "adjust_leverage"
              ]
            }
          },
          {
            "name": "market_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "order_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "created_after",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "entries": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "entry_id": {
                            "type": "number"
                          },
                          "transaction_id": {
                            "type": "number"
                          },
                          "owner_type": {
                            "type": "string",
                            "enum": [
                              "user",
                              "system"
                            ]
                          },
                          "owner_id": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "account_kind": {
                            "type": "string",
                            "enum": [
                              "available_margin_raw",
                              "reserved_margin_raw",
                              "used_margin_raw",
                              "fee_pool"
                            ]
                          },
                          "amount_e18_raw": {
                            "type": "string"
                          },
                          "amount": {
                            "type": "number"
                          },
                          "market_id": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "order_id": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "ref_id": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "metadata": {},
                          "created_time": {
                            "type": "string"
                          },
                          "event_type": {
                            "type": "string"
                          },
                          "context_type": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "context_id": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "source": {
                            "type": "string"
                          },
                          "idem_key": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "entry_id",
                          "transaction_id",
                          "owner_type",
                          "owner_id",
                          "account_kind",
                          "amount_e18_raw",
                          "amount",
                          "market_id",
                          "order_id",
                          "ref_id",
                          "metadata",
                          "created_time",
                          "event_type",
                          "context_type",
                          "context_id",
                          "source",
                          "idem_key"
                        ]
                      }
                    }
                  },
                  "required": [
                    "entries"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/margin/events/{user_id}": {
      "get": {
        "operationId": "margin_events_user_id",
        "summary": "margin/events/:user_id",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "market_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user_id": {
                      "type": "number"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "number"
                          },
                          "user_id": {
                            "type": "number"
                          },
                          "market_id": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "available_margin": {
                            "type": "number"
                          },
                          "reserved_margin": {
                            "type": "number"
                          },
                          "used_margin": {
                            "type": "number"
                          },
                          "ref_id": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "ref_type": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "created_time": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "id",
                          "user_id",
                          "market_id",
                          "available_margin",
                          "reserved_margin",
                          "used_margin",
                          "ref_id",
                          "ref_type",
                          "created_time"
                        ]
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "limit": {
                          "type": "number"
                        },
                        "offset": {
                          "type": "number"
                        },
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "limit",
                        "offset",
                        "count"
                      ]
                    }
                  },
                  "required": [
                    "user_id",
                    "events",
                    "pagination"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/market-bootstrap/{slug}": {
      "get": {
        "operationId": "market_bootstrap_slug",
        "summary": "market-bootstrap/:slug",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "page": {
                      "type": "object",
                      "properties": {
                        "market_id": {
                          "type": "number"
                        },
                        "market_config_seq": {
                          "type": "number"
                        },
                        "page_id": {
                          "type": "number"
                        },
                        "slug": {
                          "type": "string"
                        },
                        "description": {
                          "type": "string"
                        },
                        "contract_address": {
                          "type": "string"
                        },
                        "trader_address": {
                          "type": "string"
                        },
                        "evaluator_address": {
                          "type": "string"
                        },
                        "contract_name": {
                          "type": "string"
                        },
                        "oracle_address": {
                          "type": "string"
                        },
                        "funding_oracle_address": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "funding_session": {
                          "type": "string",
                          "enum": [
                            "always",
                            "us_equity"
                          ]
                        },
                        "type": {
                          "type": "string",
                          "enum": [
                            "perpetual",
                            "future",
                            "binary_future"
                          ]
                        },
                        "price_display": {
                          "type": "string",
                          "enum": [
                            "usd",
                            "billion_usd",
                            "decimal",
                            "percentage"
                          ]
                        },
                        "short_name": {
                          "type": "string"
                        },
                        "long_name": {
                          "type": "string"
                        },
                        "symbol": {
                          "type": "string"
                        },
                        "adl_address": {
                          "type": "string"
                        },
                        "initial_margin_ratio": {
                          "type": "number"
                        },
                        "initial_margin_ratio_e18_raw": {
                          "type": "string"
                        },
                        "maintenance_margin_ratio": {
                          "type": "number"
                        },
                        "maintenance_margin_ratio_e18_raw": {
                          "type": "string"
                        },
                        "tick_size": {
                          "type": "number"
                        },
                        "tick_size_e18_raw": {
                          "type": "string"
                        },
                        "min_order_price": {
                          "type": "number"
                        },
                        "min_order_price_e18_raw": {
                          "type": "string"
                        },
                        "max_order_price": {
                          "type": "number"
                        },
                        "max_order_price_e18_raw": {
                          "type": "string"
                        },
                        "min_order_size": {
                          "type": "number"
                        },
                        "min_order_size_e18_raw": {
                          "type": "string"
                        },
                        "max_order_size_limit": {
                          "type": "number"
                        },
                        "max_order_size_limit_e18_raw": {
                          "type": "string"
                        },
                        "max_order_size_market": {
                          "type": "number"
                        },
                        "max_order_size_market_e18_raw": {
                          "type": "string"
                        },
                        "mtb_long": {
                          "type": "number"
                        },
                        "mtb_short": {
                          "type": "number"
                        },
                        "mtb_long_e18_raw": {
                          "type": "string"
                        },
                        "mtb_short_e18_raw": {
                          "type": "string"
                        },
                        "max_allowed_open_notional_by_leverage_e18_raw": {
                          "type": "object",
                          "additionalProperties": {
                            "type": "string"
                          }
                        },
                        "max_market_open_notional_e18_raw": {
                          "type": "string"
                        },
                        "step_size": {
                          "type": "number"
                        },
                        "step_size_e18_raw": {
                          "type": "string"
                        },
                        "maker_fee": {
                          "type": "number"
                        },
                        "maker_fee_e18_raw": {
                          "type": "string"
                        },
                        "taker_fee": {
                          "type": "number"
                        },
                        "taker_fee_e18_raw": {
                          "type": "string"
                        },
                        "trading_enabled": {
                          "type": "boolean"
                        },
                        "trading_start_time": {
                          "type": "string"
                        },
                        "initial_price_e18_raw": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "deployment_block": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "number"
                            }
                          ]
                        },
                        "mark_price": {
                          "type": "number"
                        },
                        "mark_price_e18_raw": {
                          "type": "string"
                        },
                        "oracle_price": {
                          "type": "number"
                        },
                        "oracle_price_e18_raw": {
                          "type": "string"
                        },
                        "mark_price_timestamp": {
                          "type": "string"
                        },
                        "max_trade_batch_oracle_age_ms": {
                          "type": "number"
                        },
                        "max_liquidation_price_age_ms": {
                          "type": "number"
                        },
                        "funding_rate": {
                          "type": "number"
                        },
                        "created_time": {
                          "type": "string"
                        },
                        "updated_time": {
                          "type": "string"
                        },
                        "quote_asset_symbol": {
                          "type": "string"
                        },
                        "quote_asset_name": {
                          "type": "string"
                        },
                        "base_asset_symbol": {
                          "type": "string"
                        },
                        "base_asset_name": {
                          "type": "string"
                        },
                        "thumbnail_url": {
                          "type": "string"
                        },
                        "title": {
                          "type": "string"
                        },
                        "categories": {
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "delisting": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "market_id": {
                                  "type": "number"
                                },
                                "settlement_price_e18_raw": {
                                  "type": "string"
                                },
                                "settlement_price": {
                                  "type": "number"
                                },
                                "delisted_at_timestamp": {
                                  "type": "string"
                                },
                                "close_delay_seconds": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "number"
                                    }
                                  ]
                                },
                                "close_eligible_at_timestamp": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string"
                                    }
                                  ]
                                },
                                "delist_tx_hash": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string"
                                    }
                                  ]
                                },
                                "delist_block_number": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "number"
                                    }
                                  ]
                                },
                                "mid_price_e18_raw": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string"
                                    }
                                  ]
                                },
                                "price_lower_bound_e18_raw": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string"
                                    }
                                  ]
                                },
                                "price_upper_bound_e18_raw": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string"
                                    }
                                  ]
                                },
                                "created_time": {
                                  "type": "string"
                                },
                                "updated_time": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "market_id",
                                "settlement_price_e18_raw",
                                "settlement_price",
                                "delisted_at_timestamp",
                                "created_time",
                                "updated_time"
                              ]
                            }
                          ]
                        }
                      },
                      "required": [
                        "market_id",
                        "market_config_seq",
                        "page_id",
                        "slug",
                        "contract_address",
                        "trader_address",
                        "evaluator_address",
                        "contract_name",
                        "oracle_address",
                        "funding_oracle_address",
                        "type",
                        "price_display",
                        "short_name",
                        "long_name",
                        "symbol",
                        "initial_margin_ratio",
                        "initial_margin_ratio_e18_raw",
                        "maintenance_margin_ratio",
                        "maintenance_margin_ratio_e18_raw",
                        "tick_size",
                        "tick_size_e18_raw",
                        "min_order_price",
                        "min_order_price_e18_raw",
                        "max_order_price",
                        "max_order_price_e18_raw",
                        "min_order_size",
                        "min_order_size_e18_raw",
                        "max_order_size_limit",
                        "max_order_size_limit_e18_raw",
                        "max_order_size_market",
                        "max_order_size_market_e18_raw",
                        "mtb_long",
                        "mtb_short",
                        "mtb_long_e18_raw",
                        "mtb_short_e18_raw",
                        "max_allowed_open_notional_by_leverage_e18_raw",
                        "max_market_open_notional_e18_raw",
                        "step_size",
                        "step_size_e18_raw",
                        "maker_fee",
                        "maker_fee_e18_raw",
                        "taker_fee",
                        "taker_fee_e18_raw",
                        "trading_enabled",
                        "created_time",
                        "updated_time",
                        "quote_asset_symbol",
                        "quote_asset_name",
                        "base_asset_symbol",
                        "base_asset_name",
                        "title",
                        "delisting"
                      ]
                    },
                    "order_book": {
                      "type": "object",
                      "properties": {
                        "market_id": {
                          "type": "number"
                        },
                        "long_levels": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "side": {
                                "type": "string",
                                "enum": [
                                  "LONG",
                                  "SHORT"
                                ]
                              },
                              "price": {
                                "type": "number"
                              },
                              "price_e18_raw": {
                                "type": "string"
                              },
                              "quantity": {
                                "type": "number"
                              },
                              "quantity_e18_raw": {
                                "type": "string"
                              },
                              "order_count": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "side",
                              "price",
                              "price_e18_raw",
                              "quantity",
                              "quantity_e18_raw",
                              "order_count"
                            ]
                          }
                        },
                        "short_levels": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "side": {
                                "type": "string",
                                "enum": [
                                  "LONG",
                                  "SHORT"
                                ]
                              },
                              "price": {
                                "type": "number"
                              },
                              "price_e18_raw": {
                                "type": "string"
                              },
                              "quantity": {
                                "type": "number"
                              },
                              "quantity_e18_raw": {
                                "type": "string"
                              },
                              "order_count": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "side",
                              "price",
                              "price_e18_raw",
                              "quantity",
                              "quantity_e18_raw",
                              "order_count"
                            ]
                          }
                        },
                        "depth": {
                          "type": "number"
                        },
                        "read_after": {
                          "type": "object",
                          "properties": {
                            "shard_id": {
                              "type": "string"
                            },
                            "shard_seq": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "shard_id",
                            "shard_seq"
                          ]
                        }
                      },
                      "required": [
                        "market_id",
                        "long_levels",
                        "short_levels",
                        "depth"
                      ]
                    },
                    "fills": {
                      "type": "object",
                      "properties": {
                        "market_id": {
                          "type": "number"
                        },
                        "fills": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "fill_id": {
                                "anyOf": [
                                  {
                                    "type": "string"
                                  },
                                  {
                                    "type": "number"
                                  }
                                ]
                              },
                              "maker_order_id": {
                                "type": "number"
                              },
                              "taker_order_id": {
                                "type": "number"
                              },
                              "user_id": {
                                "type": "number"
                              },
                              "market_id": {
                                "type": "number"
                              },
                              "role": {
                                "type": "string",
                                "enum": [
                                  "LONG",
                                  "SHORT"
                                ]
                              },
                              "quantity": {
                                "type": "number"
                              },
                              "quantity_e18_raw": {
                                "type": "string"
                              },
                              "price": {
                                "type": "number"
                              },
                              "price_e18_raw": {
                                "type": "string"
                              },
                              "notional": {
                                "type": "number"
                              },
                              "notional_e18_raw": {
                                "type": "string"
                              },
                              "fee": {
                                "type": "number"
                              },
                              "fee_e18_raw": {
                                "type": "string"
                              },
                              "reserved_margin": {
                                "type": "number"
                              },
                              "reserved_margin_e18_raw": {
                                "type": "string"
                              },
                              "created_time": {
                                "type": "string"
                              },
                              "symbol": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "username": {
                                "type": "string"
                              },
                              "leverage": {
                                "type": "number"
                              },
                              "reduce_only": {
                                "type": "boolean"
                              },
                              "order_id": {
                                "type": "number"
                              },
                              "batch_id": {
                                "anyOf": [
                                  {
                                    "type": "null"
                                  },
                                  {
                                    "type": "string"
                                  }
                                ]
                              },
                              "fill_status": {
                                "type": "string",
                                "enum": [
                                  "SUBMITTED",
                                  "FAILED",
                                  "PENDING",
                                  "ONCHAIN",
                                  "SETTLED",
                                  "ORPHANED"
                                ]
                              },
                              "batch_status": {
                                "type": "string",
                                "enum": [
                                  "FAILED",
                                  "PENDING",
                                  "ONCHAIN"
                                ]
                              },
                              "tx_hash": {
                                "type": "string"
                              },
                              "block_number": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "fill_id",
                              "maker_order_id",
                              "taker_order_id",
                              "user_id",
                              "market_id",
                              "role",
                              "quantity",
                              "quantity_e18_raw",
                              "price",
                              "price_e18_raw",
                              "notional",
                              "notional_e18_raw",
                              "fee",
                              "fee_e18_raw",
                              "reserved_margin",
                              "reserved_margin_e18_raw",
                              "created_time",
                              "symbol",
                              "leverage",
                              "order_id"
                            ]
                          }
                        },
                        "pagination": {
                          "type": "object",
                          "properties": {
                            "limit": {
                              "type": "number"
                            },
                            "offset": {
                              "type": "number"
                            },
                            "count": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "limit",
                            "offset",
                            "count"
                          ]
                        }
                      },
                      "required": [
                        "market_id",
                        "fills",
                        "pagination"
                      ]
                    },
                    "price": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "market_id": {
                              "type": "number"
                            },
                            "symbol": {
                              "type": "string"
                            },
                            "mark_price": {
                              "anyOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "number"
                                }
                              ]
                            },
                            "mark_price_e18_raw": {
                              "anyOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "string"
                                }
                              ]
                            },
                            "mark_price_timestamp": {
                              "anyOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "string"
                                }
                              ]
                            },
                            "oracle_price": {
                              "type": "number"
                            },
                            "oracle_price_e18_raw": {
                              "type": "string"
                            },
                            "price_bounds": {
                              "type": "object",
                              "properties": {
                                "lower": {
                                  "type": "number"
                                },
                                "upper": {
                                  "type": "number"
                                },
                                "lower_e18_raw": {
                                  "type": "string"
                                },
                                "upper_e18_raw": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "lower",
                                "upper",
                                "lower_e18_raw",
                                "upper_e18_raw"
                              ]
                            },
                            "suggested_limit_price": {
                              "anyOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "number"
                                }
                              ]
                            },
                            "funding_rate": {
                              "anyOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "number"
                                }
                              ]
                            },
                            "funding_rate_e18_raw": {
                              "anyOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "string"
                                }
                              ]
                            },
                            "funding_rate_timestamp": {
                              "anyOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "string"
                                }
                              ]
                            },
                            "tick_size": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "market_id",
                            "symbol",
                            "mark_price",
                            "mark_price_e18_raw",
                            "mark_price_timestamp",
                            "oracle_price",
                            "oracle_price_e18_raw",
                            "price_bounds",
                            "suggested_limit_price",
                            "funding_rate",
                            "funding_rate_e18_raw",
                            "funding_rate_timestamp",
                            "tick_size"
                          ]
                        }
                      ]
                    },
                    "candlesticks": {
                      "type": "object",
                      "properties": {
                        "market_id": {
                          "type": "number"
                        },
                        "interval": {
                          "type": "string"
                        },
                        "candlesticks": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "time": {
                                "type": "number"
                              },
                              "open": {
                                "type": "number"
                              },
                              "high": {
                                "type": "number"
                              },
                              "low": {
                                "type": "number"
                              },
                              "close": {
                                "type": "number"
                              },
                              "volume": {
                                "type": "number"
                              }
                            },
                            "required": [
                              "time",
                              "open",
                              "high",
                              "low",
                              "close",
                              "volume"
                            ]
                          }
                        }
                      },
                      "required": [
                        "market_id",
                        "interval",
                        "candlesticks"
                      ]
                    },
                    "markets": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "market_id": {
                            "type": "number"
                          },
                          "market_config_seq": {
                            "type": "number"
                          },
                          "page_id": {
                            "type": "number"
                          },
                          "slug": {
                            "type": "string"
                          },
                          "description": {
                            "type": "string"
                          },
                          "contract_address": {
                            "type": "string"
                          },
                          "trader_address": {
                            "type": "string"
                          },
                          "evaluator_address": {
                            "type": "string"
                          },
                          "contract_name": {
                            "type": "string"
                          },
                          "oracle_address": {
                            "type": "string"
                          },
                          "funding_oracle_address": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "funding_session": {
                            "type": "string",
                            "enum": [
                              "always",
                              "us_equity"
                            ]
                          },
                          "type": {
                            "type": "string",
                            "enum": [
                              "perpetual",
                              "future",
                              "binary_future"
                            ]
                          },
                          "price_display": {
                            "type": "string",
                            "enum": [
                              "usd",
                              "billion_usd",
                              "decimal",
                              "percentage"
                            ]
                          },
                          "short_name": {
                            "type": "string"
                          },
                          "long_name": {
                            "type": "string"
                          },
                          "symbol": {
                            "type": "string"
                          },
                          "adl_address": {
                            "type": "string"
                          },
                          "initial_margin_ratio": {
                            "type": "number"
                          },
                          "initial_margin_ratio_e18_raw": {
                            "type": "string"
                          },
                          "maintenance_margin_ratio": {
                            "type": "number"
                          },
                          "maintenance_margin_ratio_e18_raw": {
                            "type": "string"
                          },
                          "tick_size": {
                            "type": "number"
                          },
                          "tick_size_e18_raw": {
                            "type": "string"
                          },
                          "min_order_price": {
                            "type": "number"
                          },
                          "min_order_price_e18_raw": {
                            "type": "string"
                          },
                          "max_order_price": {
                            "type": "number"
                          },
                          "max_order_price_e18_raw": {
                            "type": "string"
                          },
                          "min_order_size": {
                            "type": "number"
                          },
                          "min_order_size_e18_raw": {
                            "type": "string"
                          },
                          "max_order_size_limit": {
                            "type": "number"
                          },
                          "max_order_size_limit_e18_raw": {
                            "type": "string"
                          },
                          "max_order_size_market": {
                            "type": "number"
                          },
                          "max_order_size_market_e18_raw": {
                            "type": "string"
                          },
                          "mtb_long": {
                            "type": "number"
                          },
                          "mtb_short": {
                            "type": "number"
                          },
                          "mtb_long_e18_raw": {
                            "type": "string"
                          },
                          "mtb_short_e18_raw": {
                            "type": "string"
                          },
                          "max_allowed_open_notional_by_leverage_e18_raw": {
                            "type": "object",
                            "additionalProperties": {
                              "type": "string"
                            }
                          },
                          "max_market_open_notional_e18_raw": {
                            "type": "string"
                          },
                          "step_size": {
                            "type": "number"
                          },
                          "step_size_e18_raw": {
                            "type": "string"
                          },
                          "maker_fee": {
                            "type": "number"
                          },
                          "maker_fee_e18_raw": {
                            "type": "string"
                          },
                          "taker_fee": {
                            "type": "number"
                          },
                          "taker_fee_e18_raw": {
                            "type": "string"
                          },
                          "trading_enabled": {
                            "type": "boolean"
                          },
                          "trading_start_time": {
                            "type": "string"
                          },
                          "initial_price_e18_raw": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "deployment_block": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "mark_price": {
                            "type": "number"
                          },
                          "mark_price_e18_raw": {
                            "type": "string"
                          },
                          "oracle_price": {
                            "type": "number"
                          },
                          "oracle_price_e18_raw": {
                            "type": "string"
                          },
                          "mark_price_timestamp": {
                            "type": "string"
                          },
                          "max_trade_batch_oracle_age_ms": {
                            "type": "number"
                          },
                          "max_liquidation_price_age_ms": {
                            "type": "number"
                          },
                          "funding_rate": {
                            "type": "number"
                          },
                          "created_time": {
                            "type": "string"
                          },
                          "updated_time": {
                            "type": "string"
                          },
                          "quote_asset_symbol": {
                            "type": "string"
                          },
                          "quote_asset_name": {
                            "type": "string"
                          },
                          "base_asset_symbol": {
                            "type": "string"
                          },
                          "base_asset_name": {
                            "type": "string"
                          },
                          "open_order_count": {
                            "type": "number"
                          },
                          "pending_cancel_count": {
                            "type": "number"
                          },
                          "last_order_created_at_ms": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "thumbnail_url": {
                            "type": "string"
                          },
                          "title": {
                            "type": "string"
                          },
                          "categories": {
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "market_id",
                          "market_config_seq",
                          "page_id",
                          "slug",
                          "contract_address",
                          "trader_address",
                          "evaluator_address",
                          "contract_name",
                          "oracle_address",
                          "funding_oracle_address",
                          "type",
                          "price_display",
                          "short_name",
                          "long_name",
                          "symbol",
                          "initial_margin_ratio",
                          "initial_margin_ratio_e18_raw",
                          "maintenance_margin_ratio",
                          "maintenance_margin_ratio_e18_raw",
                          "tick_size",
                          "tick_size_e18_raw",
                          "min_order_price",
                          "min_order_price_e18_raw",
                          "max_order_price",
                          "max_order_price_e18_raw",
                          "min_order_size",
                          "min_order_size_e18_raw",
                          "max_order_size_limit",
                          "max_order_size_limit_e18_raw",
                          "max_order_size_market",
                          "max_order_size_market_e18_raw",
                          "mtb_long",
                          "mtb_short",
                          "mtb_long_e18_raw",
                          "mtb_short_e18_raw",
                          "max_allowed_open_notional_by_leverage_e18_raw",
                          "max_market_open_notional_e18_raw",
                          "step_size",
                          "step_size_e18_raw",
                          "maker_fee",
                          "maker_fee_e18_raw",
                          "taker_fee",
                          "taker_fee_e18_raw",
                          "trading_enabled",
                          "created_time",
                          "updated_time",
                          "quote_asset_symbol",
                          "quote_asset_name",
                          "base_asset_symbol",
                          "base_asset_name",
                          "open_order_count",
                          "pending_cancel_count",
                          "last_order_created_at_ms",
                          "title"
                        ]
                      }
                    },
                    "market_stats": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "market_id": {
                            "type": "number"
                          },
                          "symbol": {
                            "type": "string"
                          },
                          "volume_24h": {
                            "type": "number"
                          },
                          "price_change_24h": {
                            "type": "number"
                          },
                          "open_interest": {
                            "type": "number"
                          },
                          "mark_price": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "last_trade_price": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "next_funding_time": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "funding_rate": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "funding_rate_updated_at": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          }
                        },
                        "required": [
                          "market_id",
                          "symbol",
                          "volume_24h",
                          "price_change_24h",
                          "open_interest",
                          "mark_price",
                          "last_trade_price",
                          "next_funding_time",
                          "funding_rate",
                          "funding_rate_updated_at"
                        ]
                      }
                    },
                    "read_after": {
                      "type": "object",
                      "properties": {
                        "shard_id": {
                          "type": "string"
                        },
                        "shard_seq": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "shard_id",
                        "shard_seq"
                      ]
                    }
                  },
                  "required": [
                    "page",
                    "order_book",
                    "fills",
                    "price",
                    "candlesticks",
                    "markets",
                    "market_stats",
                    "read_after"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/market-cache-target/{market_id}": {
      "get": {
        "operationId": "market_cache_target_market_id",
        "summary": "market-cache-target/:market_id",
        "parameters": [
          {
            "name": "market_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "slug": {
                      "type": "string"
                    },
                    "cacheable": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "slug",
                    "cacheable"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/markets": {
      "get": {
        "operationId": "markets",
        "summary": "markets",
        "parameters": [
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "perpetual",
                "future",
                "binary_future"
              ]
            }
          },
          {
            "name": "randomOrder",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "market_id": {
                        "type": "number"
                      },
                      "market_config_seq": {
                        "type": "number"
                      },
                      "page_id": {
                        "type": "number"
                      },
                      "slug": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      },
                      "contract_address": {
                        "type": "string"
                      },
                      "trader_address": {
                        "type": "string"
                      },
                      "evaluator_address": {
                        "type": "string"
                      },
                      "contract_name": {
                        "type": "string"
                      },
                      "oracle_address": {
                        "type": "string"
                      },
                      "funding_oracle_address": {
                        "anyOf": [
                          {
                            "type": "null"
                          },
                          {
                            "type": "string"
                          }
                        ]
                      },
                      "funding_session": {
                        "type": "string",
                        "enum": [
                          "always",
                          "us_equity"
                        ]
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "perpetual",
                          "future",
                          "binary_future"
                        ]
                      },
                      "price_display": {
                        "type": "string",
                        "enum": [
                          "usd",
                          "billion_usd",
                          "decimal",
                          "percentage"
                        ]
                      },
                      "short_name": {
                        "type": "string"
                      },
                      "long_name": {
                        "type": "string"
                      },
                      "symbol": {
                        "type": "string"
                      },
                      "adl_address": {
                        "type": "string"
                      },
                      "initial_margin_ratio": {
                        "type": "number"
                      },
                      "initial_margin_ratio_e18_raw": {
                        "type": "string"
                      },
                      "maintenance_margin_ratio": {
                        "type": "number"
                      },
                      "maintenance_margin_ratio_e18_raw": {
                        "type": "string"
                      },
                      "tick_size": {
                        "type": "number"
                      },
                      "tick_size_e18_raw": {
                        "type": "string"
                      },
                      "min_order_price": {
                        "type": "number"
                      },
                      "min_order_price_e18_raw": {
                        "type": "string"
                      },
                      "max_order_price": {
                        "type": "number"
                      },
                      "max_order_price_e18_raw": {
                        "type": "string"
                      },
                      "min_order_size": {
                        "type": "number"
                      },
                      "min_order_size_e18_raw": {
                        "type": "string"
                      },
                      "max_order_size_limit": {
                        "type": "number"
                      },
                      "max_order_size_limit_e18_raw": {
                        "type": "string"
                      },
                      "max_order_size_market": {
                        "type": "number"
                      },
                      "max_order_size_market_e18_raw": {
                        "type": "string"
                      },
                      "mtb_long": {
                        "type": "number"
                      },
                      "mtb_short": {
                        "type": "number"
                      },
                      "mtb_long_e18_raw": {
                        "type": "string"
                      },
                      "mtb_short_e18_raw": {
                        "type": "string"
                      },
                      "max_allowed_open_notional_by_leverage_e18_raw": {
                        "type": "object",
                        "additionalProperties": {
                          "type": "string"
                        }
                      },
                      "max_market_open_notional_e18_raw": {
                        "type": "string"
                      },
                      "step_size": {
                        "type": "number"
                      },
                      "step_size_e18_raw": {
                        "type": "string"
                      },
                      "maker_fee": {
                        "type": "number"
                      },
                      "maker_fee_e18_raw": {
                        "type": "string"
                      },
                      "taker_fee": {
                        "type": "number"
                      },
                      "taker_fee_e18_raw": {
                        "type": "string"
                      },
                      "trading_enabled": {
                        "type": "boolean"
                      },
                      "trading_start_time": {
                        "type": "string"
                      },
                      "initial_price_e18_raw": {
                        "anyOf": [
                          {
                            "type": "null"
                          },
                          {
                            "type": "string"
                          }
                        ]
                      },
                      "deployment_block": {
                        "anyOf": [
                          {
                            "type": "null"
                          },
                          {
                            "type": "number"
                          }
                        ]
                      },
                      "mark_price": {
                        "type": "number"
                      },
                      "mark_price_e18_raw": {
                        "type": "string"
                      },
                      "oracle_price": {
                        "type": "number"
                      },
                      "oracle_price_e18_raw": {
                        "type": "string"
                      },
                      "mark_price_timestamp": {
                        "type": "string"
                      },
                      "max_trade_batch_oracle_age_ms": {
                        "type": "number"
                      },
                      "max_liquidation_price_age_ms": {
                        "type": "number"
                      },
                      "funding_rate": {
                        "type": "number"
                      },
                      "created_time": {
                        "type": "string"
                      },
                      "updated_time": {
                        "type": "string"
                      },
                      "quote_asset_symbol": {
                        "type": "string"
                      },
                      "quote_asset_name": {
                        "type": "string"
                      },
                      "base_asset_symbol": {
                        "type": "string"
                      },
                      "base_asset_name": {
                        "type": "string"
                      },
                      "open_order_count": {
                        "type": "number"
                      },
                      "pending_cancel_count": {
                        "type": "number"
                      },
                      "last_order_created_at_ms": {
                        "anyOf": [
                          {
                            "type": "null"
                          },
                          {
                            "type": "number"
                          }
                        ]
                      },
                      "thumbnail_url": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string"
                      },
                      "categories": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "market_id",
                      "market_config_seq",
                      "page_id",
                      "slug",
                      "contract_address",
                      "trader_address",
                      "evaluator_address",
                      "contract_name",
                      "oracle_address",
                      "funding_oracle_address",
                      "type",
                      "price_display",
                      "short_name",
                      "long_name",
                      "symbol",
                      "initial_margin_ratio",
                      "initial_margin_ratio_e18_raw",
                      "maintenance_margin_ratio",
                      "maintenance_margin_ratio_e18_raw",
                      "tick_size",
                      "tick_size_e18_raw",
                      "min_order_price",
                      "min_order_price_e18_raw",
                      "max_order_price",
                      "max_order_price_e18_raw",
                      "min_order_size",
                      "min_order_size_e18_raw",
                      "max_order_size_limit",
                      "max_order_size_limit_e18_raw",
                      "max_order_size_market",
                      "max_order_size_market_e18_raw",
                      "mtb_long",
                      "mtb_short",
                      "mtb_long_e18_raw",
                      "mtb_short_e18_raw",
                      "max_allowed_open_notional_by_leverage_e18_raw",
                      "max_market_open_notional_e18_raw",
                      "step_size",
                      "step_size_e18_raw",
                      "maker_fee",
                      "maker_fee_e18_raw",
                      "taker_fee",
                      "taker_fee_e18_raw",
                      "trading_enabled",
                      "created_time",
                      "updated_time",
                      "quote_asset_symbol",
                      "quote_asset_name",
                      "base_asset_symbol",
                      "base_asset_name",
                      "open_order_count",
                      "pending_cancel_count",
                      "last_order_created_at_ms",
                      "title"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v0/markets/{market_id}": {
      "get": {
        "operationId": "markets_market_id",
        "summary": "markets/:market_id",
        "parameters": [
          {
            "name": "market_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "market_id": {
                      "type": "number"
                    },
                    "market_config_seq": {
                      "type": "number"
                    },
                    "page_id": {
                      "type": "number"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "contract_address": {
                      "type": "string"
                    },
                    "trader_address": {
                      "type": "string"
                    },
                    "evaluator_address": {
                      "type": "string"
                    },
                    "contract_name": {
                      "type": "string"
                    },
                    "oracle_address": {
                      "type": "string"
                    },
                    "funding_oracle_address": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "funding_session": {
                      "type": "string",
                      "enum": [
                        "always",
                        "us_equity"
                      ]
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "perpetual",
                        "future",
                        "binary_future"
                      ]
                    },
                    "price_display": {
                      "type": "string",
                      "enum": [
                        "usd",
                        "billion_usd",
                        "decimal",
                        "percentage"
                      ]
                    },
                    "short_name": {
                      "type": "string"
                    },
                    "long_name": {
                      "type": "string"
                    },
                    "symbol": {
                      "type": "string"
                    },
                    "adl_address": {
                      "type": "string"
                    },
                    "initial_margin_ratio": {
                      "type": "number"
                    },
                    "initial_margin_ratio_e18_raw": {
                      "type": "string"
                    },
                    "maintenance_margin_ratio": {
                      "type": "number"
                    },
                    "maintenance_margin_ratio_e18_raw": {
                      "type": "string"
                    },
                    "tick_size": {
                      "type": "number"
                    },
                    "tick_size_e18_raw": {
                      "type": "string"
                    },
                    "min_order_price": {
                      "type": "number"
                    },
                    "min_order_price_e18_raw": {
                      "type": "string"
                    },
                    "max_order_price": {
                      "type": "number"
                    },
                    "max_order_price_e18_raw": {
                      "type": "string"
                    },
                    "min_order_size": {
                      "type": "number"
                    },
                    "min_order_size_e18_raw": {
                      "type": "string"
                    },
                    "max_order_size_limit": {
                      "type": "number"
                    },
                    "max_order_size_limit_e18_raw": {
                      "type": "string"
                    },
                    "max_order_size_market": {
                      "type": "number"
                    },
                    "max_order_size_market_e18_raw": {
                      "type": "string"
                    },
                    "mtb_long": {
                      "type": "number"
                    },
                    "mtb_short": {
                      "type": "number"
                    },
                    "mtb_long_e18_raw": {
                      "type": "string"
                    },
                    "mtb_short_e18_raw": {
                      "type": "string"
                    },
                    "max_allowed_open_notional_by_leverage_e18_raw": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "max_market_open_notional_e18_raw": {
                      "type": "string"
                    },
                    "step_size": {
                      "type": "number"
                    },
                    "step_size_e18_raw": {
                      "type": "string"
                    },
                    "maker_fee": {
                      "type": "number"
                    },
                    "maker_fee_e18_raw": {
                      "type": "string"
                    },
                    "taker_fee": {
                      "type": "number"
                    },
                    "taker_fee_e18_raw": {
                      "type": "string"
                    },
                    "trading_enabled": {
                      "type": "boolean"
                    },
                    "trading_start_time": {
                      "type": "string"
                    },
                    "initial_price_e18_raw": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "deployment_block": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    },
                    "mark_price": {
                      "type": "number"
                    },
                    "mark_price_e18_raw": {
                      "type": "string"
                    },
                    "oracle_price": {
                      "type": "number"
                    },
                    "oracle_price_e18_raw": {
                      "type": "string"
                    },
                    "mark_price_timestamp": {
                      "type": "string"
                    },
                    "max_trade_batch_oracle_age_ms": {
                      "type": "number"
                    },
                    "max_liquidation_price_age_ms": {
                      "type": "number"
                    },
                    "funding_rate": {
                      "type": "number"
                    },
                    "created_time": {
                      "type": "string"
                    },
                    "updated_time": {
                      "type": "string"
                    },
                    "quote_asset_symbol": {
                      "type": "string"
                    },
                    "quote_asset_name": {
                      "type": "string"
                    },
                    "base_asset_symbol": {
                      "type": "string"
                    },
                    "base_asset_name": {
                      "type": "string"
                    },
                    "open_order_count": {
                      "type": "number"
                    },
                    "pending_cancel_count": {
                      "type": "number"
                    },
                    "last_order_created_at_ms": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    },
                    "thumbnail_url": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "categories": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    }
                  },
                  "required": [
                    "market_id",
                    "market_config_seq",
                    "page_id",
                    "slug",
                    "contract_address",
                    "trader_address",
                    "evaluator_address",
                    "contract_name",
                    "oracle_address",
                    "funding_oracle_address",
                    "type",
                    "price_display",
                    "short_name",
                    "long_name",
                    "symbol",
                    "initial_margin_ratio",
                    "initial_margin_ratio_e18_raw",
                    "maintenance_margin_ratio",
                    "maintenance_margin_ratio_e18_raw",
                    "tick_size",
                    "tick_size_e18_raw",
                    "min_order_price",
                    "min_order_price_e18_raw",
                    "max_order_price",
                    "max_order_price_e18_raw",
                    "min_order_size",
                    "min_order_size_e18_raw",
                    "max_order_size_limit",
                    "max_order_size_limit_e18_raw",
                    "max_order_size_market",
                    "max_order_size_market_e18_raw",
                    "mtb_long",
                    "mtb_short",
                    "mtb_long_e18_raw",
                    "mtb_short_e18_raw",
                    "max_allowed_open_notional_by_leverage_e18_raw",
                    "max_market_open_notional_e18_raw",
                    "step_size",
                    "step_size_e18_raw",
                    "maker_fee",
                    "maker_fee_e18_raw",
                    "taker_fee",
                    "taker_fee_e18_raw",
                    "trading_enabled",
                    "created_time",
                    "updated_time",
                    "quote_asset_symbol",
                    "quote_asset_name",
                    "base_asset_symbol",
                    "base_asset_name",
                    "open_order_count",
                    "pending_cancel_count",
                    "last_order_created_at_ms",
                    "title"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/markets/{market_id}/candlesticks": {
      "get": {
        "operationId": "markets_market_id_candlesticks",
        "summary": "markets/:market_id/candlesticks",
        "parameters": [
          {
            "name": "market_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "interval",
            "in": "query",
            "required": false,
            "schema": {
              "default": "1h",
              "type": "string",
              "enum": [
                "1m",
                "5m",
                "15m",
                "1h",
                "4h",
                "1d"
              ]
            }
          },
          {
            "name": "source",
            "in": "query",
            "required": false,
            "schema": {
              "default": "trades",
              "type": "string",
              "enum": [
                "trades",
                "mark_price"
              ]
            }
          },
          {
            "name": "lookback_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 60000,
              "maximum": 630720000000
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "default": 100,
              "type": "integer",
              "minimum": 1,
              "maximum": 5000
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "market_id": {
                      "type": "number"
                    },
                    "interval": {
                      "type": "string"
                    },
                    "candlesticks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "time": {
                            "type": "number"
                          },
                          "open": {
                            "type": "number"
                          },
                          "high": {
                            "type": "number"
                          },
                          "low": {
                            "type": "number"
                          },
                          "close": {
                            "type": "number"
                          },
                          "volume": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "time",
                          "open",
                          "high",
                          "low",
                          "close",
                          "volume"
                        ]
                      }
                    }
                  },
                  "required": [
                    "market_id",
                    "interval",
                    "candlesticks"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/markets/{market_id}/funding-rate": {
      "get": {
        "operationId": "markets_market_id_funding_rate",
        "summary": "markets/:market_id/funding-rate",
        "parameters": [
          {
            "name": "market_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "market_id": {
                      "type": "number"
                    },
                    "current_funding_rate": {
                      "type": "string"
                    },
                    "window_set": {
                      "type": "number"
                    },
                    "expected_window": {
                      "type": "number"
                    },
                    "funding_start": {
                      "type": "number"
                    },
                    "last_update_time": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "last_update_status": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "global_funding_index": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    }
                  },
                  "required": [
                    "market_id",
                    "current_funding_rate",
                    "window_set",
                    "expected_window",
                    "funding_start",
                    "last_update_time",
                    "last_update_status",
                    "global_funding_index"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/markets/{market_id}/price-data": {
      "get": {
        "operationId": "markets_market_id_price_data",
        "summary": "markets/:market_id/price-data",
        "parameters": [
          {
            "name": "market_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "market_id": {
                      "type": "number"
                    },
                    "symbol": {
                      "type": "string"
                    },
                    "mark_price": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    },
                    "mark_price_e18_raw": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "mark_price_timestamp": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "oracle_price": {
                      "type": "number"
                    },
                    "oracle_price_e18_raw": {
                      "type": "string"
                    },
                    "price_bounds": {
                      "type": "object",
                      "properties": {
                        "lower": {
                          "type": "number"
                        },
                        "upper": {
                          "type": "number"
                        },
                        "lower_e18_raw": {
                          "type": "string"
                        },
                        "upper_e18_raw": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "lower",
                        "upper",
                        "lower_e18_raw",
                        "upper_e18_raw"
                      ]
                    },
                    "suggested_limit_price": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    },
                    "funding_rate": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    },
                    "funding_rate_e18_raw": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "funding_rate_timestamp": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "tick_size": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "market_id",
                    "symbol",
                    "mark_price",
                    "mark_price_e18_raw",
                    "mark_price_timestamp",
                    "oracle_price",
                    "oracle_price_e18_raw",
                    "price_bounds",
                    "suggested_limit_price",
                    "funding_rate",
                    "funding_rate_e18_raw",
                    "funding_rate_timestamp",
                    "tick_size"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/markets/{market_id}/stats": {
      "get": {
        "operationId": "markets_market_id_stats",
        "summary": "markets/:market_id/stats",
        "parameters": [
          {
            "name": "market_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "market_id": {
                      "type": "number"
                    },
                    "volume_24h": {
                      "type": "number"
                    },
                    "price_change_24h": {
                      "type": "number"
                    },
                    "open_interest": {
                      "type": "number"
                    },
                    "mark_price": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    },
                    "next_funding_time": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    }
                  },
                  "required": [
                    "market_id",
                    "volume_24h",
                    "price_change_24h",
                    "open_interest",
                    "mark_price",
                    "next_funding_time"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/markets/home": {
      "get": {
        "operationId": "markets_home",
        "summary": "markets/home",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "market_id": {
                        "type": "number"
                      },
                      "symbol": {
                        "type": "string"
                      },
                      "name": {
                        "type": "string"
                      },
                      "slug": {
                        "type": "string"
                      },
                      "thumbnail_url": {
                        "anyOf": [
                          {
                            "type": "null"
                          },
                          {
                            "type": "string"
                          }
                        ]
                      },
                      "type": {
                        "type": "string",
                        "enum": [
                          "perpetual",
                          "future",
                          "binary_future"
                        ]
                      },
                      "price_display": {
                        "type": "string",
                        "enum": [
                          "usd",
                          "billion_usd",
                          "decimal",
                          "percentage"
                        ]
                      },
                      "tick_size": {
                        "type": "number"
                      },
                      "mark_price": {
                        "anyOf": [
                          {
                            "type": "null"
                          },
                          {
                            "type": "number"
                          }
                        ]
                      },
                      "price_change_24h": {
                        "type": "number"
                      },
                      "volume_24h": {
                        "type": "number"
                      },
                      "categories": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "sparkline_data": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "value": {
                              "type": "number"
                            }
                          },
                          "required": [
                            "value"
                          ]
                        }
                      }
                    },
                    "required": [
                      "market_id",
                      "symbol",
                      "name",
                      "slug",
                      "thumbnail_url",
                      "type",
                      "price_display",
                      "tick_size",
                      "mark_price",
                      "price_change_24h",
                      "volume_24h",
                      "categories",
                      "sparkline_data"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v0/markets/stats": {
      "get": {
        "operationId": "markets_stats",
        "summary": "markets/stats",
        "parameters": [
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "market_id": {
                        "type": "number"
                      },
                      "symbol": {
                        "type": "string"
                      },
                      "volume_24h": {
                        "type": "number"
                      },
                      "price_change_24h": {
                        "type": "number"
                      },
                      "open_interest": {
                        "type": "number"
                      },
                      "mark_price": {
                        "anyOf": [
                          {
                            "type": "null"
                          },
                          {
                            "type": "number"
                          }
                        ]
                      },
                      "last_trade_price": {
                        "anyOf": [
                          {
                            "type": "null"
                          },
                          {
                            "type": "number"
                          }
                        ]
                      },
                      "next_funding_time": {
                        "anyOf": [
                          {
                            "type": "null"
                          },
                          {
                            "type": "string"
                          }
                        ]
                      },
                      "funding_rate": {
                        "anyOf": [
                          {
                            "type": "null"
                          },
                          {
                            "type": "number"
                          }
                        ]
                      },
                      "funding_rate_updated_at": {
                        "anyOf": [
                          {
                            "type": "null"
                          },
                          {
                            "type": "string"
                          }
                        ]
                      }
                    },
                    "required": [
                      "market_id",
                      "symbol",
                      "volume_24h",
                      "price_change_24h",
                      "open_interest",
                      "mark_price",
                      "last_trade_price",
                      "next_funding_time",
                      "funding_rate",
                      "funding_rate_updated_at"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v0/me/api-key/rotate": {
      "post": {
        "operationId": "me_api_key_rotate",
        "summary": "me/api-key/rotate",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "apiKey": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "success",
                    "apiKey"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/me/client/logout": {
      "post": {
        "operationId": "me_client_logout",
        "summary": "me/client/logout",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "success"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/me/client/session": {
      "get": {
        "operationId": "me_client_session",
        "summary": "me/client/session",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "valid": {
                      "type": "boolean"
                    },
                    "expiresAt": {
                      "type": "string"
                    },
                    "walletAddress": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "valid",
                    "expiresAt",
                    "walletAddress"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/orderbook": {
      "get": {
        "operationId": "orderbook",
        "summary": "orderbook",
        "parameters": [
          {
            "name": "symbol",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "symbol": {
                      "type": "string"
                    },
                    "market_id": {
                      "type": "number"
                    },
                    "bids": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "side": {
                            "type": "string",
                            "enum": [
                              "LONG",
                              "SHORT"
                            ]
                          },
                          "price": {
                            "type": "number"
                          },
                          "price_e18_raw": {
                            "type": "string"
                          },
                          "quantity": {
                            "type": "number"
                          },
                          "quantity_e18_raw": {
                            "type": "string"
                          },
                          "order_count": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "side",
                          "price",
                          "price_e18_raw",
                          "quantity",
                          "quantity_e18_raw",
                          "order_count"
                        ]
                      }
                    },
                    "asks": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "side": {
                            "type": "string",
                            "enum": [
                              "LONG",
                              "SHORT"
                            ]
                          },
                          "price": {
                            "type": "number"
                          },
                          "price_e18_raw": {
                            "type": "string"
                          },
                          "quantity": {
                            "type": "number"
                          },
                          "quantity_e18_raw": {
                            "type": "string"
                          },
                          "order_count": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "side",
                          "price",
                          "price_e18_raw",
                          "quantity",
                          "quantity_e18_raw",
                          "order_count"
                        ]
                      }
                    },
                    "timestamp": {
                      "type": "number"
                    },
                    "read_after": {
                      "type": "object",
                      "properties": {
                        "shard_id": {
                          "type": "string"
                        },
                        "shard_seq": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "shard_id",
                        "shard_seq"
                      ]
                    }
                  },
                  "required": [
                    "symbol",
                    "market_id",
                    "bids",
                    "asks",
                    "timestamp"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/orderbook/by-market/{market_id}": {
      "get": {
        "operationId": "orderbook_by_market_market_id",
        "summary": "orderbook/by-market/:market_id",
        "parameters": [
          {
            "name": "market_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "market_id": {
                      "type": "number"
                    },
                    "long_levels": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "side": {
                            "type": "string",
                            "enum": [
                              "LONG",
                              "SHORT"
                            ]
                          },
                          "price": {
                            "type": "number"
                          },
                          "price_e18_raw": {
                            "type": "string"
                          },
                          "quantity": {
                            "type": "number"
                          },
                          "quantity_e18_raw": {
                            "type": "string"
                          },
                          "order_count": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "side",
                          "price",
                          "price_e18_raw",
                          "quantity",
                          "quantity_e18_raw",
                          "order_count"
                        ]
                      }
                    },
                    "short_levels": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "side": {
                            "type": "string",
                            "enum": [
                              "LONG",
                              "SHORT"
                            ]
                          },
                          "price": {
                            "type": "number"
                          },
                          "price_e18_raw": {
                            "type": "string"
                          },
                          "quantity": {
                            "type": "number"
                          },
                          "quantity_e18_raw": {
                            "type": "string"
                          },
                          "order_count": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "side",
                          "price",
                          "price_e18_raw",
                          "quantity",
                          "quantity_e18_raw",
                          "order_count"
                        ]
                      }
                    },
                    "depth": {
                      "type": "number"
                    },
                    "read_after": {
                      "type": "object",
                      "properties": {
                        "shard_id": {
                          "type": "string"
                        },
                        "shard_seq": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "shard_id",
                        "shard_seq"
                      ]
                    }
                  },
                  "required": [
                    "market_id",
                    "long_levels",
                    "short_levels",
                    "depth"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/orders": {
      "post": {
        "operationId": "orders",
        "summary": "orders",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "market_id": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "side": {
                    "type": "string",
                    "enum": [
                      "LONG",
                      "SHORT"
                    ]
                  },
                  "price": {
                    "type": "number",
                    "minimum": 0
                  },
                  "quantity": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "usd_amount": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "order_type": {
                    "type": "string",
                    "enum": [
                      "MARKET",
                      "LIMIT",
                      "STOP_LIMIT",
                      "STOP_MARKET",
                      "TAKE_PROFIT_LIMIT",
                      "TAKE_PROFIT_MARKET",
                      "STOP_LOSS_LIMIT",
                      "STOP_LOSS_MARKET"
                    ]
                  },
                  "leverage": {
                    "default": 1,
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "cancel_on_revert": {
                    "type": "boolean"
                  },
                  "salt": {
                    "type": "string"
                  },
                  "signature": {
                    "type": "string"
                  },
                  "expiration_seconds": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "signature_type": {
                    "type": "number"
                  },
                  "trigger_price": {
                    "type": "number",
                    "minimum": 0
                  },
                  "reduce_only": {
                    "type": "boolean"
                  },
                  "symbol": {
                    "type": "string"
                  },
                  "userAddress": {
                    "type": "string"
                  },
                  "time_in_force": {
                    "type": "string",
                    "enum": [
                      "FOK",
                      "IOC",
                      "GTT"
                    ]
                  },
                  "post_only": {
                    "type": "boolean"
                  },
                  "client_id": {
                    "type": "string"
                  },
                  "parent_address": {
                    "type": "string"
                  }
                },
                "required": [
                  "market_id",
                  "side",
                  "order_type",
                  "salt",
                  "signature",
                  "expiration_seconds",
                  "signature_type"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "order": {
                      "type": "object",
                      "properties": {
                        "order_id": {
                          "type": "number"
                        },
                        "user_id": {
                          "type": "number"
                        },
                        "account_kind": {
                          "type": "string",
                          "enum": [
                            "user",
                            "child_vault"
                          ]
                        },
                        "account_id": {
                          "type": "string"
                        },
                        "account_address": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "market_id": {
                          "type": "number"
                        },
                        "side": {
                          "type": "string",
                          "enum": [
                            "LONG",
                            "SHORT"
                          ]
                        },
                        "order_type": {
                          "type": "string",
                          "enum": [
                            "MARKET",
                            "LIMIT",
                            "STOP_LIMIT",
                            "STOP_MARKET",
                            "TAKE_PROFIT_LIMIT",
                            "TAKE_PROFIT_MARKET",
                            "STOP_LOSS_LIMIT",
                            "STOP_LOSS_MARKET"
                          ]
                        },
                        "price": {
                          "type": "number"
                        },
                        "price_e18_raw": {
                          "type": "string"
                        },
                        "quantity": {
                          "type": "number"
                        },
                        "quantity_e18_raw": {
                          "type": "string"
                        },
                        "remaining_quantity": {
                          "type": "number"
                        },
                        "remaining_quantity_e18_raw": {
                          "type": "string"
                        },
                        "status": {
                          "type": "string",
                          "enum": [
                            "CANCELLED",
                            "EXPIRED",
                            "FILLED",
                            "OPEN",
                            "PENDING_TRIGGER",
                            "CANCEL_PENDING_FINALIZE"
                          ]
                        },
                        "salt": {
                          "type": "string"
                        },
                        "signature": {
                          "type": "string"
                        },
                        "expiration_seconds": {
                          "type": "number"
                        },
                        "signature_type": {
                          "type": "number"
                        },
                        "order_hash": {
                          "type": "string"
                        },
                        "cancel_on_revert": {
                          "type": "boolean"
                        },
                        "leverage": {
                          "type": "number"
                        },
                        "leverage_e18_raw": {
                          "type": "string"
                        },
                        "reserved_margin": {
                          "type": "number"
                        },
                        "reserved_margin_e18_raw": {
                          "type": "string"
                        },
                        "trigger_price": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "number"
                            }
                          ]
                        },
                        "trigger_price_e18_raw": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "reduce_only": {
                          "type": "boolean"
                        },
                        "original_order_type": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string",
                              "const": "MARKET"
                            },
                            {
                              "type": "string",
                              "const": "LIMIT"
                            },
                            {
                              "type": "string",
                              "const": "STOP_LIMIT"
                            },
                            {
                              "type": "string",
                              "const": "STOP_MARKET"
                            },
                            {
                              "type": "string",
                              "const": "TAKE_PROFIT_LIMIT"
                            },
                            {
                              "type": "string",
                              "const": "TAKE_PROFIT_MARKET"
                            },
                            {
                              "type": "string",
                              "const": "STOP_LOSS_LIMIT"
                            },
                            {
                              "type": "string",
                              "const": "STOP_LOSS_MARKET"
                            },
                            {
                              "type": "string",
                              "const": "LIQUIDATION"
                            }
                          ]
                        },
                        "created_time": {
                          "type": "string"
                        },
                        "updated_time": {
                          "type": "string"
                        },
                        "cancelled_time": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "cancel_reason": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "cancel_pending_sealed_e18_raw": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "avg_fill_price": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "number"
                            }
                          ]
                        }
                      },
                      "required": [
                        "order_id",
                        "user_id",
                        "account_kind",
                        "account_id",
                        "market_id",
                        "side",
                        "order_type",
                        "price",
                        "price_e18_raw",
                        "quantity",
                        "quantity_e18_raw",
                        "remaining_quantity",
                        "remaining_quantity_e18_raw",
                        "status",
                        "salt",
                        "signature",
                        "expiration_seconds",
                        "signature_type",
                        "order_hash",
                        "cancel_on_revert",
                        "leverage",
                        "reserved_margin",
                        "reserved_margin_e18_raw",
                        "trigger_price",
                        "trigger_price_e18_raw",
                        "reduce_only",
                        "original_order_type",
                        "created_time",
                        "updated_time",
                        "cancelled_time",
                        "cancel_reason",
                        "avg_fill_price"
                      ]
                    },
                    "balance": {
                      "type": "object",
                      "properties": {
                        "eoa_address": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "reserved_margin_e18_raw": {
                          "type": "string"
                        },
                        "total_margin_e18_raw": {
                          "type": "string"
                        },
                        "available_margin_e18_raw": {
                          "type": "string"
                        },
                        "pending_adjustment_margin_e18_raw": {
                          "type": "string"
                        },
                        "pending_withdrawal_margin_e18_raw": {
                          "type": "string"
                        },
                        "pending_direct_withdrawal_margin_e18_raw": {
                          "type": "string"
                        },
                        "collateral_shortfall_e18_raw": {
                          "type": "string"
                        },
                        "next_withdrawal_nonce": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "account_seq": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "eoa_address",
                        "reserved_margin_e18_raw",
                        "total_margin_e18_raw",
                        "available_margin_e18_raw",
                        "pending_adjustment_margin_e18_raw",
                        "pending_withdrawal_margin_e18_raw",
                        "pending_direct_withdrawal_margin_e18_raw",
                        "collateral_shortfall_e18_raw",
                        "next_withdrawal_nonce",
                        "account_seq"
                      ]
                    },
                    "fills": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "fill_id": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "maker_order_id": {
                            "type": "number"
                          },
                          "taker_order_id": {
                            "type": "number"
                          },
                          "user_id": {
                            "type": "number"
                          },
                          "market_id": {
                            "type": "number"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "LONG",
                              "SHORT"
                            ]
                          },
                          "quantity": {
                            "type": "number"
                          },
                          "quantity_e18_raw": {
                            "type": "string"
                          },
                          "price": {
                            "type": "number"
                          },
                          "price_e18_raw": {
                            "type": "string"
                          },
                          "notional": {
                            "type": "number"
                          },
                          "notional_e18_raw": {
                            "type": "string"
                          },
                          "fee": {
                            "type": "number"
                          },
                          "fee_e18_raw": {
                            "type": "string"
                          },
                          "reserved_margin": {
                            "type": "number"
                          },
                          "reserved_margin_e18_raw": {
                            "type": "string"
                          },
                          "created_time": {
                            "type": "string"
                          },
                          "symbol": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "username": {
                            "type": "string"
                          },
                          "leverage": {
                            "type": "number"
                          },
                          "reduce_only": {
                            "type": "boolean"
                          },
                          "order_id": {
                            "type": "number"
                          },
                          "batch_id": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "fill_status": {
                            "type": "string",
                            "enum": [
                              "SUBMITTED",
                              "FAILED",
                              "PENDING",
                              "ONCHAIN",
                              "SETTLED",
                              "ORPHANED"
                            ]
                          },
                          "batch_status": {
                            "type": "string",
                            "enum": [
                              "FAILED",
                              "PENDING",
                              "ONCHAIN"
                            ]
                          },
                          "tx_hash": {
                            "type": "string"
                          },
                          "block_number": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "fill_id",
                          "maker_order_id",
                          "taker_order_id",
                          "user_id",
                          "market_id",
                          "role",
                          "quantity",
                          "quantity_e18_raw",
                          "price",
                          "price_e18_raw",
                          "notional",
                          "notional_e18_raw",
                          "fee",
                          "fee_e18_raw",
                          "reserved_margin",
                          "reserved_margin_e18_raw",
                          "created_time",
                          "symbol",
                          "leverage",
                          "order_id"
                        ]
                      }
                    },
                    "message": {
                      "type": "string"
                    },
                    "read_after": {
                      "type": "object",
                      "properties": {
                        "shard_id": {
                          "type": "string"
                        },
                        "shard_seq": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "shard_id",
                        "shard_seq"
                      ]
                    }
                  },
                  "required": [
                    "order",
                    "fills",
                    "message"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/orders/{order_id}": {
      "get": {
        "operationId": "orders_order_id",
        "summary": "orders/:order_id",
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "market_id": {
                      "type": "number"
                    },
                    "updated_time": {
                      "type": "string"
                    },
                    "leverage_e18_raw": {
                      "type": "string"
                    },
                    "order_id": {
                      "type": "number"
                    },
                    "signature": {
                      "type": "string"
                    },
                    "created_time": {
                      "type": "string"
                    },
                    "side": {
                      "type": "string",
                      "enum": [
                        "LONG",
                        "SHORT"
                      ]
                    },
                    "order_type": {
                      "type": "string",
                      "enum": [
                        "MARKET",
                        "LIMIT",
                        "STOP_LIMIT",
                        "STOP_MARKET",
                        "TAKE_PROFIT_LIMIT",
                        "TAKE_PROFIT_MARKET",
                        "STOP_LOSS_LIMIT",
                        "STOP_LOSS_MARKET"
                      ]
                    },
                    "price": {
                      "type": "number"
                    },
                    "price_e18_raw": {
                      "type": "string"
                    },
                    "quantity": {
                      "type": "number"
                    },
                    "quantity_e18_raw": {
                      "type": "string"
                    },
                    "remaining_quantity": {
                      "type": "number"
                    },
                    "remaining_quantity_e18_raw": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "CANCELLED",
                        "EXPIRED",
                        "FILLED",
                        "OPEN",
                        "PENDING_TRIGGER",
                        "CANCEL_PENDING_FINALIZE"
                      ]
                    },
                    "salt": {
                      "type": "string"
                    },
                    "expiration_seconds": {
                      "type": "number"
                    },
                    "signature_type": {
                      "type": "number"
                    },
                    "order_hash": {
                      "type": "string"
                    },
                    "cancel_on_revert": {
                      "type": "boolean"
                    },
                    "leverage": {
                      "type": "number"
                    },
                    "reserved_margin": {
                      "type": "number"
                    },
                    "reserved_margin_e18_raw": {
                      "type": "string"
                    },
                    "trigger_price": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    },
                    "trigger_price_e18_raw": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "reduce_only": {
                      "type": "boolean"
                    },
                    "original_order_type": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string",
                          "const": "MARKET"
                        },
                        {
                          "type": "string",
                          "const": "LIMIT"
                        },
                        {
                          "type": "string",
                          "const": "STOP_LIMIT"
                        },
                        {
                          "type": "string",
                          "const": "STOP_MARKET"
                        },
                        {
                          "type": "string",
                          "const": "TAKE_PROFIT_LIMIT"
                        },
                        {
                          "type": "string",
                          "const": "TAKE_PROFIT_MARKET"
                        },
                        {
                          "type": "string",
                          "const": "STOP_LOSS_LIMIT"
                        },
                        {
                          "type": "string",
                          "const": "STOP_LOSS_MARKET"
                        },
                        {
                          "type": "string",
                          "const": "LIQUIDATION"
                        }
                      ]
                    },
                    "cancelled_time": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "cancel_reason": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "cancel_pending_sealed_e18_raw": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "avg_fill_price": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    },
                    "user_id": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    },
                    "account_kind": {
                      "type": "string",
                      "enum": [
                        "user",
                        "child_vault"
                      ]
                    },
                    "account_id": {
                      "type": "string"
                    },
                    "account_address": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    }
                  },
                  "required": [
                    "market_id",
                    "updated_time",
                    "order_id",
                    "signature",
                    "created_time",
                    "side",
                    "order_type",
                    "price",
                    "price_e18_raw",
                    "quantity",
                    "quantity_e18_raw",
                    "remaining_quantity",
                    "remaining_quantity_e18_raw",
                    "status",
                    "salt",
                    "expiration_seconds",
                    "signature_type",
                    "order_hash",
                    "cancel_on_revert",
                    "leverage",
                    "reserved_margin",
                    "reserved_margin_e18_raw",
                    "trigger_price",
                    "trigger_price_e18_raw",
                    "reduce_only",
                    "original_order_type",
                    "cancelled_time",
                    "cancel_reason",
                    "avg_fill_price",
                    "user_id",
                    "account_kind",
                    "account_id",
                    "account_address"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/orders/{order_id}/events": {
      "get": {
        "operationId": "orders_order_id_events",
        "summary": "orders/:order_id/events",
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "order_id": {
                      "type": "number"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "number"
                          },
                          "order_id": {
                            "type": "number"
                          },
                          "order_hash": {
                            "type": "string"
                          },
                          "user_id": {
                            "type": "number"
                          },
                          "market_id": {
                            "type": "number"
                          },
                          "event_type": {
                            "type": "string",
                            "enum": [
                              "CREATED",
                              "CANCELLED",
                              "EXPIRED",
                              "FILLED",
                              "PARTIALLY_FILLED",
                              "LIQUIDATED",
                              "REVERT_FILL"
                            ]
                          },
                          "triggered_by": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "reason": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "order_details": {},
                          "created_time": {
                            "type": "string"
                          },
                          "side": {
                            "type": "string",
                            "enum": [
                              "LONG",
                              "SHORT"
                            ]
                          },
                          "price": {
                            "type": "number"
                          },
                          "quantity": {
                            "type": "number"
                          },
                          "eoa_address": {
                            "type": "string"
                          },
                          "name": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "username": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "order_id",
                          "order_hash",
                          "user_id",
                          "market_id",
                          "event_type",
                          "triggered_by",
                          "reason",
                          "order_details",
                          "created_time"
                        ]
                      }
                    }
                  },
                  "required": [
                    "order_id",
                    "events"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/orders/{order_id}/fill-processing-status": {
      "get": {
        "operationId": "orders_order_id_fill_processing_status",
        "summary": "orders/:order_id/fill-processing-status",
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "order_id": {
                      "type": "number"
                    },
                    "is_processing": {
                      "type": "boolean"
                    },
                    "total_fills": {
                      "type": "number"
                    },
                    "pending_fills": {
                      "type": "number"
                    },
                    "settled_fills": {
                      "type": "number"
                    },
                    "failed_fills": {
                      "type": "number"
                    },
                    "reverted_fills": {
                      "type": "number"
                    },
                    "batch_statuses": {
                      "type": "array",
                      "items": {
                        "anyOf": [
                          {
                            "type": "null"
                          },
                          {
                            "type": "string"
                          }
                        ]
                      }
                    }
                  },
                  "required": [
                    "order_id",
                    "is_processing",
                    "total_fills",
                    "pending_fills",
                    "settled_fills",
                    "failed_fills",
                    "reverted_fills",
                    "batch_statuses"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/orders/{order_id}/fills": {
      "get": {
        "operationId": "orders_order_id_fills",
        "summary": "orders/:order_id/fills",
        "parameters": [
          {
            "name": "order_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "order_id": {
                      "type": "number"
                    },
                    "fills": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "fill_id": {
                            "anyOf": [
                              {
                                "type": "string"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "maker_order_id": {
                            "type": "number"
                          },
                          "taker_order_id": {
                            "type": "number"
                          },
                          "user_id": {
                            "type": "number"
                          },
                          "market_id": {
                            "type": "number"
                          },
                          "role": {
                            "type": "string",
                            "enum": [
                              "LONG",
                              "SHORT"
                            ]
                          },
                          "quantity": {
                            "type": "number"
                          },
                          "quantity_e18_raw": {
                            "type": "string"
                          },
                          "price": {
                            "type": "number"
                          },
                          "price_e18_raw": {
                            "type": "string"
                          },
                          "notional": {
                            "type": "number"
                          },
                          "notional_e18_raw": {
                            "type": "string"
                          },
                          "fee": {
                            "type": "number"
                          },
                          "fee_e18_raw": {
                            "type": "string"
                          },
                          "reserved_margin": {
                            "type": "number"
                          },
                          "reserved_margin_e18_raw": {
                            "type": "string"
                          },
                          "created_time": {
                            "type": "string"
                          },
                          "symbol": {
                            "type": "string"
                          },
                          "name": {
                            "type": "string"
                          },
                          "username": {
                            "type": "string"
                          },
                          "leverage": {
                            "type": "number"
                          },
                          "reduce_only": {
                            "type": "boolean"
                          },
                          "order_id": {
                            "type": "number"
                          },
                          "batch_id": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "fill_status": {
                            "type": "string",
                            "enum": [
                              "SUBMITTED",
                              "FAILED",
                              "PENDING",
                              "ONCHAIN",
                              "SETTLED",
                              "ORPHANED"
                            ]
                          },
                          "batch_status": {
                            "type": "string",
                            "enum": [
                              "FAILED",
                              "PENDING",
                              "ONCHAIN"
                            ]
                          },
                          "tx_hash": {
                            "type": "string"
                          },
                          "block_number": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "fill_id",
                          "maker_order_id",
                          "taker_order_id",
                          "user_id",
                          "market_id",
                          "role",
                          "quantity",
                          "quantity_e18_raw",
                          "price",
                          "price_e18_raw",
                          "notional",
                          "notional_e18_raw",
                          "fee",
                          "fee_e18_raw",
                          "reserved_margin",
                          "reserved_margin_e18_raw",
                          "created_time",
                          "symbol",
                          "leverage",
                          "order_id"
                        ]
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "limit": {
                          "type": "number"
                        },
                        "offset": {
                          "type": "number"
                        },
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "limit",
                        "offset",
                        "count"
                      ]
                    }
                  },
                  "required": [
                    "order_id",
                    "fills",
                    "pagination"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/orders/by-market/{market_id}": {
      "get": {
        "operationId": "orders_by_market_market_id",
        "summary": "orders/by-market/:market_id",
        "parameters": [
          {
            "name": "market_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "FILLED",
                "CANCELLED",
                "EXPIRED",
                "PENDING_TRIGGER",
                "CANCEL_PENDING_FINALIZE"
              ]
            }
          },
          {
            "name": "side",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "LONG",
                "SHORT"
              ]
            }
          },
          {
            "name": "order_type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "MARKET",
                "LIMIT",
                "STOP_LIMIT",
                "STOP_MARKET",
                "TAKE_PROFIT_LIMIT",
                "TAKE_PROFIT_MARKET",
                "STOP_LOSS_LIMIT",
                "STOP_LOSS_MARKET"
              ]
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "NEWEST",
                "BOOK"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "market_id": {
                      "type": "number"
                    },
                    "orders": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "market_id": {
                            "type": "number"
                          },
                          "updated_time": {
                            "type": "string"
                          },
                          "leverage_e18_raw": {
                            "type": "string"
                          },
                          "order_id": {
                            "type": "number"
                          },
                          "signature": {
                            "type": "string"
                          },
                          "created_time": {
                            "type": "string"
                          },
                          "side": {
                            "type": "string",
                            "enum": [
                              "LONG",
                              "SHORT"
                            ]
                          },
                          "order_type": {
                            "type": "string",
                            "enum": [
                              "MARKET",
                              "LIMIT",
                              "STOP_LIMIT",
                              "STOP_MARKET",
                              "TAKE_PROFIT_LIMIT",
                              "TAKE_PROFIT_MARKET",
                              "STOP_LOSS_LIMIT",
                              "STOP_LOSS_MARKET"
                            ]
                          },
                          "price": {
                            "type": "number"
                          },
                          "price_e18_raw": {
                            "type": "string"
                          },
                          "quantity": {
                            "type": "number"
                          },
                          "quantity_e18_raw": {
                            "type": "string"
                          },
                          "remaining_quantity": {
                            "type": "number"
                          },
                          "remaining_quantity_e18_raw": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "CANCELLED",
                              "EXPIRED",
                              "FILLED",
                              "OPEN",
                              "PENDING_TRIGGER",
                              "CANCEL_PENDING_FINALIZE"
                            ]
                          },
                          "salt": {
                            "type": "string"
                          },
                          "expiration_seconds": {
                            "type": "number"
                          },
                          "signature_type": {
                            "type": "number"
                          },
                          "order_hash": {
                            "type": "string"
                          },
                          "cancel_on_revert": {
                            "type": "boolean"
                          },
                          "leverage": {
                            "type": "number"
                          },
                          "reserved_margin": {
                            "type": "number"
                          },
                          "reserved_margin_e18_raw": {
                            "type": "string"
                          },
                          "trigger_price": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "trigger_price_e18_raw": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "reduce_only": {
                            "type": "boolean"
                          },
                          "original_order_type": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string",
                                "const": "MARKET"
                              },
                              {
                                "type": "string",
                                "const": "LIMIT"
                              },
                              {
                                "type": "string",
                                "const": "STOP_LIMIT"
                              },
                              {
                                "type": "string",
                                "const": "STOP_MARKET"
                              },
                              {
                                "type": "string",
                                "const": "TAKE_PROFIT_LIMIT"
                              },
                              {
                                "type": "string",
                                "const": "TAKE_PROFIT_MARKET"
                              },
                              {
                                "type": "string",
                                "const": "STOP_LOSS_LIMIT"
                              },
                              {
                                "type": "string",
                                "const": "STOP_LOSS_MARKET"
                              },
                              {
                                "type": "string",
                                "const": "LIQUIDATION"
                              }
                            ]
                          },
                          "cancelled_time": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "cancel_reason": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "cancel_pending_sealed_e18_raw": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "avg_fill_price": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "user_id": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "account_kind": {
                            "type": "string",
                            "enum": [
                              "user",
                              "child_vault"
                            ]
                          },
                          "account_id": {
                            "type": "string"
                          },
                          "account_address": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          }
                        },
                        "required": [
                          "market_id",
                          "updated_time",
                          "order_id",
                          "signature",
                          "created_time",
                          "side",
                          "order_type",
                          "price",
                          "price_e18_raw",
                          "quantity",
                          "quantity_e18_raw",
                          "remaining_quantity",
                          "remaining_quantity_e18_raw",
                          "status",
                          "salt",
                          "expiration_seconds",
                          "signature_type",
                          "order_hash",
                          "cancel_on_revert",
                          "leverage",
                          "reserved_margin",
                          "reserved_margin_e18_raw",
                          "trigger_price",
                          "trigger_price_e18_raw",
                          "reduce_only",
                          "original_order_type",
                          "cancelled_time",
                          "cancel_reason",
                          "avg_fill_price",
                          "user_id",
                          "account_kind",
                          "account_id",
                          "account_address"
                        ]
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "limit": {
                          "type": "number"
                        },
                        "offset": {
                          "type": "number"
                        },
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "limit",
                        "offset",
                        "count"
                      ]
                    }
                  },
                  "required": [
                    "market_id",
                    "orders",
                    "pagination"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/orders/by-user/{user_id}": {
      "get": {
        "operationId": "orders_by_user_user_id",
        "summary": "orders/by-user/:user_id",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "market_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "OPEN",
                "FILLED",
                "CANCELLED",
                "EXPIRED",
                "PENDING_TRIGGER",
                "CANCEL_PENDING_FINALIZE",
                "ACTIVE",
                "TERMINAL"
              ]
            }
          },
          {
            "name": "side",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "LONG",
                "SHORT"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user_id": {
                      "type": "number"
                    },
                    "orders": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "order_id": {
                            "type": "number"
                          },
                          "user_id": {
                            "type": "number"
                          },
                          "account_kind": {
                            "type": "string",
                            "enum": [
                              "user",
                              "child_vault"
                            ]
                          },
                          "account_id": {
                            "type": "string"
                          },
                          "account_address": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "market_id": {
                            "type": "number"
                          },
                          "side": {
                            "type": "string",
                            "enum": [
                              "LONG",
                              "SHORT"
                            ]
                          },
                          "order_type": {
                            "type": "string",
                            "enum": [
                              "MARKET",
                              "LIMIT",
                              "STOP_LIMIT",
                              "STOP_MARKET",
                              "TAKE_PROFIT_LIMIT",
                              "TAKE_PROFIT_MARKET",
                              "STOP_LOSS_LIMIT",
                              "STOP_LOSS_MARKET"
                            ]
                          },
                          "price": {
                            "type": "number"
                          },
                          "price_e18_raw": {
                            "type": "string"
                          },
                          "quantity": {
                            "type": "number"
                          },
                          "quantity_e18_raw": {
                            "type": "string"
                          },
                          "remaining_quantity": {
                            "type": "number"
                          },
                          "remaining_quantity_e18_raw": {
                            "type": "string"
                          },
                          "status": {
                            "type": "string",
                            "enum": [
                              "CANCELLED",
                              "EXPIRED",
                              "FILLED",
                              "OPEN",
                              "PENDING_TRIGGER",
                              "CANCEL_PENDING_FINALIZE"
                            ]
                          },
                          "salt": {
                            "type": "string"
                          },
                          "signature": {
                            "type": "string"
                          },
                          "expiration_seconds": {
                            "type": "number"
                          },
                          "signature_type": {
                            "type": "number"
                          },
                          "order_hash": {
                            "type": "string"
                          },
                          "cancel_on_revert": {
                            "type": "boolean"
                          },
                          "leverage": {
                            "type": "number"
                          },
                          "leverage_e18_raw": {
                            "type": "string"
                          },
                          "reserved_margin": {
                            "type": "number"
                          },
                          "reserved_margin_e18_raw": {
                            "type": "string"
                          },
                          "trigger_price": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "trigger_price_e18_raw": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "reduce_only": {
                            "type": "boolean"
                          },
                          "original_order_type": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string",
                                "const": "MARKET"
                              },
                              {
                                "type": "string",
                                "const": "LIMIT"
                              },
                              {
                                "type": "string",
                                "const": "STOP_LIMIT"
                              },
                              {
                                "type": "string",
                                "const": "STOP_MARKET"
                              },
                              {
                                "type": "string",
                                "const": "TAKE_PROFIT_LIMIT"
                              },
                              {
                                "type": "string",
                                "const": "TAKE_PROFIT_MARKET"
                              },
                              {
                                "type": "string",
                                "const": "STOP_LOSS_LIMIT"
                              },
                              {
                                "type": "string",
                                "const": "STOP_LOSS_MARKET"
                              },
                              {
                                "type": "string",
                                "const": "LIQUIDATION"
                              }
                            ]
                          },
                          "created_time": {
                            "type": "string"
                          },
                          "updated_time": {
                            "type": "string"
                          },
                          "cancelled_time": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "cancel_reason": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "cancel_pending_sealed_e18_raw": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "avg_fill_price": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          }
                        },
                        "required": [
                          "order_id",
                          "user_id",
                          "account_kind",
                          "account_id",
                          "market_id",
                          "side",
                          "order_type",
                          "price",
                          "price_e18_raw",
                          "quantity",
                          "quantity_e18_raw",
                          "remaining_quantity",
                          "remaining_quantity_e18_raw",
                          "status",
                          "salt",
                          "signature",
                          "expiration_seconds",
                          "signature_type",
                          "order_hash",
                          "cancel_on_revert",
                          "leverage",
                          "reserved_margin",
                          "reserved_margin_e18_raw",
                          "trigger_price",
                          "trigger_price_e18_raw",
                          "reduce_only",
                          "original_order_type",
                          "created_time",
                          "updated_time",
                          "cancelled_time",
                          "cancel_reason",
                          "avg_fill_price"
                        ]
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "limit": {
                          "type": "number"
                        },
                        "offset": {
                          "type": "number"
                        },
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "limit",
                        "offset",
                        "count"
                      ]
                    }
                  },
                  "required": [
                    "user_id",
                    "orders",
                    "pagination"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/orders/calculate-quantity": {
      "post": {
        "operationId": "orders_calculate_quantity",
        "summary": "orders/calculate-quantity",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "market_id": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "side": {
                    "type": "string",
                    "enum": [
                      "LONG",
                      "SHORT"
                    ]
                  },
                  "price": {
                    "type": "number",
                    "minimum": 0
                  },
                  "order_type": {
                    "type": "string",
                    "enum": [
                      "MARKET",
                      "LIMIT"
                    ]
                  },
                  "trigger_price": {
                    "type": "number",
                    "minimum": 0
                  },
                  "reduce_only": {
                    "default": false,
                    "type": "boolean"
                  },
                  "leverage": {
                    "default": 1,
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "usd_amount": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "target_notional": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "include_position_netting": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "market_id",
                  "side",
                  "order_type",
                  "usd_amount"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "quantity": {
                      "type": "number"
                    },
                    "usd_amount": {
                      "type": "number"
                    },
                    "estimated_cost": {
                      "type": "number"
                    },
                    "estimated_fee": {
                      "type": "number"
                    },
                    "price_used": {
                      "type": "number"
                    },
                    "estimated_clearing_price": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    }
                  },
                  "required": [
                    "quantity",
                    "usd_amount",
                    "estimated_cost",
                    "estimated_fee",
                    "price_used",
                    "estimated_clearing_price"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/orders/cancel/all": {
      "post": {
        "operationId": "orders_cancel_all",
        "summary": "orders/cancel/all",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "market_id": {
                    "type": "number"
                  },
                  "reason": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "is_duplicate": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "user_id": {
                      "type": "number"
                    },
                    "cancelled_count": {
                      "type": "number"
                    },
                    "orders": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "order_id": {
                            "type": "number"
                          },
                          "order_hash": {
                            "type": "string"
                          }
                        },
                        "required": [
                          "order_id",
                          "order_hash"
                        ]
                      }
                    },
                    "read_after": {
                      "type": "object",
                      "properties": {
                        "shard_id": {
                          "type": "string"
                        },
                        "shard_seq": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "shard_id",
                        "shard_seq"
                      ]
                    }
                  },
                  "required": [
                    "is_duplicate",
                    "message",
                    "user_id",
                    "cancelled_count",
                    "orders"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/orders/cancel/batch": {
      "post": {
        "operationId": "orders_cancel_batch",
        "summary": "orders/cancel/batch",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "orderHashes": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "cancelSignature": {
                    "type": "string"
                  },
                  "parentAddress": {
                    "type": "string"
                  }
                },
                "required": [
                  "orderHashes",
                  "cancelSignature"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "is_duplicate": {
                      "type": "boolean"
                    },
                    "success": {
                      "type": "boolean"
                    },
                    "cancelledOrders": {
                      "type": "number"
                    },
                    "requestedCount": {
                      "type": "number"
                    },
                    "read_after": {
                      "type": "object",
                      "properties": {
                        "shard_id": {
                          "type": "string"
                        },
                        "shard_seq": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "shard_id",
                        "shard_seq"
                      ]
                    }
                  },
                  "required": [
                    "is_duplicate",
                    "success",
                    "cancelledOrders",
                    "requestedCount"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/orders/cancel/by-hash/{order_hash}": {
      "post": {
        "operationId": "orders_cancel_by_hash_order_hash",
        "summary": "orders/cancel/by-hash/:order_hash",
        "parameters": [
          {
            "name": "order_hash",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "reason": {
                    "type": "string"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "is_duplicate": {
                      "type": "boolean"
                    },
                    "message": {
                      "type": "string"
                    },
                    "order_id": {
                      "type": "number"
                    },
                    "order_hash": {
                      "type": "string"
                    },
                    "user_id": {
                      "type": "number"
                    },
                    "cancelled": {
                      "type": "boolean"
                    },
                    "read_after": {
                      "type": "object",
                      "properties": {
                        "shard_id": {
                          "type": "string"
                        },
                        "shard_seq": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "shard_id",
                        "shard_seq"
                      ]
                    }
                  },
                  "required": [
                    "is_duplicate",
                    "message",
                    "order_id",
                    "order_hash",
                    "user_id",
                    "cancelled"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/orders/estimate": {
      "post": {
        "operationId": "orders_estimate",
        "summary": "orders/estimate",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "market_id": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "side": {
                    "type": "string",
                    "enum": [
                      "LONG",
                      "SHORT"
                    ]
                  },
                  "order_type": {
                    "type": "string",
                    "enum": [
                      "MARKET",
                      "LIMIT"
                    ]
                  },
                  "leverage": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 9007199254740991
                  },
                  "asset": {
                    "type": "string",
                    "enum": [
                      "USDM",
                      "ASSET"
                    ]
                  },
                  "size": {
                    "type": "number",
                    "minimum": 0
                  },
                  "price": {
                    "type": "number",
                    "minimum": 0
                  },
                  "trigger_price": {
                    "type": "number",
                    "minimum": 0
                  },
                  "reduce_only": {
                    "default": false,
                    "type": "boolean"
                  }
                },
                "required": [
                  "market_id",
                  "side",
                  "order_type",
                  "leverage",
                  "asset",
                  "size"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "violation": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string",
                          "const": "P34"
                        },
                        {
                          "type": "string",
                          "const": "P35"
                        },
                        {
                          "type": "string",
                          "const": "P36"
                        },
                        {
                          "type": "string",
                          "const": "P37"
                        }
                      ]
                    },
                    "warning": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "current_margin_ratio": {
                      "type": "number"
                    },
                    "new_margin_ratio": {
                      "type": "number"
                    },
                    "imr": {
                      "type": "number"
                    },
                    "mmr": {
                      "type": "number"
                    },
                    "quantity": {
                      "type": "number"
                    },
                    "execution_price": {
                      "type": "number"
                    },
                    "estimated_clearing_price": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    },
                    "estimated_cost": {
                      "type": "number"
                    },
                    "estimated_fee": {
                      "type": "number"
                    },
                    "available_margin": {
                      "type": "number"
                    },
                    "max_quantity": {
                      "type": "number"
                    },
                    "max_notional": {
                      "type": "number"
                    },
                    "required_top_up_e18_raw": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "required_top_up": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    },
                    "top_up_status": {
                      "type": "string",
                      "enum": [
                        "required",
                        "not_needed",
                        "uncurable"
                      ]
                    },
                    "top_up_uncurable_reason": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "violation",
                    "warning",
                    "current_margin_ratio",
                    "new_margin_ratio",
                    "imr",
                    "mmr",
                    "quantity",
                    "execution_price",
                    "estimated_clearing_price",
                    "estimated_cost",
                    "estimated_fee",
                    "available_margin",
                    "max_quantity",
                    "max_notional",
                    "required_top_up_e18_raw",
                    "required_top_up",
                    "top_up_status"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/orders/place-with-top-up": {
      "post": {
        "operationId": "orders_place_with_top_up",
        "summary": "orders/place-with-top-up",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "top_up": {
                    "type": "object",
                    "properties": {
                      "amount_e18_raw": {
                        "type": "string",
                        "pattern": "^[0-9]+$"
                      },
                      "signature": {
                        "type": "string",
                        "minLength": 1
                      },
                      "nonce": {
                        "type": "integer",
                        "minimum": 0,
                        "maximum": 9007199254740991
                      }
                    },
                    "required": [
                      "amount_e18_raw",
                      "signature",
                      "nonce"
                    ],
                    "additionalProperties": false
                  },
                  "order": {
                    "type": "object",
                    "properties": {
                      "market_id": {
                        "type": "number",
                        "exclusiveMinimum": 0
                      },
                      "side": {
                        "type": "string",
                        "enum": [
                          "LONG",
                          "SHORT"
                        ]
                      },
                      "price": {
                        "type": "number",
                        "minimum": 0
                      },
                      "quantity": {
                        "type": "number",
                        "exclusiveMinimum": 0
                      },
                      "usd_amount": {
                        "type": "number",
                        "exclusiveMinimum": 0
                      },
                      "order_type": {
                        "type": "string",
                        "enum": [
                          "MARKET",
                          "LIMIT",
                          "STOP_LIMIT",
                          "STOP_MARKET",
                          "TAKE_PROFIT_LIMIT",
                          "TAKE_PROFIT_MARKET",
                          "STOP_LOSS_LIMIT",
                          "STOP_LOSS_MARKET"
                        ]
                      },
                      "leverage": {
                        "default": 1,
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "cancel_on_revert": {
                        "type": "boolean"
                      },
                      "salt": {
                        "type": "string"
                      },
                      "signature": {
                        "type": "string"
                      },
                      "expiration_seconds": {
                        "type": "integer",
                        "exclusiveMinimum": 0,
                        "maximum": 9007199254740991
                      },
                      "signature_type": {
                        "type": "number"
                      },
                      "trigger_price": {
                        "type": "number",
                        "minimum": 0
                      },
                      "reduce_only": {
                        "type": "boolean"
                      },
                      "symbol": {
                        "type": "string"
                      },
                      "userAddress": {
                        "type": "string"
                      },
                      "time_in_force": {
                        "type": "string",
                        "enum": [
                          "FOK",
                          "IOC",
                          "GTT"
                        ]
                      },
                      "post_only": {
                        "type": "boolean"
                      },
                      "client_id": {
                        "type": "string"
                      },
                      "parent_address": {
                        "type": "string"
                      }
                    },
                    "required": [
                      "market_id",
                      "side",
                      "order_type",
                      "salt",
                      "signature",
                      "expiration_seconds",
                      "signature_type"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "top_up",
                  "order"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "top_up": {
                      "type": "object",
                      "properties": {
                        "status": {
                          "type": "string",
                          "enum": [
                            "unknown",
                            "confirmed",
                            "failed",
                            "pending_timeout"
                          ]
                        },
                        "adjustment_id": {
                          "type": "string"
                        },
                        "tx_hash": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "amount_e18_raw": {
                          "type": "string"
                        },
                        "failure_reason": {
                          "type": "string"
                        },
                        "read_after": {
                          "type": "object",
                          "properties": {
                            "shard_id": {
                              "type": "string"
                            },
                            "shard_seq": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "shard_id",
                            "shard_seq"
                          ]
                        }
                      },
                      "required": [
                        "status",
                        "adjustment_id",
                        "tx_hash",
                        "amount_e18_raw"
                      ]
                    },
                    "order": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "order": {
                              "type": "object",
                              "properties": {
                                "order_id": {
                                  "type": "number"
                                },
                                "user_id": {
                                  "type": "number"
                                },
                                "account_kind": {
                                  "type": "string",
                                  "enum": [
                                    "user",
                                    "child_vault"
                                  ]
                                },
                                "account_id": {
                                  "type": "string"
                                },
                                "account_address": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string"
                                    }
                                  ]
                                },
                                "market_id": {
                                  "type": "number"
                                },
                                "side": {
                                  "type": "string",
                                  "enum": [
                                    "LONG",
                                    "SHORT"
                                  ]
                                },
                                "order_type": {
                                  "type": "string",
                                  "enum": [
                                    "MARKET",
                                    "LIMIT",
                                    "STOP_LIMIT",
                                    "STOP_MARKET",
                                    "TAKE_PROFIT_LIMIT",
                                    "TAKE_PROFIT_MARKET",
                                    "STOP_LOSS_LIMIT",
                                    "STOP_LOSS_MARKET"
                                  ]
                                },
                                "price": {
                                  "type": "number"
                                },
                                "price_e18_raw": {
                                  "type": "string"
                                },
                                "quantity": {
                                  "type": "number"
                                },
                                "quantity_e18_raw": {
                                  "type": "string"
                                },
                                "remaining_quantity": {
                                  "type": "number"
                                },
                                "remaining_quantity_e18_raw": {
                                  "type": "string"
                                },
                                "status": {
                                  "type": "string",
                                  "enum": [
                                    "CANCELLED",
                                    "EXPIRED",
                                    "FILLED",
                                    "OPEN",
                                    "PENDING_TRIGGER",
                                    "CANCEL_PENDING_FINALIZE"
                                  ]
                                },
                                "salt": {
                                  "type": "string"
                                },
                                "signature": {
                                  "type": "string"
                                },
                                "expiration_seconds": {
                                  "type": "number"
                                },
                                "signature_type": {
                                  "type": "number"
                                },
                                "order_hash": {
                                  "type": "string"
                                },
                                "cancel_on_revert": {
                                  "type": "boolean"
                                },
                                "leverage": {
                                  "type": "number"
                                },
                                "leverage_e18_raw": {
                                  "type": "string"
                                },
                                "reserved_margin": {
                                  "type": "number"
                                },
                                "reserved_margin_e18_raw": {
                                  "type": "string"
                                },
                                "trigger_price": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "number"
                                    }
                                  ]
                                },
                                "trigger_price_e18_raw": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string"
                                    }
                                  ]
                                },
                                "reduce_only": {
                                  "type": "boolean"
                                },
                                "original_order_type": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string",
                                      "const": "MARKET"
                                    },
                                    {
                                      "type": "string",
                                      "const": "LIMIT"
                                    },
                                    {
                                      "type": "string",
                                      "const": "STOP_LIMIT"
                                    },
                                    {
                                      "type": "string",
                                      "const": "STOP_MARKET"
                                    },
                                    {
                                      "type": "string",
                                      "const": "TAKE_PROFIT_LIMIT"
                                    },
                                    {
                                      "type": "string",
                                      "const": "TAKE_PROFIT_MARKET"
                                    },
                                    {
                                      "type": "string",
                                      "const": "STOP_LOSS_LIMIT"
                                    },
                                    {
                                      "type": "string",
                                      "const": "STOP_LOSS_MARKET"
                                    },
                                    {
                                      "type": "string",
                                      "const": "LIQUIDATION"
                                    }
                                  ]
                                },
                                "created_time": {
                                  "type": "string"
                                },
                                "updated_time": {
                                  "type": "string"
                                },
                                "cancelled_time": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string"
                                    }
                                  ]
                                },
                                "cancel_reason": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string"
                                    }
                                  ]
                                },
                                "cancel_pending_sealed_e18_raw": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string"
                                    }
                                  ]
                                },
                                "avg_fill_price": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "number"
                                    }
                                  ]
                                }
                              },
                              "required": [
                                "order_id",
                                "user_id",
                                "account_kind",
                                "account_id",
                                "market_id",
                                "side",
                                "order_type",
                                "price",
                                "price_e18_raw",
                                "quantity",
                                "quantity_e18_raw",
                                "remaining_quantity",
                                "remaining_quantity_e18_raw",
                                "status",
                                "salt",
                                "signature",
                                "expiration_seconds",
                                "signature_type",
                                "order_hash",
                                "cancel_on_revert",
                                "leverage",
                                "reserved_margin",
                                "reserved_margin_e18_raw",
                                "trigger_price",
                                "trigger_price_e18_raw",
                                "reduce_only",
                                "original_order_type",
                                "created_time",
                                "updated_time",
                                "cancelled_time",
                                "cancel_reason",
                                "avg_fill_price"
                              ]
                            },
                            "balance": {
                              "type": "object",
                              "properties": {
                                "eoa_address": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string"
                                    }
                                  ]
                                },
                                "reserved_margin_e18_raw": {
                                  "type": "string"
                                },
                                "total_margin_e18_raw": {
                                  "type": "string"
                                },
                                "available_margin_e18_raw": {
                                  "type": "string"
                                },
                                "pending_adjustment_margin_e18_raw": {
                                  "type": "string"
                                },
                                "pending_withdrawal_margin_e18_raw": {
                                  "type": "string"
                                },
                                "pending_direct_withdrawal_margin_e18_raw": {
                                  "type": "string"
                                },
                                "collateral_shortfall_e18_raw": {
                                  "type": "string"
                                },
                                "next_withdrawal_nonce": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string"
                                    }
                                  ]
                                },
                                "account_seq": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "eoa_address",
                                "reserved_margin_e18_raw",
                                "total_margin_e18_raw",
                                "available_margin_e18_raw",
                                "pending_adjustment_margin_e18_raw",
                                "pending_withdrawal_margin_e18_raw",
                                "pending_direct_withdrawal_margin_e18_raw",
                                "collateral_shortfall_e18_raw",
                                "next_withdrawal_nonce",
                                "account_seq"
                              ]
                            },
                            "fills": {
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "fill_id": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "number"
                                      }
                                    ]
                                  },
                                  "maker_order_id": {
                                    "type": "number"
                                  },
                                  "taker_order_id": {
                                    "type": "number"
                                  },
                                  "user_id": {
                                    "type": "number"
                                  },
                                  "market_id": {
                                    "type": "number"
                                  },
                                  "role": {
                                    "type": "string",
                                    "enum": [
                                      "LONG",
                                      "SHORT"
                                    ]
                                  },
                                  "quantity": {
                                    "type": "number"
                                  },
                                  "quantity_e18_raw": {
                                    "type": "string"
                                  },
                                  "price": {
                                    "type": "number"
                                  },
                                  "price_e18_raw": {
                                    "type": "string"
                                  },
                                  "notional": {
                                    "type": "number"
                                  },
                                  "notional_e18_raw": {
                                    "type": "string"
                                  },
                                  "fee": {
                                    "type": "number"
                                  },
                                  "fee_e18_raw": {
                                    "type": "string"
                                  },
                                  "reserved_margin": {
                                    "type": "number"
                                  },
                                  "reserved_margin_e18_raw": {
                                    "type": "string"
                                  },
                                  "created_time": {
                                    "type": "string"
                                  },
                                  "symbol": {
                                    "type": "string"
                                  },
                                  "name": {
                                    "type": "string"
                                  },
                                  "username": {
                                    "type": "string"
                                  },
                                  "leverage": {
                                    "type": "number"
                                  },
                                  "reduce_only": {
                                    "type": "boolean"
                                  },
                                  "order_id": {
                                    "type": "number"
                                  },
                                  "batch_id": {
                                    "anyOf": [
                                      {
                                        "type": "null"
                                      },
                                      {
                                        "type": "string"
                                      }
                                    ]
                                  },
                                  "fill_status": {
                                    "type": "string",
                                    "enum": [
                                      "SUBMITTED",
                                      "FAILED",
                                      "PENDING",
                                      "ONCHAIN",
                                      "SETTLED",
                                      "ORPHANED"
                                    ]
                                  },
                                  "batch_status": {
                                    "type": "string",
                                    "enum": [
                                      "FAILED",
                                      "PENDING",
                                      "ONCHAIN"
                                    ]
                                  },
                                  "tx_hash": {
                                    "type": "string"
                                  },
                                  "block_number": {
                                    "type": "number"
                                  }
                                },
                                "required": [
                                  "fill_id",
                                  "maker_order_id",
                                  "taker_order_id",
                                  "user_id",
                                  "market_id",
                                  "role",
                                  "quantity",
                                  "quantity_e18_raw",
                                  "price",
                                  "price_e18_raw",
                                  "notional",
                                  "notional_e18_raw",
                                  "fee",
                                  "fee_e18_raw",
                                  "reserved_margin",
                                  "reserved_margin_e18_raw",
                                  "created_time",
                                  "symbol",
                                  "leverage",
                                  "order_id"
                                ]
                              }
                            },
                            "message": {
                              "type": "string"
                            },
                            "read_after": {
                              "type": "object",
                              "properties": {
                                "shard_id": {
                                  "type": "string"
                                },
                                "shard_seq": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "shard_id",
                                "shard_seq"
                              ]
                            }
                          },
                          "required": [
                            "order",
                            "fills",
                            "message"
                          ]
                        }
                      ]
                    },
                    "accepted_order": {
                      "type": "object",
                      "properties": {
                        "order_hash": {
                          "type": "string"
                        },
                        "order_id": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "terminal_status": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string",
                              "const": "CANCELLED"
                            },
                            {
                              "type": "string",
                              "const": "EXPIRED"
                            },
                            {
                              "type": "string",
                              "const": "FILLED"
                            }
                          ]
                        }
                      },
                      "required": [
                        "order_hash",
                        "order_id",
                        "terminal_status"
                      ]
                    },
                    "order_error": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "code": {
                              "type": "number"
                            },
                            "message": {
                              "type": "string"
                            },
                            "fresh_required_top_up_e18_raw": {
                              "anyOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "string"
                                }
                              ]
                            },
                            "fresh_top_up_status": {
                              "type": "string",
                              "enum": [
                                "required",
                                "not_needed",
                                "uncurable"
                              ]
                            }
                          },
                          "required": [
                            "code",
                            "message"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "top_up",
                    "order",
                    "order_error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/pages": {
      "get": {
        "operationId": "pages",
        "summary": "pages",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "page_id": {
                        "type": "number"
                      },
                      "slug": {
                        "type": "string"
                      },
                      "title": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      },
                      "categories": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      }
                    },
                    "required": [
                      "page_id",
                      "slug",
                      "title"
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "/v0/pages/{slug}": {
      "get": {
        "operationId": "pages_slug",
        "summary": "pages/:slug",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "market_id": {
                      "type": "number"
                    },
                    "market_config_seq": {
                      "type": "number"
                    },
                    "page_id": {
                      "type": "number"
                    },
                    "slug": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "contract_address": {
                      "type": "string"
                    },
                    "trader_address": {
                      "type": "string"
                    },
                    "evaluator_address": {
                      "type": "string"
                    },
                    "contract_name": {
                      "type": "string"
                    },
                    "oracle_address": {
                      "type": "string"
                    },
                    "funding_oracle_address": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "funding_session": {
                      "type": "string",
                      "enum": [
                        "always",
                        "us_equity"
                      ]
                    },
                    "type": {
                      "type": "string",
                      "enum": [
                        "perpetual",
                        "future",
                        "binary_future"
                      ]
                    },
                    "price_display": {
                      "type": "string",
                      "enum": [
                        "usd",
                        "billion_usd",
                        "decimal",
                        "percentage"
                      ]
                    },
                    "short_name": {
                      "type": "string"
                    },
                    "long_name": {
                      "type": "string"
                    },
                    "symbol": {
                      "type": "string"
                    },
                    "adl_address": {
                      "type": "string"
                    },
                    "initial_margin_ratio": {
                      "type": "number"
                    },
                    "initial_margin_ratio_e18_raw": {
                      "type": "string"
                    },
                    "maintenance_margin_ratio": {
                      "type": "number"
                    },
                    "maintenance_margin_ratio_e18_raw": {
                      "type": "string"
                    },
                    "tick_size": {
                      "type": "number"
                    },
                    "tick_size_e18_raw": {
                      "type": "string"
                    },
                    "min_order_price": {
                      "type": "number"
                    },
                    "min_order_price_e18_raw": {
                      "type": "string"
                    },
                    "max_order_price": {
                      "type": "number"
                    },
                    "max_order_price_e18_raw": {
                      "type": "string"
                    },
                    "min_order_size": {
                      "type": "number"
                    },
                    "min_order_size_e18_raw": {
                      "type": "string"
                    },
                    "max_order_size_limit": {
                      "type": "number"
                    },
                    "max_order_size_limit_e18_raw": {
                      "type": "string"
                    },
                    "max_order_size_market": {
                      "type": "number"
                    },
                    "max_order_size_market_e18_raw": {
                      "type": "string"
                    },
                    "mtb_long": {
                      "type": "number"
                    },
                    "mtb_short": {
                      "type": "number"
                    },
                    "mtb_long_e18_raw": {
                      "type": "string"
                    },
                    "mtb_short_e18_raw": {
                      "type": "string"
                    },
                    "max_allowed_open_notional_by_leverage_e18_raw": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      }
                    },
                    "max_market_open_notional_e18_raw": {
                      "type": "string"
                    },
                    "step_size": {
                      "type": "number"
                    },
                    "step_size_e18_raw": {
                      "type": "string"
                    },
                    "maker_fee": {
                      "type": "number"
                    },
                    "maker_fee_e18_raw": {
                      "type": "string"
                    },
                    "taker_fee": {
                      "type": "number"
                    },
                    "taker_fee_e18_raw": {
                      "type": "string"
                    },
                    "trading_enabled": {
                      "type": "boolean"
                    },
                    "trading_start_time": {
                      "type": "string"
                    },
                    "initial_price_e18_raw": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "deployment_block": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    },
                    "mark_price": {
                      "type": "number"
                    },
                    "mark_price_e18_raw": {
                      "type": "string"
                    },
                    "oracle_price": {
                      "type": "number"
                    },
                    "oracle_price_e18_raw": {
                      "type": "string"
                    },
                    "mark_price_timestamp": {
                      "type": "string"
                    },
                    "max_trade_batch_oracle_age_ms": {
                      "type": "number"
                    },
                    "max_liquidation_price_age_ms": {
                      "type": "number"
                    },
                    "funding_rate": {
                      "type": "number"
                    },
                    "created_time": {
                      "type": "string"
                    },
                    "updated_time": {
                      "type": "string"
                    },
                    "quote_asset_symbol": {
                      "type": "string"
                    },
                    "quote_asset_name": {
                      "type": "string"
                    },
                    "base_asset_symbol": {
                      "type": "string"
                    },
                    "base_asset_name": {
                      "type": "string"
                    },
                    "thumbnail_url": {
                      "type": "string"
                    },
                    "title": {
                      "type": "string"
                    },
                    "categories": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "delisting": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "market_id": {
                              "type": "number"
                            },
                            "settlement_price_e18_raw": {
                              "type": "string"
                            },
                            "settlement_price": {
                              "type": "number"
                            },
                            "delisted_at_timestamp": {
                              "type": "string"
                            },
                            "close_delay_seconds": {
                              "anyOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "number"
                                }
                              ]
                            },
                            "close_eligible_at_timestamp": {
                              "anyOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "string"
                                }
                              ]
                            },
                            "delist_tx_hash": {
                              "anyOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "string"
                                }
                              ]
                            },
                            "delist_block_number": {
                              "anyOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "number"
                                }
                              ]
                            },
                            "mid_price_e18_raw": {
                              "anyOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "string"
                                }
                              ]
                            },
                            "price_lower_bound_e18_raw": {
                              "anyOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "string"
                                }
                              ]
                            },
                            "price_upper_bound_e18_raw": {
                              "anyOf": [
                                {
                                  "type": "null"
                                },
                                {
                                  "type": "string"
                                }
                              ]
                            },
                            "created_time": {
                              "type": "string"
                            },
                            "updated_time": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "market_id",
                            "settlement_price_e18_raw",
                            "settlement_price",
                            "delisted_at_timestamp",
                            "created_time",
                            "updated_time"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "market_id",
                    "market_config_seq",
                    "page_id",
                    "slug",
                    "contract_address",
                    "trader_address",
                    "evaluator_address",
                    "contract_name",
                    "oracle_address",
                    "funding_oracle_address",
                    "type",
                    "price_display",
                    "short_name",
                    "long_name",
                    "symbol",
                    "initial_margin_ratio",
                    "initial_margin_ratio_e18_raw",
                    "maintenance_margin_ratio",
                    "maintenance_margin_ratio_e18_raw",
                    "tick_size",
                    "tick_size_e18_raw",
                    "min_order_price",
                    "min_order_price_e18_raw",
                    "max_order_price",
                    "max_order_price_e18_raw",
                    "min_order_size",
                    "min_order_size_e18_raw",
                    "max_order_size_limit",
                    "max_order_size_limit_e18_raw",
                    "max_order_size_market",
                    "max_order_size_market_e18_raw",
                    "mtb_long",
                    "mtb_short",
                    "mtb_long_e18_raw",
                    "mtb_short_e18_raw",
                    "max_allowed_open_notional_by_leverage_e18_raw",
                    "max_market_open_notional_e18_raw",
                    "step_size",
                    "step_size_e18_raw",
                    "maker_fee",
                    "maker_fee_e18_raw",
                    "taker_fee",
                    "taker_fee_e18_raw",
                    "trading_enabled",
                    "created_time",
                    "updated_time",
                    "quote_asset_symbol",
                    "quote_asset_name",
                    "base_asset_symbol",
                    "base_asset_name",
                    "title",
                    "delisting"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/portfolio/{user_id}/pnl-history": {
      "get": {
        "operationId": "portfolio_user_id_pnl_history",
        "summary": "portfolio/:user_id/pnl-history",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "1D",
                "1W",
                "1M",
                "ALL"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user_id": {
                      "type": "number"
                    },
                    "snapshots": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "snapshot_time": {
                            "type": "string"
                          },
                          "total_pnl": {
                            "type": "number"
                          },
                          "portfolio_value": {
                            "type": "number"
                          },
                          "total_margin": {
                            "type": "number"
                          },
                          "account_value": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "snapshot_time",
                          "total_pnl",
                          "portfolio_value",
                          "total_margin",
                          "account_value"
                        ]
                      }
                    }
                  },
                  "required": [
                    "user_id",
                    "snapshots"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/portfolio/{user_id}/realized-pnl": {
      "get": {
        "operationId": "portfolio_user_id_realized_pnl",
        "summary": "portfolio/:user_id/realized-pnl",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user_id": {
                      "type": "number"
                    },
                    "realized_pnl": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "user_id",
                    "realized_pnl"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/positions/by-market/{market_id}": {
      "get": {
        "operationId": "positions_by_market_market_id",
        "summary": "positions/by-market/:market_id",
        "parameters": [
          {
            "name": "market_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "market_id": {
                      "type": "number"
                    },
                    "positions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "user_id": {
                            "type": "number"
                          },
                          "market_id": {
                            "type": "number"
                          },
                          "size": {
                            "type": "number"
                          },
                          "size_e18_raw": {
                            "type": "string"
                          },
                          "used_margin": {
                            "type": "number"
                          },
                          "used_margin_e18_raw": {
                            "type": "string"
                          },
                          "realized_pnl": {
                            "type": "number"
                          },
                          "realized_pnl_e18_raw": {
                            "type": "string"
                          },
                          "last_applied_funding_index": {
                            "type": "number"
                          },
                          "last_applied_funding_index_e18_raw": {
                            "type": "string"
                          },
                          "updated_time": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "oi_open": {
                            "type": "number"
                          },
                          "oi_open_e18_raw": {
                            "type": "string"
                          },
                          "leverage_e18_raw": {
                            "type": "string"
                          },
                          "margin_ratio_open": {
                            "type": "number"
                          },
                          "margin_ratio_open_e18_raw": {
                            "type": "string"
                          },
                          "last_event_id": {
                            "type": "number"
                          },
                          "last_block_number": {
                            "type": "number"
                          },
                          "last_tx_index": {
                            "type": "number"
                          },
                          "last_log_index": {
                            "type": "number"
                          },
                          "side": {
                            "type": "string",
                            "enum": [
                              "long",
                              "short"
                            ]
                          },
                          "leverage": {
                            "type": "number"
                          },
                          "market_symbol": {
                            "type": "string"
                          },
                          "market_type": {
                            "type": "string",
                            "enum": [
                              "perpetual",
                              "future",
                              "binary_future"
                            ]
                          },
                          "tick_size": {
                            "type": "number"
                          },
                          "maintenance_margin_ratio": {
                            "type": "number"
                          },
                          "entry_price": {
                            "type": "number"
                          },
                          "mark_price": {
                            "type": "number"
                          },
                          "mark_price_e18_raw": {
                            "type": "string"
                          },
                          "mark_price_updated_at_ms": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "mark_price_event_id": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "position_value": {
                            "type": "number"
                          },
                          "unrealized_pnl": {
                            "type": "number"
                          },
                          "unrealized_pnl_percent": {
                            "type": "number"
                          },
                          "liquidation_price": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "funding_payment": {
                            "type": "number"
                          },
                          "equity": {
                            "type": "number"
                          },
                          "global_funding_index_e18_raw": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "global_funding_index_updated_at_ms": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "global_funding_index_event_id": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          }
                        },
                        "required": [
                          "user_id",
                          "market_id",
                          "size",
                          "size_e18_raw",
                          "used_margin",
                          "used_margin_e18_raw",
                          "realized_pnl",
                          "realized_pnl_e18_raw",
                          "last_applied_funding_index",
                          "last_applied_funding_index_e18_raw",
                          "updated_time",
                          "oi_open",
                          "oi_open_e18_raw",
                          "leverage_e18_raw",
                          "margin_ratio_open",
                          "margin_ratio_open_e18_raw",
                          "last_event_id",
                          "last_block_number",
                          "last_tx_index",
                          "last_log_index",
                          "side",
                          "leverage",
                          "market_symbol",
                          "market_type",
                          "tick_size",
                          "maintenance_margin_ratio",
                          "entry_price",
                          "mark_price",
                          "mark_price_e18_raw",
                          "position_value",
                          "unrealized_pnl",
                          "unrealized_pnl_percent",
                          "liquidation_price",
                          "funding_payment",
                          "equity",
                          "global_funding_index_e18_raw"
                        ]
                      }
                    }
                  },
                  "required": [
                    "market_id",
                    "positions"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/positions/by-user/{user_id}": {
      "get": {
        "operationId": "positions_by_user_user_id",
        "summary": "positions/by-user/:user_id",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "market_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user_id": {
                      "type": "number"
                    },
                    "positions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "user_id": {
                            "type": "number"
                          },
                          "market_id": {
                            "type": "number"
                          },
                          "size": {
                            "type": "number"
                          },
                          "size_e18_raw": {
                            "type": "string"
                          },
                          "used_margin": {
                            "type": "number"
                          },
                          "used_margin_e18_raw": {
                            "type": "string"
                          },
                          "realized_pnl": {
                            "type": "number"
                          },
                          "realized_pnl_e18_raw": {
                            "type": "string"
                          },
                          "last_applied_funding_index": {
                            "type": "number"
                          },
                          "last_applied_funding_index_e18_raw": {
                            "type": "string"
                          },
                          "updated_time": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "oi_open": {
                            "type": "number"
                          },
                          "oi_open_e18_raw": {
                            "type": "string"
                          },
                          "leverage_e18_raw": {
                            "type": "string"
                          },
                          "margin_ratio_open": {
                            "type": "number"
                          },
                          "margin_ratio_open_e18_raw": {
                            "type": "string"
                          },
                          "last_event_id": {
                            "type": "number"
                          },
                          "last_block_number": {
                            "type": "number"
                          },
                          "last_tx_index": {
                            "type": "number"
                          },
                          "last_log_index": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "user_id",
                          "market_id",
                          "size",
                          "size_e18_raw",
                          "used_margin",
                          "used_margin_e18_raw",
                          "realized_pnl",
                          "realized_pnl_e18_raw",
                          "last_applied_funding_index",
                          "last_applied_funding_index_e18_raw",
                          "updated_time",
                          "oi_open",
                          "oi_open_e18_raw",
                          "leverage_e18_raw",
                          "margin_ratio_open",
                          "margin_ratio_open_e18_raw",
                          "last_event_id",
                          "last_block_number",
                          "last_tx_index",
                          "last_log_index"
                        ]
                      }
                    }
                  },
                  "required": [
                    "user_id",
                    "positions"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/positions/by-user/{user_id}/enriched": {
      "get": {
        "operationId": "positions_by_user_user_id_enriched",
        "summary": "positions/by-user/:user_id/enriched",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "market_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "read_after_shard_id",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "read_after_shard_seq",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "timeout_ms",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user_id": {
                      "type": "number"
                    },
                    "positions": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "user_id": {
                            "type": "number"
                          },
                          "market_id": {
                            "type": "number"
                          },
                          "size": {
                            "type": "number"
                          },
                          "size_e18_raw": {
                            "type": "string"
                          },
                          "used_margin": {
                            "type": "number"
                          },
                          "used_margin_e18_raw": {
                            "type": "string"
                          },
                          "realized_pnl": {
                            "type": "number"
                          },
                          "realized_pnl_e18_raw": {
                            "type": "string"
                          },
                          "last_applied_funding_index": {
                            "type": "number"
                          },
                          "last_applied_funding_index_e18_raw": {
                            "type": "string"
                          },
                          "updated_time": {
                            "type": "string",
                            "format": "date-time"
                          },
                          "oi_open": {
                            "type": "number"
                          },
                          "oi_open_e18_raw": {
                            "type": "string"
                          },
                          "leverage_e18_raw": {
                            "type": "string"
                          },
                          "margin_ratio_open": {
                            "type": "number"
                          },
                          "margin_ratio_open_e18_raw": {
                            "type": "string"
                          },
                          "last_event_id": {
                            "type": "number"
                          },
                          "last_block_number": {
                            "type": "number"
                          },
                          "last_tx_index": {
                            "type": "number"
                          },
                          "last_log_index": {
                            "type": "number"
                          },
                          "side": {
                            "type": "string",
                            "enum": [
                              "long",
                              "short"
                            ]
                          },
                          "leverage": {
                            "type": "number"
                          },
                          "market_symbol": {
                            "type": "string"
                          },
                          "market_type": {
                            "type": "string",
                            "enum": [
                              "perpetual",
                              "future",
                              "binary_future"
                            ]
                          },
                          "tick_size": {
                            "type": "number"
                          },
                          "maintenance_margin_ratio": {
                            "type": "number"
                          },
                          "entry_price": {
                            "type": "number"
                          },
                          "mark_price": {
                            "type": "number"
                          },
                          "mark_price_e18_raw": {
                            "type": "string"
                          },
                          "mark_price_updated_at_ms": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "mark_price_event_id": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "position_value": {
                            "type": "number"
                          },
                          "unrealized_pnl": {
                            "type": "number"
                          },
                          "unrealized_pnl_percent": {
                            "type": "number"
                          },
                          "liquidation_price": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "funding_payment": {
                            "type": "number"
                          },
                          "equity": {
                            "type": "number"
                          },
                          "global_funding_index_e18_raw": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "global_funding_index_updated_at_ms": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "global_funding_index_event_id": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          }
                        },
                        "required": [
                          "user_id",
                          "market_id",
                          "size",
                          "size_e18_raw",
                          "used_margin",
                          "used_margin_e18_raw",
                          "realized_pnl",
                          "realized_pnl_e18_raw",
                          "last_applied_funding_index",
                          "last_applied_funding_index_e18_raw",
                          "updated_time",
                          "oi_open",
                          "oi_open_e18_raw",
                          "leverage_e18_raw",
                          "margin_ratio_open",
                          "margin_ratio_open_e18_raw",
                          "last_event_id",
                          "last_block_number",
                          "last_tx_index",
                          "last_log_index",
                          "side",
                          "leverage",
                          "market_symbol",
                          "market_type",
                          "tick_size",
                          "maintenance_margin_ratio",
                          "entry_price",
                          "mark_price",
                          "mark_price_e18_raw",
                          "position_value",
                          "unrealized_pnl",
                          "unrealized_pnl_percent",
                          "liquidation_price",
                          "funding_payment",
                          "equity",
                          "global_funding_index_e18_raw"
                        ]
                      }
                    }
                  },
                  "required": [
                    "user_id",
                    "positions"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/positions/onchain/{market_id}": {
      "get": {
        "operationId": "positions_onchain_market_id",
        "summary": "positions/onchain/:market_id",
        "parameters": [
          {
            "name": "market_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user_id": {
                      "type": "number"
                    },
                    "eoa_address": {
                      "type": "string"
                    },
                    "market_id": {
                      "type": "number"
                    },
                    "position": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "isPosPositive": {
                              "type": "boolean"
                            },
                            "mro": {
                              "type": "string"
                            },
                            "qPos": {
                              "type": "string"
                            },
                            "margin": {
                              "type": "string"
                            },
                            "oiOpen": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "isPosPositive",
                            "mro",
                            "qPos",
                            "margin",
                            "oiOpen"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "user_id",
                    "eoa_address",
                    "market_id",
                    "position"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/relayer/status": {
      "get": {
        "operationId": "relayer_status",
        "summary": "relayer/status",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "relayers": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "relayerId": {
                            "type": "number"
                          },
                          "relayerAddress": {
                            "type": "string"
                          },
                          "label": {
                            "type": "string"
                          },
                          "queueDepth": {
                            "type": "number"
                          },
                          "lastNonce": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "isProcessing": {
                            "type": "boolean"
                          },
                          "totalSubmitted": {
                            "type": "number"
                          },
                          "totalFailed": {
                            "type": "number"
                          },
                          "isPaused": {
                            "type": "boolean"
                          },
                          "pauseReason": {
                            "type": "string"
                          },
                          "pausedAt": {
                            "type": "string",
                            "format": "date-time"
                          }
                        },
                        "required": [
                          "relayerId",
                          "relayerAddress",
                          "queueDepth",
                          "lastNonce",
                          "isProcessing",
                          "totalSubmitted",
                          "totalFailed",
                          "isPaused"
                        ]
                      }
                    },
                    "currentGasPrice": {
                      "type": "string"
                    },
                    "maxGasPrice": {
                      "type": "string"
                    },
                    "feePercentage": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "relayers",
                    "currentGasPrice",
                    "maxGasPrice",
                    "feePercentage"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/rpc/status": {
      "get": {
        "operationId": "rpc_status",
        "summary": "rpc/status",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment": {
                      "type": "string"
                    },
                    "connected": {
                      "type": "boolean"
                    },
                    "chainId": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    },
                    "blockNumber": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "number"
                        }
                      ]
                    },
                    "rpcUrl": {
                      "type": "string"
                    },
                    "responseTimeMs": {
                      "type": "number"
                    },
                    "error": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    }
                  },
                  "required": [
                    "environment",
                    "connected",
                    "chainId",
                    "blockNumber",
                    "rpcUrl",
                    "responseTimeMs",
                    "error"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/session-keys": {
      "get": {
        "operationId": "session_keys",
        "summary": "session-keys",
        "parameters": [
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "REVOKED",
                "EXPIRED"
              ]
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "session_keys": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "session_key_id": {
                            "type": "number"
                          },
                          "user_id": {
                            "type": "number"
                          },
                          "session_public_address": {
                            "type": "string"
                          },
                          "authorization_signature": {
                            "type": "string"
                          },
                          "authorization_message": {
                            "type": "string"
                          },
                          "expiration_time": {
                            "type": "string"
                          },
                          "permissions": {
                            "type": "object",
                            "properties": {
                              "can_place_orders": {
                                "type": "boolean"
                              },
                              "can_cancel_orders": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "can_place_orders",
                              "can_cancel_orders"
                            ]
                          },
                          "status": {
                            "type": "string"
                          },
                          "created_time": {
                            "type": "string"
                          },
                          "revoked_time": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          }
                        },
                        "required": [
                          "session_key_id",
                          "user_id",
                          "session_public_address",
                          "authorization_signature",
                          "authorization_message",
                          "expiration_time",
                          "permissions",
                          "status",
                          "created_time",
                          "revoked_time"
                        ]
                      }
                    }
                  },
                  "required": [
                    "session_keys"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/session-keys/forwarder-migration-status": {
      "get": {
        "operationId": "session_keys_forwarder_migration_status",
        "summary": "session-keys/forwarder-migration-status",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "environment": {
                      "type": "string"
                    },
                    "paused": {
                      "type": "boolean"
                    },
                    "nonterminal_relay_count": {
                      "type": "number"
                    },
                    "prepared_relay_count": {
                      "type": "number"
                    },
                    "submitted_relay_count": {
                      "type": "number"
                    }
                  },
                  "required": [
                    "environment",
                    "paused",
                    "nonterminal_relay_count",
                    "prepared_relay_count",
                    "submitted_relay_count"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/session-keys/prepare": {
      "post": {
        "operationId": "session_keys_prepare",
        "summary": "session-keys/prepare",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "session_public_address": {
                    "type": "string"
                  },
                  "approved": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "session_public_address",
                  "approved"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "from": {
                      "type": "string"
                    },
                    "to": {
                      "type": "string"
                    },
                    "gas": {
                      "type": "number"
                    },
                    "nonce": {
                      "type": "number"
                    },
                    "deadline": {
                      "type": "number"
                    },
                    "data": {
                      "type": "string"
                    },
                    "chain_id": {
                      "type": "number"
                    },
                    "account_manager_address": {
                      "type": "string"
                    },
                    "minimal_forwarder_address": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "from",
                    "to",
                    "gas",
                    "nonce",
                    "deadline",
                    "data",
                    "chain_id",
                    "account_manager_address",
                    "minimal_forwarder_address"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/session-keys/relay": {
      "post": {
        "operationId": "session_keys_relay",
        "summary": "session-keys/relay",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "string"
                  },
                  "to": {
                    "type": "string"
                  },
                  "gas": {
                    "type": "integer",
                    "exclusiveMinimum": 0,
                    "maximum": 200000
                  },
                  "nonce": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "deadline": {
                    "type": "integer",
                    "minimum": 0,
                    "maximum": 9007199254740991
                  },
                  "data": {
                    "type": "string"
                  },
                  "signature": {
                    "type": "string"
                  },
                  "session_public_address": {
                    "type": "string"
                  },
                  "approved": {
                    "type": "boolean"
                  },
                  "expiration_seconds": {
                    "type": "number",
                    "exclusiveMinimum": 0
                  },
                  "permissions": {
                    "type": "object",
                    "properties": {
                      "can_place_orders": {
                        "type": "boolean"
                      },
                      "can_cancel_orders": {
                        "type": "boolean"
                      }
                    },
                    "required": [
                      "can_place_orders",
                      "can_cancel_orders"
                    ]
                  },
                  "session_key_id": {
                    "type": "number"
                  }
                },
                "required": [
                  "from",
                  "to",
                  "gas",
                  "nonce",
                  "deadline",
                  "data",
                  "signature",
                  "session_public_address",
                  "approved"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "status": {
                      "type": "string",
                      "enum": [
                        "PREPARED",
                        "SUBMITTED",
                        "OBSERVED",
                        "REVERTED",
                        "GHOST_CANCELLED",
                        "FAILED"
                      ]
                    },
                    "operation_id": {
                      "type": "string"
                    },
                    "tx_hash": {
                      "type": "string"
                    },
                    "gas_used": {
                      "type": "string"
                    },
                    "relayer": {
                      "type": "string"
                    },
                    "block_number": {
                      "type": "number"
                    },
                    "session_key_id": {
                      "type": "number"
                    },
                    "session_public_address": {
                      "type": "string"
                    },
                    "expiration_time": {
                      "type": "string"
                    },
                    "reason": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "success",
                    "status",
                    "message"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/users/{user_id}/order-events": {
      "get": {
        "operationId": "users_user_id_order_events",
        "summary": "users/:user_id/order-events",
        "parameters": [
          {
            "name": "user_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "event_type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "CREATED",
                "CANCELLED",
                "EXPIRED",
                "FILLED",
                "PARTIALLY_FILLED"
              ]
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          }
        ],
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user_id": {
                      "type": "number"
                    },
                    "events": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "number"
                          },
                          "order_id": {
                            "type": "number"
                          },
                          "order_hash": {
                            "type": "string"
                          },
                          "user_id": {
                            "type": "number"
                          },
                          "market_id": {
                            "type": "number"
                          },
                          "event_type": {
                            "type": "string",
                            "enum": [
                              "CREATED",
                              "CANCELLED",
                              "EXPIRED",
                              "FILLED",
                              "PARTIALLY_FILLED",
                              "LIQUIDATED",
                              "REVERT_FILL"
                            ]
                          },
                          "triggered_by": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "number"
                              }
                            ]
                          },
                          "reason": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "order_details": {},
                          "created_time": {
                            "type": "string"
                          },
                          "side": {
                            "type": "string",
                            "enum": [
                              "LONG",
                              "SHORT"
                            ]
                          },
                          "price": {
                            "type": "number"
                          },
                          "quantity": {
                            "type": "number"
                          },
                          "eoa_address": {
                            "type": "string"
                          },
                          "name": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "username": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          }
                        },
                        "required": [
                          "id",
                          "order_id",
                          "order_hash",
                          "user_id",
                          "market_id",
                          "event_type",
                          "triggered_by",
                          "reason",
                          "order_details",
                          "created_time"
                        ]
                      }
                    },
                    "pagination": {
                      "type": "object",
                      "properties": {
                        "limit": {
                          "type": "number"
                        },
                        "offset": {
                          "type": "number"
                        },
                        "count": {
                          "type": "number"
                        }
                      },
                      "required": [
                        "limit",
                        "offset",
                        "count"
                      ]
                    }
                  },
                  "required": [
                    "user_id",
                    "events",
                    "pagination"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/users/accept-terms": {
      "post": {
        "operationId": "users_accept_terms",
        "summary": "users/accept-terms",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "success": {
                      "type": "boolean"
                    },
                    "user_id": {
                      "type": "number"
                    },
                    "accepted_terms_time": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "success",
                    "user_id",
                    "accepted_terms_time"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/users/by-eoa/{eoa_address}": {
      "get": {
        "operationId": "users_by_eoa_eoa_address",
        "summary": "users/by-eoa/:eoa_address",
        "parameters": [
          {
            "name": "eoa_address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user_id": {
                      "type": "number"
                    },
                    "eoa_address": {
                      "type": "string"
                    },
                    "name": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "username": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "string"
                        }
                      ]
                    },
                    "created_time": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "user_id",
                    "eoa_address",
                    "name",
                    "username",
                    "created_time"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/users/create": {
      "post": {
        "operationId": "users_create",
        "summary": "users/create",
        "requestBody": {
          "required": false,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "invite_code": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 128
                  },
                  "accepted_risk_disclaimer": {
                    "type": "boolean"
                  }
                },
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "user": {
                      "type": "object",
                      "properties": {
                        "user_id": {
                          "type": "number"
                        },
                        "eoa_address": {
                          "type": "string"
                        },
                        "privy_did": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "name": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "username": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "accepted_terms_time": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "accepted_risk_disclaimer_time": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "string"
                            }
                          ]
                        },
                        "created_time": {
                          "type": "string"
                        }
                      },
                      "required": [
                        "user_id",
                        "eoa_address",
                        "name",
                        "username",
                        "created_time"
                      ]
                    },
                    "is_new_user": {
                      "type": "boolean"
                    }
                  },
                  "required": [
                    "user",
                    "is_new_user"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/vault/account": {
      "get": {
        "operationId": "vault_account",
        "summary": "vault/account",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "account": {
                      "anyOf": [
                        {
                          "type": "null"
                        },
                        {
                          "type": "object",
                          "properties": {
                            "lp_address": {
                              "type": "string"
                            },
                            "shares_e18_raw": {
                              "type": "string"
                            },
                            "estimated_value_e18_raw": {
                              "type": "string"
                            },
                            "pending_withdrawal_shares_e18_raw": {
                              "type": "string"
                            },
                            "pending_withdrawal_unlock_at_ms": {
                              "type": "number"
                            },
                            "deposit_policy": {
                              "type": "object",
                              "properties": {
                                "whitelist_enabled": {
                                  "type": "boolean"
                                },
                                "whitelisted": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "boolean",
                                      "const": false
                                    },
                                    {
                                      "type": "boolean",
                                      "const": true
                                    }
                                  ]
                                },
                                "per_depositor_cap_e18_raw": {
                                  "type": "string"
                                },
                                "total_cap_e18_raw": {
                                  "type": "string"
                                },
                                "net_deposits_e18_raw": {
                                  "type": "string"
                                },
                                "total_net_deposits_e18_raw": {
                                  "type": "string"
                                },
                                "remaining_depositor_cap_e18_raw": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string"
                                    }
                                  ]
                                },
                                "remaining_total_cap_e18_raw": {
                                  "anyOf": [
                                    {
                                      "type": "null"
                                    },
                                    {
                                      "type": "string"
                                    }
                                  ]
                                },
                                "can_deposit": {
                                  "type": "boolean"
                                }
                              },
                              "required": [
                                "whitelist_enabled",
                                "whitelisted",
                                "per_depositor_cap_e18_raw",
                                "total_cap_e18_raw",
                                "net_deposits_e18_raw",
                                "total_net_deposits_e18_raw",
                                "remaining_depositor_cap_e18_raw",
                                "remaining_total_cap_e18_raw",
                                "can_deposit"
                              ]
                            },
                            "updated_time": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "lp_address",
                            "shares_e18_raw",
                            "estimated_value_e18_raw",
                            "pending_withdrawal_shares_e18_raw",
                            "pending_withdrawal_unlock_at_ms",
                            "deposit_policy",
                            "updated_time"
                          ]
                        }
                      ]
                    }
                  },
                  "required": [
                    "account"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/vault/activity": {
      "get": {
        "operationId": "vault_activity",
        "summary": "vault/activity",
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number",
              "minimum": 1,
              "maximum": 100
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "activity": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "kind": {
                            "type": "string",
                            "enum": [
                              "deposit",
                              "withdraw_request",
                              "withdraw",
                              "backstop_inherit"
                            ]
                          },
                          "id": {
                            "type": "string"
                          },
                          "account": {
                            "type": "string"
                          },
                          "amount_token_raw": {
                            "anyOf": [
                              {
                                "type": "null"
                              },
                              {
                                "type": "string"
                              }
                            ]
                          },
                          "shares_e18_raw": {
                            "type": "string"
                          },
                          "tx_hash": {
                            "type": "string"
                          },
                          "log_index": {
                            "type": "number"
                          },
                          "block_number": {
                            "type": "number"
                          },
                          "observed_at_ms": {
                            "type": "number"
                          }
                        },
                        "required": [
                          "kind",
                          "id",
                          "account",
                          "amount_token_raw",
                          "shares_e18_raw",
                          "tx_hash",
                          "log_index",
                          "block_number",
                          "observed_at_ms"
                        ]
                      }
                    }
                  },
                  "required": [
                    "activity"
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/v0/vault/status": {
      "get": {
        "operationId": "vault_status",
        "summary": "vault/status",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "object",
                      "properties": {
                        "state": {
                          "anyOf": [
                            {
                              "type": "null"
                            },
                            {
                              "type": "object",
                              "properties": {
                                "vault_id": {
                                  "type": "string"
                                },
                                "main_vault_address": {
                                  "type": "string"
                                },
                                "total_nav_e18_raw": {
                                  "type": "string"
                                },
                                "total_shares_e18_raw": {
                                  "type": "string"
                                },
                                "share_price_e18_raw": {
                                  "type": "string"
                                },
                                "main_free_collateral_e18_raw": {
                                  "type": "string"
                                },
                                "withdraw_lock_ms": {
                                  "type": "number"
                                },
                                "active_child_market_tracking_initialized": {
                                  "type": "boolean"
                                },
                                "active_child_market_count": {
                                  "type": "number"
                                },
                                "incident_switches": {
                                  "type": "object",
                                  "properties": {
                                    "child_vault_inheritance_halted": {
                                      "type": "boolean"
                                    },
                                    "risk_paused": {
                                      "type": "boolean"
                                    },
                                    "withdrawals_paused": {
                                      "type": "boolean"
                                    },
                                    "wind_down_mode": {
                                      "type": "boolean"
                                    }
                                  },
                                  "required": [
                                    "child_vault_inheritance_halted",
                                    "risk_paused",
                                    "withdrawals_paused",
                                    "wind_down_mode"
                                  ]
                                },
                                "deposit_policy": {
                                  "type": "object",
                                  "properties": {
                                    "whitelist_enabled": {
                                      "type": "boolean"
                                    },
                                    "per_depositor_cap_e18_raw": {
                                      "type": "string"
                                    },
                                    "total_cap_e18_raw": {
                                      "type": "string"
                                    },
                                    "total_net_deposits_e18_raw": {
                                      "type": "string"
                                    },
                                    "total_remaining_cap_e18_raw": {
                                      "anyOf": [
                                        {
                                          "type": "null"
                                        },
                                        {
                                          "type": "string"
                                        }
                                      ]
                                    }
                                  },
                                  "required": [
                                    "whitelist_enabled",
                                    "per_depositor_cap_e18_raw",
                                    "total_cap_e18_raw",
                                    "total_net_deposits_e18_raw",
                                    "total_remaining_cap_e18_raw"
                                  ]
                                },
                                "updated_time": {
                                  "type": "string"
                                }
                              },
                              "required": [
                                "vault_id",
                                "main_vault_address",
                                "total_nav_e18_raw",
                                "total_shares_e18_raw",
                                "share_price_e18_raw",
                                "main_free_collateral_e18_raw",
                                "withdraw_lock_ms",
                                "active_child_market_tracking_initialized",
                                "active_child_market_count",
                                "incident_switches",
                                "deposit_policy",
                                "updated_time"
                              ]
                            }
                          ]
                        },
                        "children": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "child_vault_id": {
                                "type": "string"
                              },
                              "child_address": {
                                "type": "string"
                              },
                              "label": {
                                "type": "string"
                              },
                              "trader_address": {
                                "anyOf": [
                                  {
                                    "type": "null"
                                  },
                                  {
                                    "type": "string"
                                  }
                                ]
                              },
                              "active_for_routing": {
                                "type": "boolean"
                              },
                              "observed": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "child_vault_id",
                              "child_address",
                              "label",
                              "trader_address",
                              "active_for_routing",
                              "observed"
                            ]
                          }
                        },
                        "routes": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "market_id": {
                                "type": "number"
                              },
                              "market_address": {
                                "type": "string"
                              },
                              "child_vault_id": {
                                "type": "string"
                              },
                              "child_address": {
                                "type": "string"
                              },
                              "active": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "market_id",
                              "market_address",
                              "child_vault_id",
                              "child_address",
                              "active"
                            ]
                          }
                        },
                        "active_child_markets": {
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "child_vault_id": {
                                "type": "string"
                              },
                              "child_address": {
                                "type": "string"
                              },
                              "market_id": {
                                "type": "number"
                              },
                              "market_address": {
                                "type": "string"
                              },
                              "active": {
                                "type": "boolean"
                              }
                            },
                            "required": [
                              "child_vault_id",
                              "child_address",
                              "market_id",
                              "market_address",
                              "active"
                            ]
                          }
                        }
                      },
                      "required": [
                        "state",
                        "children",
                        "routes",
                        "active_child_markets"
                      ]
                    }
                  },
                  "required": [
                    "status"
                  ]
                }
              }
            }
          }
        }
      }
    }
  }
}
