{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "tradecat-auto-paper-execution-cost-model.schema.json",
  "title": "TradeCat Auto Paper Execution Cost Model",
  "type": "object",
  "required": ["schema", "schema_version", "symbol", "side", "action", "fee_bps", "safety", "provenance"],
  "properties": {
    "schema": {
      "const": "tradecat_auto.paper_execution_cost_model.v1"
    },
    "schema_version": {
      "const": "1.0.0"
    },
    "ok": {
      "type": "boolean"
    },
    "error_code": {
      "type": ["string", "null"]
    },
    "symbol": {
      "type": "string"
    },
    "side": {
      "enum": ["LONG", "SHORT", ""]
    },
    "action": {
      "enum": ["OPEN", "CLOSE"]
    },
    "liquidity_role": {
      "enum": ["taker"]
    },
    "book_side": {
      "enum": ["asks", "bids"]
    },
    "requested_notional_usdt": {
      "type": ["number", "null"]
    },
    "fee_bps": {
      "type": "number",
      "minimum": 0
    },
    "maker_fee_bps": {
      "type": "number",
      "minimum": 0
    },
    "taker_fee_bps": {
      "type": "number",
      "minimum": 0
    },
    "fee_model": {
      "type": "string"
    },
    "price_source": {
      "type": "string"
    },
    "best_bid": {
      "type": ["number", "null"]
    },
    "best_ask": {
      "type": ["number", "null"]
    },
    "mid_price": {
      "type": ["number", "null"]
    },
    "spread_bps": {
      "type": ["number", "null"]
    },
    "estimated_fill_price": {
      "type": ["number", "null"]
    },
    "estimated_quantity": {
      "type": ["number", "null"]
    },
    "estimated_notional_usdt": {
      "type": ["number", "null"]
    },
    "slippage_bps_vs_mid": {
      "type": ["number", "null"]
    },
    "depth_impact_bps_over_best": {
      "type": ["number", "null"]
    },
    "fill_price_includes_slippage": {
      "type": "boolean"
    },
    "depth_estimated": {
      "type": "boolean"
    },
    "provenance": {
      "type": "object"
    },
    "safety": {
      "type": "object",
      "required": ["public_readonly_market_data", "public_readonly", "paper_or_watch_only", "real_orders", "signed_requests", "reads_api_keys", "binance_account_state"],
      "properties": {
        "public_readonly_market_data": {
          "const": true
        },
        "public_readonly": {
          "const": true
        },
        "paper_or_watch_only": {
          "const": true
        },
        "real_orders": {
          "const": false
        },
        "signed_requests": {
          "const": false
        },
        "reads_api_keys": {
          "const": false
        },
        "binance_account_state": {
          "const": false
        }
      }
    },
    "limitations": {
      "type": "array",
      "items": {
        "type": "string"
      }
    }
  },
  "additionalProperties": true
}
