---
openapi: 3.0.1
info:
  title: Trading API v3
  description: APIs related to trading operations
  version: v3
paths:
  /frontoffice/api/v3/stop-orders:
    post:
      tags:
        - StopOrderControllerV
      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.StopOrder.v3.ApiCreateStopOrderV3.Request
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/BBP.TradingServer.TradingApi.Models.StopOrder.v3.ApiCreateStopOrderV3.Response
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BBP.Platform.Http.ErrorData'
  /frontoffice/api/v3/stop-orders/{stopOrderId}:
    delete:
      tags:
        - StopOrderControllerV
      description: "Required operations: trading-ui"
      parameters:
        - name: stopOrderId
          in: path
          required: true
          schema:
            type: string
        - name: accountId
          in: header
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/BBP.TradingServer.TradingApi.Models.StopOrder.v3.ApiCancelStopOrderV3.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.StopOrder.v3.ApiCreateStopOrderV3.Request:
      type: object
      properties:
        order:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.StopOrder.v3.ApiCreateStopOrderV3.StopOrderModelV3
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.StopOrder.v3.ApiCreateStopOrderV3.StopOrderModelV3:
      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
        requestedAmount:
          type: string
          nullable: true
        timeInForce:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.Enums.ApiOrderTimeInForce
        cancellationDate:
          type: string
          nullable: true
        comment:
          type: string
          nullable: true
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.StopOrder.v3.ApiCreateStopOrderV3.Response:
      required:
        - order
      type: object
      properties:
        order:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.StopOrder.v3.ApiStopOrderResponseModelV3
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.StopOrder.v3.ApiStopOrderResponseModelV3:
      required:
        - marketDisplayName
        - marketId
        - orderId
      type: object
      properties:
        marketId:
          minLength: 1
          type: string
        marketDisplayName:
          minLength: 1
          type: string
        orderId:
          minLength: 1
          type: string
        orderType:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.Enums.ApiOrderType
        side:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.Enums.ApiOrderSide
        requestedPrice:
          type: string
        activationPrice:
          type: string
        requestedAmount:
          type: string
        timeInForce:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.Enums.ApiOrderTimeInForce
        status:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.Enums.ApiStopOrderStatus
        createdAt:
          type: string
          format: date-time
          nullable: true
        updatedAt:
          type: string
          format: date-time
          nullable: true
        cancellationDate:
          type: string
          format: date-time
          nullable: true
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.StopOrder.v3.ApiCancelStopOrderV3.Response:
      required:
        - order
      type: object
      properties:
        order:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.StopOrder.v3.ApiStopOrderResponseModelV3
      additionalProperties: false
