{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tradingview/json-schema/tradingview-place-modify-preview-order-common-schema.json",
  "title": "PlaceModifyPreviewOrderCommon",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tradingview-broker-rest-api-openapi.yml#/components/schemas/PlaceModifyPreviewOrderCommon",
  "type": "object",
  "properties": {
    "qty": {
      "description": "The number of units.",
      "type": "number"
    },
    "limitPrice": {
      "description": "Limit Price for Limit or StopLimit order.",
      "type": "number"
    },
    "stopPrice": {
      "description": "Stop Price for Stop or StopLimit order.",
      "type": "number"
    },
    "durationType": {
      "description": "Duration ID (if supported).",
      "type": "string"
    },
    "durationDateTime": {
      "description": "Expiration datetime Unix timestamp (if supported by duration type).",
      "type": "number"
    },
    "stopLoss": {
      "description": "StopLoss price (if supported).",
      "type": "number"
    },
    "trailingStopPips": {
      "description": "Distance from the stop loss level to the current market price in pips (if supported by the broker).",
      "type": "number"
    },
    "guaranteedStop": {
      "description": "Stop price of Guaranteed Stop bracket (if supported).",
      "type": "number"
    },
    "takeProfit": {
      "description": "TakeProfit price (if supported).",
      "type": "number"
    },
    "digitalSignature": {
      "description": "Digital signature (if supported).",
      "type": "string"
    },
    "currentAsk": {
      "description": "Current ask price for the instrument that the user sees in the order panel.",
      "type": "number"
    },
    "currentBid": {
      "description": "Current bid price for the instrument that the user sees in the order panel.",
      "type": "number"
    },
    "instrument": {
      "description": "The instrument name.",
      "type": "string"
    },
    "exitLevels": {
      "type": "array",
      "description": "An array of all the exit levels attached to this parent.",
      "items": {
        "oneOf": [
          {
            "$ref": "#/$defs/ExitLevel"
          },
          {
            "$ref": "#/$defs/PlacedExitLevel"
          }
        ]
      }
    }
  },
  "additionalProperties": false,
  "$defs": {
    "ExitLevel": {
      "title": "Exit Level",
      "type": "object",
      "properties": {
        "qty": {
          "description": "Quantity",
          "type": "number"
        },
        "takeProfit": {
          "description": "Take profit price.",
          "type": "number"
        },
        "stopLoss": {
          "description": "Stop loss price.",
          "type": "number"
        },
        "guaranteedStop": {
          "description": "Guaranteed stop price.",
          "type": "number"
        },
        "trailingStopPips": {
          "description": "Trailing stop distance in pips.",
          "type": "number"
        }
      },
      "required": [
        "qty"
      ],
      "additionalProperties": false
    },
    "PlacedExitLevel": {
      "allOf": [
        {
          "$ref": "#/$defs/ExitLevel"
        },
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "Exit level id"
            }
          },
          "required": [
            "id"
          ]
        }
      ]
    }
  }
}