---
openapi: 3.0.1
info:
  title: Trading API v4
  description: APIs related to trading operations
  version: v4
paths:
  /frontoffice/api/cfd/v4/stop-orders:
    post:
      tags:
        - CfdStopOrderControllerV
      description: "Required operations: trading-ui"
      parameters:
        - name: accountId
          in: header
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/BBP.TradingServer.TradingApi.Models.CfdStopOrder.v4.ApiCreateCfdStopOrderV4.Request
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/BBP.TradingServer.TradingApi.Models.CfdStopOrder.v4.ApiCreateCfdStopOrderV4.Response
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BBP.Platform.Http.ErrorData'
components:
  schemas:
    BBP.Platform.Http.ErrorData:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        details:
          $ref: '#/components/schemas/BBP.Platform.Http.ErrorData.ErrorDetails'
      additionalProperties: false
    BBP.Platform.Http.ErrorData.ErrorDetails:
      type: object
      properties:
        source:
          type: string
          nullable: true
        message:
          type: string
          nullable: true
        stackTrace:
          type: string
          nullable: true
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.Enums.ApiOrderType:
      enum:
        - Market
        - Limit
      type: string
    BBP.TradingServer.TradingApi.Models.Enums.ApiOrderSide:
      enum:
        - Buy
        - Sell
      type: string
    BBP.TradingServer.TradingApi.Models.Enums.ApiOrderTimeInForce:
      enum:
        - Gtc
        - Ioc
        - Fok
        - Gtd
        - Day
      type: string
    BBP.TradingServer.TradingApi.Models.Enums.ApiStopOrderStatus:
      enum:
        - WaitingForActivation
        - Activated
        - Rejected
      type: string
    BBP.TradingServer.TradingApi.Models.CfdStopOrder.v4.ApiCreateCfdStopOrderV4.Request:
      type: object
      properties:
        order:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.CfdStopOrder.v4.ApiCreateCfdStopOrderV4.CfdStopOrderModelV4
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.CfdStopOrder.v4.ApiCreateCfdStopOrderV4.CfdStopOrderModelV4:
      type: object
      properties:
        marketId:
          type: string
          nullable: true
        orderType:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.Enums.ApiOrderType
        side:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.Enums.ApiOrderSide
        requestedPrice:
          type: string
          nullable: true
        activationPrice:
          type: string
          nullable: true
        requestedLotAmount:
          type: string
          nullable: true
        timeInForce:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.Enums.ApiOrderTimeInForce
        cancellationDate:
          type: string
          nullable: true
        leverage:
          type: integer
          format: int32
          nullable: true
        takeProfit:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.CfdStopOrder.v4.ApiCreateCfdStopOrderV4.CfdStopOrderModelV4.TakeProfitPlaceOrderRequest
        stopLoss:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.CfdStopOrder.v4.ApiCreateCfdStopOrderV4.CfdStopOrderModelV4.StopLossPlaceOrderRequest
        comment:
          type: string
          nullable: true
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.CfdStopOrder.v4.ApiCreateCfdStopOrderV4.CfdStopOrderModelV4.TakeProfitPlaceOrderRequest:
      type: object
      properties:
        price:
          type: string
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.CfdStopOrder.v4.ApiCreateCfdStopOrderV4.CfdStopOrderModelV4.StopLossPlaceOrderRequest:
      type: object
      properties:
        price:
          type: string
        isTrailing:
          type: boolean
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.CfdStopOrder.v4.ApiCreateCfdStopOrderV4.Response:
      required:
        - order
      type: object
      properties:
        order:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.CfdStopOrder.v4.ApiCfdStopOrderResponseModelV4
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.CfdStopOrder.v4.ApiCfdStopOrderResponseModelV4:
      type: object
      properties:
        orderId:
          type: string
        status:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.Enums.ApiStopOrderStatus
      additionalProperties: false
