{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/farmdash/json-schema/farmdash-account-state-response-schema.json",
  "title": "AccountStateResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/farmdash-account-api-openapi.yml#/components/schemas/AccountStateResponse",
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean"
    },
    "account": {
      "$ref": "#/$defs/AccountSummary"
    },
    "positions": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/FuturesPosition"
      }
    },
    "risk": {
      "$ref": "#/$defs/RiskState"
    },
    "guardrails": {
      "$ref": "#/$defs/Guardrails"
    },
    "timestamp": {
      "type": "integer"
    },
    "warnings": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/DustStormWarning"
      }
    }
  },
  "$defs": {
    "AccountSummary": {
      "type": "object",
      "properties": {
        "equity": {
          "type": "string"
        },
        "totalNotionalPosition": {
          "type": "string"
        },
        "marginUsed": {
          "type": "string"
        },
        "availableMargin": {
          "type": "string"
        },
        "aggregateLeverage": {
          "type": "string"
        }
      }
    },
    "DustStormWarning": {
      "type": "object",
      "required": [
        "kind",
        "message"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "const": "dust_storm"
        },
        "message": {
          "type": "string"
        }
      }
    },
    "FuturesPosition": {
      "type": "object",
      "properties": {
        "coin": {
          "type": "string"
        },
        "size": {
          "type": "number"
        },
        "side": {
          "type": "string",
          "enum": [
            "long",
            "short"
          ]
        },
        "entryPrice": {
          "type": "number"
        },
        "markPrice": {
          "type": "number"
        },
        "unrealizedPnl": {
          "type": "number"
        },
        "returnOnEquity": {
          "type": "number"
        },
        "leverage": {
          "type": "number"
        },
        "leverageType": {
          "type": "string"
        },
        "liquidationPrice": {
          "type": [
            "number",
            "null"
          ]
        },
        "marginUsed": {
          "type": "number"
        }
      }
    },
    "Guardrails": {
      "type": "object",
      "properties": {
        "maxLeverage": {
          "type": "integer"
        },
        "maxRiskPerTrade": {
          "type": "string"
        },
        "maxPositions": {
          "type": "integer"
        },
        "dailyLossLimit": {
          "type": "string"
        },
        "weeklyLossLimit": {
          "type": "string"
        },
        "maxDrawdown": {
          "type": "string"
        }
      }
    },
    "RiskState": {
      "type": "object",
      "properties": {
        "dailyPnl": {
          "type": "string"
        },
        "dailyPnlPct": {
          "type": "string"
        },
        "weeklyPnl": {
          "type": "string"
        },
        "realizedDailyPnl": {
          "type": "string"
        },
        "realizedWeeklyPnl": {
          "type": "string"
        },
        "unrealizedPnl": {
          "type": "string"
        },
        "pnlSource": {
          "type": "string",
          "enum": [
            "hyperliquid_venue_loss_pressure"
          ]
        },
        "pnlAsOf": {
          "type": "integer",
          "format": "int64"
        },
        "pnlMethodology": {
          "type": "string"
        },
        "drawdown": {
          "type": "string"
        },
        "peakEquity": {
          "type": "string"
        },
        "isTradingHalted": {
          "type": "boolean"
        },
        "haltReason": {
          "type": [
            "string",
            "null"
          ]
        },
        "isReducedSize": {
          "type": "boolean"
        },
        "openPositionCount": {
          "type": "integer"
        }
      }
    }
  }
}