{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/bloomberg-aim/json-schema/bloomberg-aim-create-order-and-route-request-schema.json",
  "title": "CreateOrderAndRouteRequest",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/bloomberg-aim-orders-api-openapi.yml#/components/schemas/CreateOrderAndRouteRequest",
  "allOf": [
    {
      "$ref": "#/$defs/CreateOrderRequest"
    },
    {
      "type": "object",
      "required": [
        "EMSX_BROKER"
      ],
      "properties": {
        "EMSX_BROKER": {
          "type": "string",
          "description": "Broker code for routing"
        },
        "EMSX_STRATEGY": {
          "type": "string",
          "description": "Broker execution strategy name"
        },
        "EMSX_STRATEGY_PARAMS": {
          "type": "object",
          "description": "Strategy-specific parameters",
          "additionalProperties": true
        },
        "EMSX_EXEC_INSTRUCTIONS": {
          "type": "string",
          "description": "Execution instructions for the broker"
        }
      }
    }
  ],
  "$defs": {
    "CreateOrderRequest": {
      "type": "object",
      "required": [
        "EMSX_TICKER",
        "EMSX_AMOUNT",
        "EMSX_ORDER_TYPE",
        "EMSX_SIDE",
        "EMSX_TIF"
      ],
      "properties": {
        "EMSX_TICKER": {
          "type": "string",
          "description": "Bloomberg security identifier"
        },
        "EMSX_AMOUNT": {
          "type": "integer",
          "description": "Order quantity (number of shares/contracts)"
        },
        "EMSX_ORDER_TYPE": {
          "type": "string",
          "description": "Order type",
          "enum": [
            "MKT",
            "LMT",
            "STP",
            "STP LMT"
          ]
        },
        "EMSX_SIDE": {
          "type": "string",
          "description": "Buy or sell",
          "enum": [
            "BUY",
            "SELL",
            "SHRT"
          ]
        },
        "EMSX_TIF": {
          "type": "string",
          "description": "Time in force",
          "enum": [
            "DAY",
            "GTC",
            "OPG",
            "IOC",
            "FOK",
            "GTD",
            "MOC",
            "LOC"
          ]
        },
        "EMSX_LIMIT_PRICE": {
          "type": "number",
          "description": "Limit price (required for LMT and STP LMT orders)"
        },
        "EMSX_STOP_PRICE": {
          "type": "number",
          "description": "Stop price (required for STP and STP LMT orders)"
        },
        "EMSX_ACCOUNT": {
          "type": "string",
          "description": "Trading account identifier"
        },
        "EMSX_NOTES": {
          "type": "string",
          "description": "Free-text notes attached to the order"
        },
        "EMSX_HAND_INSTRUCTION": {
          "type": "string",
          "description": "Handling instruction",
          "enum": [
            "ANY",
            "DIR",
            "FCM"
          ]
        },
        "EMSX_BASKET_NAME": {
          "type": "string",
          "description": "Name of the basket this order belongs to"
        },
        "EMSX_CFD_FLAG": {
          "type": "string",
          "description": "Contract for difference flag",
          "enum": [
            "Y",
            "N"
          ]
        },
        "EMSX_CUSTOM_NOTE1": {
          "type": "string"
        },
        "EMSX_CUSTOM_NOTE2": {
          "type": "string"
        },
        "EMSX_CUSTOM_NOTE3": {
          "type": "string"
        },
        "EMSX_CUSTOM_NOTE4": {
          "type": "string"
        },
        "EMSX_CUSTOM_NOTE5": {
          "type": "string"
        },
        "EMSX_GTD_DATE": {
          "type": "string",
          "description": "Good-till-date in YYYYMMDD format"
        },
        "EMSX_INVESTOR_ID": {
          "type": "string",
          "description": "Investor identifier for allocation"
        },
        "EMSX_LOCATE_BROKER": {
          "type": "string",
          "description": "Locate broker for short sells"
        },
        "EMSX_LOCATE_ID": {
          "type": "string",
          "description": "Locate ID for short sells"
        },
        "EMSX_PORTFOLIO": {
          "type": "string",
          "description": "Portfolio name for the order"
        }
      }
    }
  }
}