{
  "openapi": "3.0.1",
  "info": {
    "title": "Figure Markets High Frequency Trading Exchange Trader API",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://www.figuremarkets.com",
      "description": "Production environment"
    }
  ],
  "paths": {
    "/trader/api/v1/orders/{orderId}/cancel": {
      "put": {
        "tags": [
          "Orders"
        ],
        "summary": "Cancel an order",
        "operationId": "traderCancelOrder",
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "TraderAuth": [
              "TRADER_TRADE"
            ]
          }
        ]
      }
    },
    "/trader/api/v1/orders/{symbol}": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Creates a new order",
        "description": "Restricted to YLDS stablecoin markets only. Please use the low-latency trading endpoint for other markets.",
        "operationId": "traderCreateOrder",
        "parameters": [
          {
            "name": "symbol",
            "in": "path",
            "description": "Market id",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Market id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/OrderRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "TraderAuth": [
              "TRADER_TRADE"
            ]
          }
        ]
      }
    },
    "/trader/api/v1/orders/{marketId}/fees": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Estimate fees for a proposed order",
        "operationId": "traderEstimateOrderFees",
        "parameters": [
          {
            "name": "marketId",
            "in": "path",
            "description": "Market id",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Market id"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EstimateOrderFeeRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EstimateOrderFeeResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "TraderAuth": [
              "TRADER_TRADE"
            ]
          }
        ]
      }
    },
    "/trader/api/v1/orders/cancel": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Cancel all open orders",
        "operationId": "traderCancelOrders",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CancelOrdersRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/OrderResponse"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "TraderAuth": [
              "TRADER_TRADE"
            ]
          }
        ]
      }
    },
    "/trader/api/v1/margin/payment": {
      "post": {
        "tags": [
          "Margin Trading"
        ],
        "summary": "Make a loan payment",
        "operationId": "traderCreatePayment",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LoanPaymentRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoanPaymentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "TraderAuth": [
              "TRADER_TRADE"
            ]
          }
        ]
      }
    },
    "/trader/api/v1/margin/loan": {
      "post": {
        "tags": [
          "Margin Trading"
        ],
        "summary": "Take out a new loan",
        "operationId": "traderCreateLoan",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateMarginLoanRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateMarginLoanResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "TraderAuth": [
              "TRADER_TRADE"
            ]
          }
        ]
      }
    },
    "/trader/api/v1/transfers/history": {
      "get": {
        "tags": [
          "Transfers"
        ],
        "summary": "Gets a list of historical transfers for the current wallet",
        "operationId": "traderGetTransferHistory",
        "parameters": [
          {
            "name": "actions",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/TransferAction"
              }
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/TransferHistoryStatus"
              }
            }
          },
          {
            "name": "statusToExclude",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/TransferHistoryStatus"
              }
            }
          },
          {
            "name": "assets",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedResponseTransferHistoryResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "TraderAuth": [
              "TRADER_READ"
            ]
          }
        ]
      }
    },
    "/trader/api/v1/orders": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Get orders",
        "operationId": "traderGetOrders",
        "parameters": [
          {
            "name": "symbol",
            "in": "query",
            "description": "Market id",
            "required": false,
            "deprecated": true,
            "schema": {
              "type": "string",
              "description": "Market id",
              "deprecated": true
            }
          },
          {
            "name": "marketId",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "type",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/OrderType"
            }
          },
          {
            "name": "direction",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Direction"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/OrderState"
              }
            }
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "maximum": 100,
              "minimum": 1,
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "token",
            "in": "query",
            "description": "pagination token",
            "required": false,
            "schema": {
              "type": "string",
              "description": "pagination token"
            }
          },
          {
            "name": "baseAsset",
            "in": "query",
            "description": "Search by markets with base asset",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Search by markets with base asset"
            }
          },
          {
            "name": "startTime",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "endTime",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenPaginatedResponseOrderResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "TraderAuth": [
              "TRADER_READ"
            ]
          }
        ]
      }
    },
    "/trader/api/v1/orders/{orderId}": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Get order",
        "operationId": "traderGetOrder",
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrderResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "TraderAuth": [
              "TRADER_READ"
            ]
          }
        ]
      }
    },
    "/trader/api/v1/orders/{orderId}/fills": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Get all fills (matches) for the order and the user",
        "operationId": "traderGetOrderFills",
        "parameters": [
          {
            "name": "orderId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/TradeState"
              }
            }
          },
          {
            "name": "token",
            "in": "query",
            "description": "pagination token",
            "required": false,
            "schema": {
              "type": "string",
              "description": "pagination token"
            }
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "maximum": 200,
              "minimum": 1,
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/SortOrder"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenPaginatedResponseSettlementMatchOrderResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "TraderAuth": [
              "TRADER_READ"
            ]
          }
        ]
      }
    },
    "/trader/api/v1/orders/fills": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Get all fills (matches) for the user",
        "operationId": "traderGetFills",
        "parameters": [
          {
            "name": "symbol",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "direction",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/Direction"
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/TradeState"
              }
            }
          },
          {
            "name": "token",
            "in": "query",
            "description": "pagination token",
            "required": false,
            "schema": {
              "type": "string",
              "description": "pagination token"
            }
          },
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "maximum": 200,
              "minimum": 1,
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "sort",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/SortOrder"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TokenPaginatedResponseMatchOrderResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "TraderAuth": [
              "TRADER_READ"
            ]
          }
        ]
      }
    },
    "/trader/api/v1/margin/payment/{id}": {
      "get": {
        "tags": [
          "Margin Trading"
        ],
        "summary": "Fetch a loan payment",
        "operationId": "traderGetPayment",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoanPaymentResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "TraderAuth": [
              "TRADER_READ"
            ]
          }
        ]
      }
    },
    "/trader/api/v1/borrowers/loan-history": {
      "get": {
        "tags": [
          "Borrowers"
        ],
        "summary": "Get paginated loan history",
        "operationId": "traderGetLoanHistory",
        "parameters": [
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "maximum": 50,
              "minimum": 1,
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "minimum": 1,
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          },
          {
            "name": "period",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/PeriodSpan"
            }
          },
          {
            "name": "leverage_pool_uuid",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedResponseLoanPeriodResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "TraderAuth": [
              "TRADER_READ"
            ]
          }
        ]
      }
    },
    "/trader/api/v1/borrowers/loan-history-summary": {
      "get": {
        "tags": [
          "Borrowers"
        ],
        "summary": "Get loan history summary",
        "operationId": "traderGetLoanHistorySummary",
        "parameters": [
          {
            "name": "leverage_pool_uuid",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoanHistorySummaryResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "TraderAuth": [
              "TRADER_READ"
            ]
          }
        ]
      }
    },
    "/trader/api/v1/borrowers/loan-balances": {
      "get": {
        "tags": [
          "Borrowers"
        ],
        "summary": "Get outstanding loan balances",
        "operationId": "traderGetLoanBalances",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetLoanBalancesResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "TraderAuth": [
              "TRADER_READ"
            ]
          }
        ]
      }
    },
    "/trader/api/v1/borrowers/liquidations": {
      "get": {
        "tags": [
          "Borrowers"
        ],
        "summary": "Get past liquidations",
        "operationId": "traderGetLiquidations",
        "parameters": [
          {
            "name": "size",
            "in": "query",
            "required": false,
            "schema": {
              "maximum": 100,
              "minimum": 1,
              "type": "integer",
              "format": "int32",
              "default": 20
            }
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "schema": {
              "minimum": 1,
              "type": "integer",
              "format": "int32",
              "default": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaginatedResponseLiquidationResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "TraderAuth": [
              "TRADER_READ"
            ]
          }
        ]
      }
    },
    "/trader/api/v1/accounts/balances": {
      "get": {
        "tags": [
          "Accounts"
        ],
        "summary": "Get portfolio balances for the account",
        "operationId": "traderGetBalances",
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortfolioBalanceResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "TraderAuth": [
              "TRADER_READ"
            ]
          }
        ]
      }
    },
    "/trader/api/v1/accounts/balances/history": {
      "get": {
        "tags": [
          "Accounts"
        ],
        "summary": "Get portfolio balance history for the account",
        "description": "Returns the most recent `count` days of historical portfolio balances for the account.The time range is determined by the most recent daily snapshot, or the current time if no snapshot is in range.",
        "operationId": "traderGetPortfolioBalanceHistory",
        "parameters": [
          {
            "name": "period",
            "in": "query",
            "description": "In ISO 8601 duration format",
            "required": false,
            "schema": {
              "title": "Period between data points",
              "type": "string",
              "description": "In ISO 8601 duration format",
              "default": "P1D"
            }
          },
          {
            "name": "count",
            "in": "query",
            "description": "The number of `period`s to go back in time.",
            "required": false,
            "schema": {
              "type": "integer",
              "description": "The number of `period`s to go back in time.",
              "default": 7
            }
          },
          {
            "name": "includeCurrent",
            "in": "query",
            "required": false,
            "schema": {
              "title": "Include the current balance in addition to the historical balances",
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "endTime",
            "in": "query",
            "description": "Defaults to now. Typically when set, `includeCurrent` will be set to \"false\"",
            "required": false,
            "schema": {
              "title": "The last time to retrieve",
              "type": "string",
              "description": "Defaults to now. Typically when set, `includeCurrent` will be set to \"false\""
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PortfolioBalanceHistorySummary"
                }
              }
            }
          }
        },
        "security": [
          {
            "TraderAuth": [
              "TRADER_READ"
            ]
          }
        ]
      }
    },
    "/trader/api/v1/accounts/assets/{assetId}/market-data": {
      "get": {
        "tags": [
          "Accounts"
        ],
        "summary": "Get market data for a specific asset",
        "description": "Returns the latest market data for the specified asset.",
        "operationId": "traderGetMarketData",
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AssetMarketData"
                }
              }
            }
          }
        },
        "security": [
          {
            "TraderAuth": [
              "TRADER_READ"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "Direction": {
        "type": "string",
        "enum": [
          "UNKNOWN_DIRECTION",
          "ASK",
          "BID"
        ]
      },
      "OrderExecutionType": {
        "type": "string",
        "enum": [
          "ALLOW_TAKER",
          "MAKER_ONLY"
        ]
      },
      "OrderResponse": {
        "required": [
          "created",
          "denom",
          "direction",
          "executionType",
          "feeBasisPoints",
          "feeTotal",
          "filledQuantity",
          "marketDisplayName",
          "marketId",
          "maxFeeTotal",
          "orderId",
          "orderType",
          "price",
          "priceDenom",
          "quantity",
          "remainingQuantity",
          "state",
          "symbol",
          "totalFilledValue"
        ],
        "type": "object",
        "properties": {
          "symbol": {
            "type": "string",
            "deprecated": true
          },
          "marketId": {
            "type": "string",
            "description": "The market\u0027s id, previously symbol"
          },
          "marketDisplayName": {
            "type": "string",
            "description": "Display name for market"
          },
          "denom": {
            "type": "string"
          },
          "priceDenom": {
            "type": "string"
          },
          "orderId": {
            "type": "string"
          },
          "quantity": {
            "type": "string"
          },
          "price": {
            "type": "string"
          },
          "direction": {
            "$ref": "#/components/schemas/Direction"
          },
          "orderType": {
            "$ref": "#/components/schemas/OrderType"
          },
          "clientOrderId": {
            "type": "string"
          },
          "remainingQuantity": {
            "type": "string",
            "description": "Working quantity"
          },
          "filledQuantity": {
            "type": "string"
          },
          "state": {
            "$ref": "#/components/schemas/OrderState"
          },
          "created": {
            "type": "string",
            "format": "date-time"
          },
          "expiration": {
            "type": "string",
            "format": "date-time"
          },
          "feeTotal": {
            "type": "string"
          },
          "executionType": {
            "$ref": "#/components/schemas/OrderExecutionType"
          },
          "failureReason": {
            "type": "string"
          },
          "stopPrice": {
            "type": "string"
          },
          "timeInForce": {
            "$ref": "#/components/schemas/TimeInForce"
          },
          "cashOrderQty": {
            "type": "string"
          },
          "totalFilledValue": {
            "type": "string",
            "description": "total value of filled order \u003d sum(fill qty * fill price)"
          },
          "maxFeeTotal": {
            "type": "number",
            "description": "max fees to be charged if the order fully executes"
          },
          "feeBasisPoints": {
            "type": "number"
          }
        }
      },
      "OrderState": {
        "type": "string",
        "enum": [
          "UNKNOWN_ORDER_STATE",
          "NEW",
          "PARTIALLY_FILLED",
          "FILLED",
          "CANCELED",
          "REPLACED",
          "REJECTED",
          "EXPIRED",
          "PENDING_NEW",
          "PENDING_REPLACE",
          "PENDING_CANCEL",
          "PENDING_RISK"
        ]
      },
      "OrderType": {
        "type": "string",
        "enum": [
          "UNKNOWN_ORDER_TYPE",
          "LIMIT",
          "STOP_LIMIT",
          "MARKET"
        ]
      },
      "TimeInForce": {
        "type": "string",
        "description": "Use \u0027GOOD_TILL_CANCEL\u0027 and \u0027FILL_OR_KILL\u0027 instead of \u0027TIME_IN_FORCE_GOOD_TILL_CANCEL\u0027 and \u0027TIME_IN_FORCE_FILL_OR_KILL\u0027",
        "enum": [
          "DAY",
          "IMMEDIATE_OR_CANCEL",
          "GOOD_TILL_TIME",
          "GOOD_TILL_CANCEL",
          "FILL_OR_KILL",
          "TIME_IN_FORCE_GOOD_TILL_CANCEL",
          "TIME_IN_FORCE_FILL_OR_KILL"
        ]
      },
      "OrderRequest": {
        "required": [
          "clientOrderId",
          "direction",
          "orderType",
          "shortSell"
        ],
        "type": "object",
        "properties": {
          "quantity": {
            "minimum": 0.0,
            "exclusiveMinimum": true,
            "type": "number",
            "description": "A quantity must be provided for non market orders"
          },
          "direction": {
            "$ref": "#/components/schemas/Direction"
          },
          "orderType": {
            "$ref": "#/components/schemas/OrderType"
          },
          "price": {
            "minimum": 0.0,
            "exclusiveMinimum": true,
            "type": "number"
          },
          "stopPrice": {
            "type": "number"
          },
          "clientOrderId": {
            "type": "string",
            "format": "uuid"
          },
          "expiration": {
            "type": "string",
            "format": "date-time"
          },
          "executionType": {
            "$ref": "#/components/schemas/OrderExecutionType"
          },
          "timeInForce": {
            "$ref": "#/components/schemas/TimeInForce"
          },
          "cashOrderQty": {
            "minimum": 0.0,
            "exclusiveMinimum": true,
            "type": "number",
            "description": "Total value of a market order"
          },
          "shortSell": {
            "type": "boolean"
          }
        }
      },
      "EstimateOrderFeeRequest": {
        "required": [
          "clientOrderId",
          "direction",
          "orderType",
          "shortSell"
        ],
        "type": "object",
        "properties": {
          "quantity": {
            "minimum": 0.0,
            "exclusiveMinimum": true,
            "type": "number",
            "description": "A quantity must be provided for non market orders"
          },
          "direction": {
            "$ref": "#/components/schemas/Direction"
          },
          "orderType": {
            "$ref": "#/components/schemas/OrderType"
          },
          "price": {
            "minimum": 0.0,
            "exclusiveMinimum": true,
            "type": "number"
          },
          "stopPrice": {
            "type": "number"
          },
          "clientOrderId": {
            "type": "string",
            "format": "uuid"
          },
          "expiration": {
            "type": "string",
            "format": "date-time"
          },
          "executionType": {
            "$ref": "#/components/schemas/OrderExecutionType"
          },
          "timeInForce": {
            "$ref": "#/components/schemas/TimeInForce"
          },
          "cashOrderQty": {
            "minimum": 0.0,
            "exclusiveMinimum": true,
            "type": "number",
            "description": "Total value of a market order"
          },
          "shortSell": {
            "type": "boolean"
          },
          "buyNowLimit": {
            "type": "number",
            "description": "When estimating for a buy now order, this should be the ACH/Debit limit. maxCashOrderQty will be based on this instead of current account balances."
          }
        }
      },
      "EstimateOrderFeeResponse": {
        "required": [
          "estimatedFee",
          "marketId"
        ],
        "type": "object",
        "properties": {
          "marketId": {
            "type": "string"
          },
          "quantity": {
            "type": "number"
          },
          "price": {
            "type": "number"
          },
          "cashOrderQty": {
            "type": "number"
          },
          "estimatedFee": {
            "type": "number",
            "description": "Estimated fee for the order in terms of quote asset"
          },
          "basisPoints": {
            "type": "number"
          },
          "makerBasisPoints": {
            "type": "number"
          },
          "minCashOrderQty": {
            "type": "number"
          },
          "maxCashOrderQty": {
            "type": "number"
          }
        }
      },
      "CancelOrdersRequest": {
        "type": "object",
        "properties": {
          "marketId": {
            "title": "Market id",
            "type": "string"
          },
          "baseAsset": {
            "type": "string",
            "description": "Base asset for all markets to cancel orders on"
          }
        }
      },
      "LoanPaymentRequest": {
        "required": [
          "amount",
          "id",
          "leveragePoolId"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Client generated unique payment id",
            "format": "uuid"
          },
          "leveragePoolId": {
            "type": "string",
            "format": "uuid"
          },
          "amount": {
            "type": "number"
          }
        }
      },
      "LoanPaymentResponse": {
        "required": [
          "amount",
          "asset",
          "id",
          "leveragePoolId",
          "status"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "asset": {
            "type": "string"
          },
          "leveragePoolId": {
            "type": "string",
            "format": "uuid"
          },
          "amount": {
            "type": "number"
          },
          "status": {
            "$ref": "#/components/schemas/LoanPaymentStatus"
          }
        }
      },
      "LoanPaymentStatus": {
        "type": "string",
        "enum": [
          "PENDING",
          "COMPLETE",
          "ERROR"
        ]
      },
      "CreateMarginLoanRequest": {
        "required": [
          "amount",
          "id",
          "leveragePoolId",
          "loanType"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Client generated unique loan id",
            "format": "uuid"
          },
          "amount": {
            "minimum": 0.0,
            "exclusiveMinimum": true,
            "type": "number"
          },
          "leveragePoolId": {
            "type": "string",
            "format": "uuid"
          },
          "loanType": {
            "$ref": "#/components/schemas/LoanType"
          },
          "withdrawRequest": {
            "$ref": "#/components/schemas/WithdrawRequest"
          },
          "fiatWithdrawRequest": {
            "$ref": "#/components/schemas/FiatWithdrawRequest"
          }
        }
      },
      "FiatPaymentRail": {
        "type": "string",
        "description": "Method used to transfer fiat asset",
        "enum": [
          "ACH",
          "DEBIT_CARD",
          "SEPA",
          "WIRE"
        ]
      },
      "FiatWithdrawRequest": {
        "required": [
          "amount",
          "currency",
          "destinationPlaidAccountId",
          "paymentRail"
        ],
        "type": "object",
        "properties": {
          "amount": {
            "type": "number"
          },
          "currency": {
            "title": "Asset name",
            "type": "string"
          },
          "paymentRail": {
            "$ref": "#/components/schemas/FiatPaymentRail"
          },
          "destinationPlaidAccountId": {
            "title": "Fiat account id",
            "type": "string",
            "description": "Plaid or wire account id",
            "format": "uuid"
          }
        },
        "description": "Optional fiat withdraw request for off platform loan"
      },
      "LoanType": {
        "type": "string",
        "description": "Type of loan to create",
        "default": "MARGIN",
        "enum": [
          "MARGIN",
          "OFF_PLATFORM_MARGIN"
        ]
      },
      "WithdrawRequest": {
        "required": [
          "amount",
          "currency"
        ],
        "type": "object",
        "properties": {
          "amount": {
            "type": "string"
          },
          "recipientAddress": {
            "type": "string",
            "description": "Address to send uncommitted asset to. Only for security entitlements"
          },
          "currency": {
            "title": "Asset name",
            "type": "string"
          },
          "feeId": {
            "type": "string",
            "description": "Estimated fee ID. Required for non-native currencies.",
            "format": "uuid"
          },
          "memo": {
            "type": "string",
            "description": "Optional memo for withdrawing certain assets to networks that support it"
          },
          "uncommitOnly": {
            "type": "boolean",
            "description": "When true, only uncommits the asset from the exchange without initiating a blockchain transfer. Recipient address is not required."
          }
        },
        "description": "Optional MPC withdraw request for off platform loan"
      },
      "CreateMarginLoanResponse": {
        "required": [
          "id",
          "rate"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "rate": {
            "$ref": "#/components/schemas/LoanRateResponse"
          }
        }
      },
      "LoanRateResponse": {
        "required": [
          "amt",
          "periodIntAmt",
          "periodRate",
          "rate"
        ],
        "type": "object",
        "properties": {
          "amt": {
            "type": "number"
          },
          "rate": {
            "type": "number"
          },
          "periodIntAmt": {
            "type": "number"
          },
          "periodRate": {
            "type": "number"
          }
        }
      },
      "TransferAction": {
        "type": "string",
        "enum": [
          "DEPOSIT",
          "WITHDRAW",
          "INTEREST",
          "REFUND",
          "RETURN",
          "REWARD",
          "ISSUANCE",
          "RECEIVE_YLDS_PAYMENT",
          "P2P",
          "CBL_DISBURSEMENT",
          "CBL_PAYMENT",
          "REPAYMENT_TRANSFER",
          "MARGIN",
          "NMS_SEND",
          "NMS_RECEIVE",
          "SEND",
          "RECEIVE",
          "SEND_COLLATERAL",
          "RECEIVE_COLLATERAL"
        ]
      },
      "TransferHistoryStatus": {
        "type": "string",
        "enum": [
          "PENDING",
          "TRANSFER_PENDING",
          "TRANSFER_AWAITING_EXECUTION",
          "TRANSFER_EXECUTED",
          "COMPLETE",
          "ERROR",
          "CANCELED",
          "INVITATION_ACCEPTANCE_PENDING",
          "PENDING_CANCELED",
          "UNKNOWN",
          "DECLINED",
          "REVIEW"
        ]
      },
      "NmsBrokerage": {
        "required": [
          "accountNumber",
          "brokerageName",
          "dtcNumber"
        ],
        "type": "object",
        "properties": {
          "brokerageName": {
            "type": "string",
            "description": "Brokerage name"
          },
          "dtcNumber": {
            "type": "string",
            "description": "DTC number"
          },
          "accountNumber": {
            "type": "string",
            "description": "Account number"
          }
        }
      },
      "PaginatedResponseTransferHistoryResponse": {
        "required": [
          "data",
          "pagination"
        ],
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TransferHistoryResponse"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/PaginationResponse"
          }
        }
      },
      "PaginationResponse": {
        "required": [
          "page",
          "size",
          "totalCount",
          "totalPages"
        ],
        "type": "object",
        "properties": {
          "page": {
            "type": "integer",
            "format": "int32"
          },
          "size": {
            "type": "integer",
            "format": "int64"
          },
          "totalPages": {
            "type": "integer",
            "format": "int32"
          },
          "totalCount": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "TransferHistoryResponse": {
        "required": [
          "action",
          "amount",
          "currency",
          "recipientAddress",
          "senderAddress",
          "status",
          "transferDateTime",
          "uuid"
        ],
        "type": "object",
        "properties": {
          "uuid": {
            "type": "string",
            "format": "uuid"
          },
          "action": {
            "$ref": "#/components/schemas/TransferAction"
          },
          "recipientAddress": {
            "type": "string"
          },
          "senderAddress": {
            "type": "string"
          },
          "currency": {
            "title": "Asset name",
            "type": "string"
          },
          "denom": {
            "type": "string"
          },
          "amount": {
            "type": "string"
          },
          "transferDateTime": {
            "type": "string",
            "format": "date-time"
          },
          "transferUpdateDateTime": {
            "type": "string",
            "format": "date-time"
          },
          "status": {
            "$ref": "#/components/schemas/TransferHistoryStatus"
          },
          "fee": {
            "type": "string"
          },
          "groupProposalId": {
            "type": "integer",
            "format": "int64"
          },
          "memo": {
            "type": "string"
          },
          "toEmail": {
            "type": "string"
          },
          "expiration": {
            "type": "string",
            "format": "date-time"
          },
          "fromEmail": {
            "type": "string"
          },
          "fiatRail": {
            "$ref": "#/components/schemas/FiatPaymentRail"
          },
          "clearingDate": {
            "type": "string",
            "format": "date-time"
          },
          "transactionHash": {
            "type": "string"
          },
          "brokerage": {
            "$ref": "#/components/schemas/NmsBrokerage"
          }
        }
      },
      "TokenPaginatedResponseOrderResponse": {
        "required": [
          "data",
          "totalCount"
        ],
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrderResponse"
            }
          },
          "nextPageToken": {
            "type": "string"
          },
          "totalCount": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "TradeState": {
        "type": "string",
        "enum": [
          "UNKNOWN_TRADE_STATE",
          "NEW",
          "CLEARED",
          "BUSTED",
          "INFLIGHT",
          "PENDING_RISK",
          "PENDING_CLEARED",
          "REJECTED",
          "CLEARING_ACKNOWLEDGED",
          "RETRY_REQUEST"
        ]
      },
      "SortOrder": {
        "type": "string",
        "enum": [
          "ASC",
          "DESC"
        ]
      },
      "SettlementMatchOrderResponse": {
        "required": [
          "askFee",
          "askId",
          "bidFee",
          "bidId",
          "created",
          "denom",
          "direction",
          "id",
          "marketId",
          "price",
          "quantity",
          "state",
          "symbol",
          "type"
        ],
        "type": "object",
        "properties": {
          "symbol": {
            "type": "string",
            "deprecated": true
          },
          "marketId": {
            "type": "string"
          },
          "denom": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "price": {
            "type": "number"
          },
          "quantity": {
            "type": "number"
          },
          "created": {
            "type": "string",
            "format": "date-time"
          },
          "askFee": {
            "type": "number"
          },
          "bidFee": {
            "type": "number"
          },
          "state": {
            "$ref": "#/components/schemas/TradeState"
          },
          "direction": {
            "$ref": "#/components/schemas/Direction"
          },
          "askId": {
            "type": "string"
          },
          "bidId": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/OrderType"
          },
          "settlementTxHash": {
            "type": "string"
          }
        }
      },
      "TokenPaginatedResponseSettlementMatchOrderResponse": {
        "required": [
          "data",
          "totalCount"
        ],
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SettlementMatchOrderResponse"
            }
          },
          "nextPageToken": {
            "type": "string"
          },
          "totalCount": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "MatchOrderResponse": {
        "required": [
          "askFee",
          "askId",
          "bidFee",
          "bidId",
          "created",
          "denom",
          "direction",
          "id",
          "marketId",
          "price",
          "quantity",
          "state",
          "symbol",
          "type"
        ],
        "type": "object",
        "properties": {
          "symbol": {
            "type": "string",
            "deprecated": true
          },
          "marketId": {
            "type": "string"
          },
          "denom": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "price": {
            "type": "number"
          },
          "quantity": {
            "type": "number"
          },
          "created": {
            "type": "string",
            "format": "date-time"
          },
          "askFee": {
            "type": "number"
          },
          "bidFee": {
            "type": "number"
          },
          "state": {
            "$ref": "#/components/schemas/TradeState"
          },
          "direction": {
            "$ref": "#/components/schemas/Direction"
          },
          "askId": {
            "type": "string"
          },
          "bidId": {
            "type": "string"
          },
          "type": {
            "$ref": "#/components/schemas/OrderType"
          }
        }
      },
      "TokenPaginatedResponseMatchOrderResponse": {
        "required": [
          "data",
          "totalCount"
        ],
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MatchOrderResponse"
            }
          },
          "nextPageToken": {
            "type": "string"
          },
          "totalCount": {
            "type": "integer",
            "format": "int64"
          }
        }
      },
      "PeriodSpan": {
        "type": "string",
        "enum": [
          "HOUR",
          "DAY",
          "WEEK",
          "MONTH",
          "YEAR"
        ]
      },
      "LoanPeriodResponse": {
        "required": [
          "currency",
          "effectiveApr",
          "endTime",
          "endingBalance",
          "fees",
          "lenderInterest",
          "leveragePoolId",
          "marketFees",
          "newLoanIncurred",
          "payments",
          "rolloverAmount",
          "startTime"
        ],
        "type": "object",
        "properties": {
          "startTime": {
            "type": "string",
            "format": "date-time"
          },
          "endTime": {
            "type": "string",
            "format": "date-time"
          },
          "leveragePoolId": {
            "type": "string",
            "format": "uuid"
          },
          "currency": {
            "type": "string"
          },
          "rolloverAmount": {
            "type": "number"
          },
          "newLoanIncurred": {
            "type": "number"
          },
          "fees": {
            "type": "number"
          },
          "effectiveApr": {
            "type": "number"
          },
          "payments": {
            "type": "number"
          },
          "endingBalance": {
            "type": "number"
          },
          "lenderInterest": {
            "type": "number"
          },
          "marketFees": {
            "type": "number"
          }
        }
      },
      "PaginatedResponseLoanPeriodResponse": {
        "required": [
          "data",
          "pagination"
        ],
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LoanPeriodResponse"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/PaginationResponse"
          }
        }
      },
      "LoanHistorySummaryResponse": {
        "required": [
          "denomTypeCode",
          "interestPaid",
          "leveragePoolId",
          "startDate"
        ],
        "type": "object",
        "properties": {
          "leveragePoolId": {
            "type": "string",
            "format": "uuid"
          },
          "denomTypeCode": {
            "type": "string"
          },
          "startDate": {
            "type": "string",
            "format": "date-time"
          },
          "interestRateRange": {
            "$ref": "#/components/schemas/LoanRateRangeResponse"
          },
          "interestPaid": {
            "type": "number"
          }
        }
      },
      "LoanRateRangeResponse": {
        "required": [
          "maxRate",
          "minRate"
        ],
        "type": "object",
        "properties": {
          "minRate": {
            "type": "number"
          },
          "maxRate": {
            "type": "number"
          }
        }
      },
      "GetLoanBalancesResponse": {
        "required": [
          "collateralValue",
          "data",
          "loansValue",
          "ltv",
          "status"
        ],
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LoanBalanceResponse"
            }
          },
          "ltv": {
            "type": "number"
          },
          "status": {
            "$ref": "#/components/schemas/LoanToValueStatus"
          },
          "collateralValue": {
            "type": "number",
            "description": "Total value of assets used for collateral"
          },
          "loansValue": {
            "type": "number",
            "description": "Value of outstanding loans"
          }
        }
      },
      "LoanBalanceResponse": {
        "required": [
          "balance",
          "currency",
          "currentPeriodFeeRate",
          "currentPeriodLenderRate",
          "currentPeriodRate",
          "fees",
          "interest",
          "leveragePoolId",
          "pendingPayments",
          "principal",
          "rateRange",
          "totalValue"
        ],
        "type": "object",
        "properties": {
          "leveragePoolId": {
            "type": "string",
            "format": "uuid"
          },
          "balance": {
            "type": "number"
          },
          "currency": {
            "type": "string"
          },
          "rateRange": {
            "$ref": "#/components/schemas/LoanRateRangeResponse"
          },
          "totalValue": {
            "type": "number"
          },
          "currentPeriodRate": {
            "type": "number",
            "description": "the current APR"
          },
          "currentPeriodFeeRate": {
            "type": "number",
            "description": "the annualized fee rate"
          },
          "currentPeriodLenderRate": {
            "type": "number",
            "description": "the annualized lender rate"
          },
          "principal": {
            "type": "number",
            "description": "Outstanding principal balance"
          },
          "interest": {
            "type": "number",
            "description": "Outstanding interest balance"
          },
          "fees": {
            "type": "number",
            "description": "Outstanding fee balance"
          },
          "pendingPayments": {
            "type": "number",
            "description": "Balance of pending payments"
          }
        }
      },
      "LoanToValueStatus": {
        "type": "string",
        "enum": [
          "HEALTHY",
          "UNHEALTHY",
          "MARGIN_CALL",
          "LIQUIDATION"
        ]
      },
      "LiquidatedAssetResponse": {
        "required": [
          "currency",
          "quantity"
        ],
        "type": "object",
        "properties": {
          "currency": {
            "type": "string"
          },
          "quantity": {
            "type": "number"
          },
          "fee": {
            "type": "number"
          },
          "feeValue": {
            "type": "number"
          },
          "price": {
            "type": "number"
          },
          "totalValue": {
            "type": "number"
          }
        }
      },
      "LiquidationResponse": {
        "required": [
          "assets",
          "liquidationDtm",
          "uuid"
        ],
        "type": "object",
        "properties": {
          "uuid": {
            "type": "string",
            "format": "uuid"
          },
          "liquidationDtm": {
            "type": "string",
            "format": "date-time"
          },
          "assets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LiquidatedAssetResponse"
            }
          }
        }
      },
      "PaginatedResponseLiquidationResponse": {
        "required": [
          "data",
          "pagination"
        ],
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LiquidationResponse"
            }
          },
          "pagination": {
            "$ref": "#/components/schemas/PaginationResponse"
          }
        }
      },
      "AssetBalanceResponse": {
        "required": [
          "asset",
          "cblBalance",
          "cblOwedBalance",
          "displayBalance",
          "exchangeBalance",
          "exchangePrice",
          "fiatLedgerBalance",
          "loanBalance",
          "offerBalance",
          "rewardsBalance",
          "smartContractLendingBalance",
          "stakableBalance",
          "stakedBalance",
          "totalBalance",
          "tradingPower",
          "unbondingBalance",
          "uncommittedBalance",
          "unvestedBalance"
        ],
        "type": "object",
        "properties": {
          "asset": {
            "type": "string"
          },
          "totalBalance": {
            "title": "Sum of all balances, less liabilities",
            "type": "number"
          },
          "displayBalance": {
            "title": "Balance for display",
            "type": "number",
            "description": "Does not include loan, offer, or smart-contract lending balances."
          },
          "exchangeBalance": {
            "title": "Balance committed to the exchange for trading",
            "type": "number"
          },
          "tradingPower": {
            "title": "Balance available to trade",
            "type": "number"
          },
          "loanBalance": {
            "title": "Democratized prime loan balance",
            "type": "number"
          },
          "offerBalance": {
            "title": "Balance lent out in democratized prime offers",
            "type": "number"
          },
          "smartContractLendingBalance": {
            "title": "Balance lent via on-chain smart-contract (repo) pools",
            "type": "number",
            "description": "Included in total portfolio value; separate from lending offers."
          },
          "cblBalance": {
            "title": "Balance committed as collateral for Crypto Backed Loans",
            "type": "number"
          },
          "cblOwedBalance": {
            "title": "Balance owed on Crypto Backed Loans",
            "type": "number"
          },
          "uncommittedBalance": {
            "title": "Balance present on chain that is not otherwise committed",
            "type": "number"
          },
          "stakedBalance": {
            "title": "Balance staked to validators",
            "type": "number"
          },
          "rewardsBalance": {
            "title": "Balance of unclaimed rewards earned via staking",
            "type": "number"
          },
          "unbondingBalance": {
            "title": "Balance that is locked while being unbonded from validators",
            "type": "number"
          },
          "stakableBalance": {
            "title": "Balance available for staking",
            "type": "number"
          },
          "unvestedBalance": {
            "title": "Balance that is not yet vested",
            "type": "number"
          },
          "fiatLedgerBalance": {
            "title": "Fiat ledger balance",
            "type": "number",
            "description": "Unsettled/pending fiat currency balance due to legacy financial system like ACH"
          },
          "exchangePrice": {
            "title": "The current exchange price of the asset",
            "type": "number"
          }
        }
      },
      "CryptoBackedLoanBalanceResponse": {
        "title": "Crypto Backed Loans",
        "required": [
          "asset",
          "balance",
          "collateralAsset",
          "collateralBalance",
          "interestRate",
          "loanId",
          "loanNumber",
          "ltv",
          "paymentAssets",
          "status"
        ],
        "type": "object",
        "properties": {
          "loanId": {
            "type": "string",
            "format": "uuid"
          },
          "loanNumber": {
            "title": "Displayable loan number",
            "type": "string"
          },
          "asset": {
            "title": "Distributed asset",
            "type": "string"
          },
          "balance": {
            "title": "Balance owed on loan",
            "type": "number"
          },
          "collateralAsset": {
            "title": "Asset committed as collateral",
            "type": "string"
          },
          "collateralBalance": {
            "title": "Amount of collateral committed",
            "minimum": 0,
            "type": "number"
          },
          "interestRate": {
            "title": "Interest rate on the loan",
            "maximum": 1,
            "minimum": 0,
            "type": "number"
          },
          "ltv": {
            "title": "Loan To Value ratio",
            "maximum": 1,
            "minimum": 0,
            "type": "number"
          },
          "status": {
            "title": "Health status of the loan",
            "type": "string"
          },
          "paymentAssets": {
            "title": "Assets allowed for repaying the loan",
            "type": "array",
            "items": {
              "title": "Assets allowed for repaying the loan",
              "type": "string"
            }
          }
        },
        "description": "Return all crypto backed loans for the account. Note that this does not include unfunded applications."
      },
      "LoanBalanceResponseV2": {
        "required": [
          "asset",
          "balance",
          "currentPeriodFeeRate",
          "currentPeriodLenderRate",
          "currentPeriodRate",
          "leveragePoolId",
          "rateRange"
        ],
        "type": "object",
        "properties": {
          "leveragePoolId": {
            "type": "string",
            "format": "uuid"
          },
          "balance": {
            "type": "number"
          },
          "asset": {
            "type": "string"
          },
          "rateRange": {
            "$ref": "#/components/schemas/LoanRateRangeResponse"
          },
          "currentPeriodRate": {
            "type": "number",
            "description": "the current APR"
          },
          "currentPeriodFeeRate": {
            "type": "number",
            "description": "the annualized fee rate"
          },
          "currentPeriodLenderRate": {
            "type": "number",
            "description": "the annualized lender rate"
          }
        }
      },
      "OfferBalanceResponseV2": {
        "required": [
          "asset",
          "balance",
          "createdAt",
          "interestBalance",
          "leveragePoolId",
          "offerId",
          "rate",
          "status",
          "totalBalance"
        ],
        "type": "object",
        "properties": {
          "leveragePoolId": {
            "type": "string",
            "format": "uuid"
          },
          "offerId": {
            "type": "string",
            "format": "uuid"
          },
          "balance": {
            "type": "number",
            "description": "Balance offered"
          },
          "interestBalance": {
            "type": "number",
            "description": "Interest accrued on the offered balance"
          },
          "totalBalance": {
            "type": "number",
            "description": "Total balance including interest"
          },
          "asset": {
            "type": "string"
          },
          "rate": {
            "maximum": 1,
            "minimum": 0,
            "type": "number"
          },
          "status": {
            "$ref": "#/components/schemas/OfferStatus"
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "OfferStatus": {
        "type": "string",
        "enum": [
          "PENDING",
          "ACTIVE",
          "PENDING_CANCELLATION",
          "CANCELLED",
          "ERROR"
        ]
      },
      "PortfolioBalanceResponse": {
        "required": [
          "assets",
          "cryptoBackedLoans",
          "loans",
          "offers",
          "smartContractLendingBalances",
          "totalValue"
        ],
        "type": "object",
        "properties": {
          "totalValue": {
            "title": "Total portfolio value at current pricing",
            "type": "number"
          },
          "assets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssetBalanceResponse"
            }
          },
          "loans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LoanBalanceResponseV2"
            }
          },
          "offers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OfferBalanceResponseV2"
            }
          },
          "smartContractLendingBalances": {
            "type": "array",
            "description": "On-chain smart-contract (repo) lent balances by pool; separate from lending offers.",
            "items": {
              "$ref": "#/components/schemas/SmartContractLendingBalanceResponse"
            }
          },
          "cryptoBackedLoans": {
            "title": "Crypto Backed Loans",
            "type": "array",
            "description": "Return all crypto backed loans for the account. Note that this does not include unfunded applications.",
            "items": {
              "$ref": "#/components/schemas/CryptoBackedLoanBalanceResponse"
            }
          }
        }
      },
      "SmartContractLendingBalanceResponse": {
        "required": [
          "asset",
          "balance",
          "leveragePoolId"
        ],
        "type": "object",
        "properties": {
          "leveragePoolId": {
            "type": "string",
            "format": "uuid"
          },
          "asset": {
            "type": "string"
          },
          "balance": {
            "type": "number",
            "description": "Repo-token balance representing capital lent in the pool contract"
          }
        },
        "description": "On-chain smart-contract (repo) lent balances by pool; separate from lending offers."
      },
      "PortfolioBalanceHistoryEntry": {
        "title": "Portfolio balances 24 hours ago",
        "required": [
          "assets",
          "timestamp",
          "totalValue"
        ],
        "type": "object",
        "properties": {
          "timestamp": {
            "title": "Timestamp of the historical data",
            "type": "string",
            "format": "date-time"
          },
          "totalValue": {
            "title": "Total portfolio value",
            "type": "number"
          },
          "assets": {
            "title": "Asset balances",
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AssetBalanceResponse"
            }
          }
        },
        "description": "This is a temporary field that can be used to verify the 24h change is correct"
      },
      "PortfolioBalanceHistorySummary": {
        "required": [
          "balances24h",
          "history",
          "totalValue",
          "totalValue24h"
        ],
        "type": "object",
        "properties": {
          "totalValue": {
            "title": "Current portfolio value",
            "type": "number"
          },
          "totalValue24h": {
            "title": "Portfolio value 24 hours ago",
            "type": "number"
          },
          "history": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PortfolioBalanceHistoryEntry"
            }
          },
          "balances24h": {
            "$ref": "#/components/schemas/PortfolioBalanceHistoryEntry"
          }
        }
      },
      "AssetMarketData": {
        "required": [
          "averageClose",
          "averageOpen",
          "netBalance",
          "unrealizedPL"
        ],
        "type": "object",
        "properties": {
          "averageOpen": {
            "type": "number",
            "description": "The weighted average purchase price of the asset"
          },
          "averageClose": {
            "type": "number",
            "description": "The weighted average sale price of the asset"
          },
          "netBalance": {
            "type": "number",
            "description": "The net balance of the asset purchased on the exchange, less sold. Used to calculate unrealized profit and loss"
          },
          "unrealizedPL": {
            "title": "Unrealized Profit and Loss",
            "type": "number",
            "description": "Profit or loss that would be realized by selling the asset at current market pricing"
          }
        }
      }
    },
    "securitySchemes": {
      "TraderAuth": {
        "type": "oauth2",
        "description": "Trader authentication",
        "flows": {
          "clientCredentials": {
            "tokenUrl": "https://www.figuremarkets.com/auth/oauth2/token",
            "scopes": {
              "TRADER_READ": "Read-only access to Trader API",
              "TRADER_TRADE": "Access to YLDS and margin trading"
            }
          }
        }
      }
    }
  }
}