{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/clearstreet8e71/main/json-schema/clearstreet8e71-account-balances-schema.json",
  "title": "AccountBalances",
  "description": "Represents the balance details for a trading account",
  "x-generated": "2026-10-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/clearstreet8e71-openapi.yaml#/components/schemas/AccountBalances",
  "type": "object",
  "required": [
    "account_id",
    "buying_power",
    "currency",
    "equity",
    "long_market_value",
    "settled_cash",
    "withdrawable_cash",
    "trade_cash",
    "open_order_adjustment",
    "unsettled_credits",
    "unsettled_debits",
    "margin_type",
    "unrealized_pnl",
    "daily_unrealized_pnl",
    "daily_pnl",
    "daily_change",
    "daily_realized_pnl",
    "sod"
  ],
  "properties": {
    "account_id": {
      "$ref": "#/$defs/i64",
      "description": "The unique identifier for the account"
    },
    "buying_power": {
      "type": "string",
      "description": "The total buying power available in the account: base buying power plus\nthe open order adjustment, where base buying power is maintenance margin\nexcess times the multiplier for intraday and initial margin excess times\nthe multiplier for overnight."
    },
    "currency": {
      "type": "string",
      "description": "Currency identifier for all monetary values."
    },
    "daily_change": {
      "type": "string",
      "description": "Difference between current equity and start-of-day equity."
    },
    "daily_pnl": {
      "type": "string",
      "description": "Total profit or loss since start of day."
    },
    "daily_realized_pnl": {
      "type": "string",
      "description": "Realized profit or loss since start of day."
    },
    "daily_unrealized_pnl": {
      "type": "string",
      "description": "Total unrealized profit or loss across all positions relative to prior close."
    },
    "equity": {
      "type": "string",
      "description": "The total equity in the account: cash plus long market value plus short\nmarket value, where short market value is negative."
    },
    "long_market_value": {
      "type": "string",
      "description": "The total market value of all long positions."
    },
    "margin_details": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/$defs/MarginDetails",
          "description": "Margin-account-only details.\nWhen a null/undefined value is observed, it indicates it does not apply."
        }
      ]
    },
    "margin_type": {
      "$ref": "#/$defs/MarginType",
      "description": "The applicable margin model for the account"
    },
    "multiplier": {
      "type": [
        "string",
        "null"
      ],
      "description": "Margin multiplier: 4 during intraday sessions (pre-market, regular, and\nafter-hours) and 2 during the overnight session.\nWhen a null/undefined value is observed, it indicates it does not apply."
    },
    "open_order_adjustment": {
      "type": "string",
      "description": "Buying power correction from open orders, computed as projected buying\npower minus actual buying power. A negative value means open orders are\nconsuming buying power."
    },
    "settled_cash": {
      "type": "string",
      "description": "The amount of cash that is settled and available for withdrawal or trading."
    },
    "short_market_value": {
      "type": [
        "string",
        "null"
      ],
      "description": "The total market value of all short positions.\nWhen null/undefined, the value should be assumed to be zero. The field is omitted to simplify the response."
    },
    "sod": {
      "$ref": "#/$defs/AccountBalancesSod",
      "description": "Start-of-day snapshot balances."
    },
    "trade_cash": {
      "type": "string",
      "description": "Trade-date effective cash."
    },
    "unrealized_pnl": {
      "type": "string",
      "description": "Total unrealized profit or loss across all open positions."
    },
    "unsettled_credits": {
      "type": "string",
      "description": "Trade-date unsettled cash credits."
    },
    "unsettled_debits": {
      "type": "string",
      "description": "Trade-date unsettled cash debits."
    },
    "withdrawable_cash": {
      "type": "string",
      "description": "The amount of cash currently available to withdraw."
    }
  },
  "$defs": {
    "AccountBalancesSod": {
      "type": "object",
      "required": [
        "buying_power",
        "equity",
        "long_market_value",
        "short_market_value"
      ],
      "properties": {
        "asof": {
          "type": [
            "string",
            "null"
          ],
          "format": "date",
          "description": "Timestamp for the start-of-day values.\nWhen a null/undefined value is observed, it indicates that there is no available data."
        },
        "buying_power": {
          "type": "string",
          "description": "Start-of-day buying power."
        },
        "equity": {
          "type": "string",
          "description": "Start-of-day equity."
        },
        "long_market_value": {
          "type": "string",
          "description": "Start-of-day long market value."
        },
        "maintenance_margin_excess": {
          "type": [
            "string",
            "null"
          ],
          "description": "Start-of-day maintenance margin excess: the difference between equity\nand the maintenance margin requirement.\nWhen a null/undefined value is observed, it indicates it does not apply."
        },
        "maintenance_margin_requirement": {
          "type": [
            "string",
            "null"
          ],
          "description": "Start-of-day maintenance margin requirement: the amount of equity\nrequired to maintain current positions.\nWhen a null/undefined value is observed, it indicates it does not apply."
        },
        "short_market_value": {
          "type": "string",
          "description": "Start-of-day short market value."
        },
        "trade_cash": {
          "type": [
            "string",
            "null"
          ],
          "description": "Start-of-day trade cash.\nWhen a null/undefined value is observed, it indicates it does not apply."
        }
      }
    },
    "MarginDetails": {
      "type": "object",
      "required": [
        "intraday_details",
        "overnight_details",
        "maintenance_margin_requirement",
        "maintenance_margin_excess",
        "initial_margin_requirement",
        "initial_margin_excess"
      ],
      "properties": {
        "initial_margin_excess": {
          "type": "string",
          "description": "The difference between equity and the initial margin requirement."
        },
        "initial_margin_requirement": {
          "type": "string",
          "description": "The amount of equity required to open new positions."
        },
        "intraday_details": {
          "$ref": "#/$defs/MarginSessionDetails",
          "description": "Intraday session margin calculation details."
        },
        "maintenance_margin_excess": {
          "type": "string",
          "description": "The difference between equity and the maintenance margin requirement."
        },
        "maintenance_margin_requirement": {
          "type": "string",
          "description": "The amount of equity required to maintain current positions."
        },
        "overnight_details": {
          "$ref": "#/$defs/MarginSessionDetails",
          "description": "Overnight session margin calculation details."
        },
        "top_contributors": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/MarginTopContributor"
          },
          "description": "Optional top margin contributors, returned only when explicitly requested."
        },
        "usage": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/$defs/MarginDetailsUsage",
              "description": "Current usage totals.\nWhen a null/undefined value is observed, it indicates that there is no available data."
            }
          ]
        }
      }
    },
    "MarginDetailsUsage": {
      "type": "object",
      "required": [
        "used",
        "total"
      ],
      "properties": {
        "total": {
          "type": "string",
          "description": "The total margin available in the current model."
        },
        "used": {
          "type": "string",
          "description": "The amount of margin that is currently being utilized."
        }
      }
    },
    "MarginSessionDetails": {
      "type": "object",
      "required": [
        "buying_power"
      ],
      "properties": {
        "buying_power": {
          "type": "string",
          "description": "Maximum buying power available in the account during the session: base\nbuying power plus the open order adjustment, where base buying power is\nmaintenance margin excess times the multiplier for intraday and initial\nmargin excess times the multiplier for overnight."
        },
        "multiplier": {
          "type": [
            "string",
            "null"
          ],
          "description": "Margin multiplier for the session: 4 during intraday sessions\n(pre-market, regular, and after-hours) and 2 during the overnight\nsession."
        }
      }
    },
    "MarginTopContributor": {
      "type": "object",
      "required": [
        "underlying_instrument_id",
        "initial_margin_requirement",
        "maintenance_margin_requirement",
        "market_value"
      ],
      "properties": {
        "initial_margin_requirement": {
          "type": "string",
          "description": "Initial margin requirement attributable to this underlying."
        },
        "maintenance_margin_requirement": {
          "type": "string",
          "description": "Maintenance margin requirement attributable to this underlying."
        },
        "market_value": {
          "type": "string",
          "description": "Net market value attributable to this underlying."
        },
        "underlying_instrument_id": {
          "type": "string",
          "format": "uuid",
          "description": "UUID of the underlying security contributing to margin requirement."
        }
      }
    },
    "MarginType": {
      "type": "string",
      "description": "An account's margin type",
      "enum": [
        "OTHER",
        "NONE",
        "PORTFOLIO_MARGIN",
        "RISK_BASED_HAIRCUT_BROKER_DEALER",
        "REG_T",
        "RISK_BASED_HAIRCUT_MARKET_MAKER",
        "CIRO",
        "FUTURES_NLV",
        "FUTURES_TOT_EQ"
      ]
    },
    "i64": {
      "type": "integer",
      "format": "int64"
    }
  }
}