# oathra.broker_facts/1

```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "oathra.broker_facts/1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schema",
    "broker_profile_id",
    "broker_company",
    "server_name",
    "server_tz_offset_minutes",
    "captured_at",
    "account",
    "symbols",
    "content_hash"
  ],
  "properties": {
    "schema": {
      "const": "oathra.broker_facts/1"
    },
    "broker_profile_id": {
      "type": "string",
      "format": "uuid"
    },
    "broker_company": {
      "type": "string",
      "minLength": 1
    },
    "server_name": {
      "type": "string",
      "minLength": 1
    },
    "server_tz_offset_minutes": {
      "type": [
        "integer",
        "null"
      ]
    },
    "captured_at": {
      "type": "string",
      "format": "date-time"
    },
    "account": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "trading_account_id",
        "currency",
        "leverage",
        "margin_mode"
      ],
      "properties": {
        "trading_account_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "currency": {
          "type": "string",
          "pattern": "^[A-Z]{3,5}$"
        },
        "leverage": {
          "type": [
            "number",
            "null"
          ],
          "exclusiveMinimum": 0
        },
        "margin_mode": {
          "enum": [
            "hedging",
            "netting",
            "exchange",
            null
          ]
        }
      }
    },
    "symbols": {
      "type": "object",
      "minProperties": 1,
      "propertyNames": {
        "pattern": "^[A-Z0-9._#-]{1,40}$"
      },
      "additionalProperties": {
        "$ref": "#/$defs/symbol"
      }
    },
    "content_hash": {
      "type": "string",
      "pattern": "^[0-9a-f]{64}$"
    }
  },
  "$defs": {
    "num": {
      "type": [
        "number",
        "null"
      ]
    },
    "int": {
      "type": [
        "integer",
        "null"
      ]
    },
    "session": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "day",
        "from_s",
        "to_s"
      ],
      "properties": {
        "day": {
          "type": "integer",
          "minimum": 0,
          "maximum": 6
        },
        "from_s": {
          "type": "integer",
          "minimum": 0,
          "maximum": 86400
        },
        "to_s": {
          "type": "integer",
          "minimum": 0,
          "maximum": 86400
        }
      }
    },
    "symbol": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "broker_symbol",
        "description",
        "path",
        "digits",
        "point",
        "tick_size",
        "tick_value",
        "tick_value_profit",
        "tick_value_loss",
        "contract_size",
        "volume_min",
        "volume_step",
        "volume_max",
        "volume_limit",
        "stops_level",
        "freeze_level",
        "trade_mode",
        "trade_calc_mode",
        "filling_mode",
        "expiration_mode",
        "currency_base",
        "currency_profit",
        "currency_margin",
        "swap_mode",
        "swap_long",
        "swap_short",
        "swap_rollover_day",
        "swap_days",
        "margin_initial",
        "margin_maintenance",
        "margin_hedged",
        "spread_points",
        "spread_float",
        "sessions",
        "updated_at"
      ],
      "properties": {
        "broker_symbol": {
          "type": "string",
          "minLength": 1
        },
        "description": {
          "type": [
            "string",
            "null"
          ]
        },
        "path": {
          "type": [
            "string",
            "null"
          ]
        },
        "digits": {
          "type": "integer",
          "minimum": 0,
          "maximum": 12
        },
        "point": {
          "$ref": "#/$defs/num"
        },
        "tick_size": {
          "$ref": "#/$defs/num"
        },
        "tick_value": {
          "$ref": "#/$defs/num"
        },
        "tick_value_profit": {
          "$ref": "#/$defs/num"
        },
        "tick_value_loss": {
          "$ref": "#/$defs/num"
        },
        "contract_size": {
          "$ref": "#/$defs/num"
        },
        "volume_min": {
          "$ref": "#/$defs/num"
        },
        "volume_step": {
          "$ref": "#/$defs/num"
        },
        "volume_max": {
          "$ref": "#/$defs/num"
        },
        "volume_limit": {
          "$ref": "#/$defs/num"
        },
        "stops_level": {
          "$ref": "#/$defs/int"
        },
        "freeze_level": {
          "$ref": "#/$defs/int"
        },
        "trade_mode": {
          "enum": [
            "DISABLED",
            "LONGONLY",
            "SHORTONLY",
            "CLOSEONLY",
            "FULL",
            null
          ]
        },
        "trade_calc_mode": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^[A-Z_]+$"
        },
        "filling_mode": {
          "$ref": "#/$defs/int"
        },
        "expiration_mode": {
          "$ref": "#/$defs/int"
        },
        "currency_base": {
          "type": [
            "string",
            "null"
          ]
        },
        "currency_profit": {
          "type": [
            "string",
            "null"
          ]
        },
        "currency_margin": {
          "type": [
            "string",
            "null"
          ]
        },
        "swap_mode": {
          "enum": [
            "DISABLED",
            "POINTS",
            "CURRENCY_SYMBOL",
            "CURRENCY_MARGIN",
            "CURRENCY_DEPOSIT",
            "INTEREST_CURRENT",
            "INTEREST_OPEN",
            "REOPEN_CURRENT",
            "REOPEN_BID",
            null
          ]
        },
        "swap_long": {
          "$ref": "#/$defs/num"
        },
        "swap_short": {
          "$ref": "#/$defs/num"
        },
        "swap_rollover_day": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0,
          "maximum": 6
        },
        "swap_days": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "type": "array",
              "minItems": 7,
              "maxItems": 7,
              "items": {
                "type": "number"
              }
            }
          ]
        },
        "margin_initial": {
          "$ref": "#/$defs/num"
        },
        "margin_maintenance": {
          "$ref": "#/$defs/num"
        },
        "margin_hedged": {
          "$ref": "#/$defs/num"
        },
        "spread_points": {
          "$ref": "#/$defs/int"
        },
        "spread_float": {
          "type": [
            "boolean",
            "null"
          ]
        },
        "sessions": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "quote",
            "trade"
          ],
          "properties": {
            "quote": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/session"
              }
            },
            "trade": {
              "type": "array",
              "items": {
                "$ref": "#/$defs/session"
              }
            }
          }
        },
        "updated_at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time"
        }
      }
    }
  }
}
```
