---
openapi: 3.0.1
info:
  title: Trading API v4
  description: APIs related to trading operations
  version: v4
paths:
  /frontoffice/api/v4/markets:
    get:
      tags:
        - MarketControllerV
      description: "Required operations: trading-ui"
      parameters:
        - name: categoryId
          in: query
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: >-
                    #/components/schemas/BBP.TradingServer.TradingApi.Models.Market.v4.MarketResponseV4
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BBP.Platform.Http.ErrorData'
  /frontoffice/api/v4/markets/{marketId}:
    get:
      tags:
        - MarketControllerV
      description: "Required operations: trading-ui"
      parameters:
        - name: marketId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/BBP.TradingServer.TradingApi.Models.Market.v4.ApiMarketDetailsV4.Response
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BBP.Platform.Http.ErrorData'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BBP.Platform.Http.ErrorData'
        '404':
          description: Not Found
          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.ApiMarketType:
      enum:
        - Spot
        - Cfd
        - Perpetual
      type: string
    BBP.TradingServer.TradingApi.Models.Enums.ApiMarketSubtype:
      enum:
        - Cash
        - Crypto
        - CryptoCash
        - Fx
        - Metals
        - Indices
        - Energies
        - Ndf
        - Shares
        - Etf
      type: string
    BBP.TradingServer.TradingApi.Models.Enums.ApiDayOfWeek:
      enum:
        - Monday
        - Tuesday
        - Wednesday
        - Thursday
        - Friday
        - Saturday
        - Sunday
      type: string
    BBP.TradingServer.TradingApi.Models.Market.v4.ApiMarketDetailsV4.ApiSwapType:
      enum:
        - FixPerLot
        - Percent
        - Points
      type: string
    BBP.TradingServer.TradingApi.Models.Market.v4.MarketResponseV4:
      required:
        - displayName
        - marketId
        - type
      type: object
      properties:
        marketId:
          minLength: 1
          type: string
        displayName:
          minLength: 1
          type: string
        fullName:
          type: string
        type:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.Enums.ApiMarketType
        subtype:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.Enums.ApiMarketSubtype
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.Market.v4.ApiMarketDetailsV4.Response:
      required:
        - baseAssetId
        - displayName
        - marketId
        - quoteAssetId
      type: object
      properties:
        marketId:
          minLength: 1
          type: string
        displayName:
          minLength: 1
          type: string
        fullName:
          type: string
          nullable: true
        baseAssetId:
          minLength: 1
          type: string
        quoteAssetId:
          minLength: 1
          type: string
        minAmount:
          type: string
          nullable: true
        maxBaseAmount:
          type: string
          nullable: true
        priceDeviation:
          type: string
        priceScale:
          type: integer
          format: int32
        amountScale:
          type: integer
          format: int32
          nullable: true
        type:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.Enums.ApiMarketType
        subtype:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.Enums.ApiMarketSubtype
        swapSettings:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.Market.v4.ApiMarketDetailsV4.ApiSwapSettings
        lotSize:
          type: integer
          format: int32
          nullable: true
        minLotAmount:
          type: string
          nullable: true
        maxLotAmount:
          type: integer
          format: int32
          nullable: true
        tickSize:
          type: string
          nullable: true
        lotStep:
          type: string
          nullable: true
        slippageRate:
          type: string
        maxLeverage:
          type: integer
          format: int32
          nullable: true
        isConstLeverage:
          type: boolean
          nullable: true
        calendar:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.Market.v4.ApiMarketDetailsV4.ApiCalendar
        fundingStartTime:
          type: string
          format: time
          nullable: true
        fundingIntervalInHours:
          type: integer
          format: int32
          nullable: true
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.Market.v4.ApiMarketDetailsV4.ApiSwapSettings:
      type: object
      properties:
        type:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.Market.v4.ApiMarketDetailsV4.ApiSwapType
        shortPositionSettings:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.Market.v4.ApiMarketDetailsV4.ApiSwapPositionSettings
        longPositionSettings:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.Market.v4.ApiMarketDetailsV4.ApiSwapPositionSettings
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.Market.v4.ApiMarketDetailsV4.ApiSwapPositionSettings:
      type: object
      properties:
        size:
          type: string
        assetId:
          type: string
          nullable: true
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.Market.v4.ApiMarketDetailsV4.ApiCalendar:
      type: object
      properties:
        timeZoneId:
          type: string
        tradingSessions:
          type: array
          items:
            $ref: >-
              #/components/schemas/BBP.TradingServer.TradingApi.Models.Market.v4.ApiMarketDetailsV4.ApiTradingSession
        sessionOverrides:
          type: array
          items:
            $ref: >-
              #/components/schemas/BBP.TradingServer.TradingApi.Models.Market.v4.ApiMarketDetailsV4.ApiSessionOverride
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.Market.v4.ApiMarketDetailsV4.ApiTradingSession:
      type: object
      properties:
        dayOfWeek:
          $ref: >-
            #/components/schemas/BBP.TradingServer.TradingApi.Models.Enums.ApiDayOfWeek
        timeIntervals:
          type: array
          items:
            $ref: >-
              #/components/schemas/BBP.TradingServer.TradingApi.Models.Market.v4.ApiMarketDetailsV4.ApiTimeInterval
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.Market.v4.ApiMarketDetailsV4.ApiTimeInterval:
      type: object
      properties:
        start:
          type: string
          format: time
        end:
          type: string
          format: time
      additionalProperties: false
    BBP.TradingServer.TradingApi.Models.Market.v4.ApiMarketDetailsV4.ApiSessionOverride:
      type: object
      properties:
        date:
          type: string
          format: date
        timeIntervals:
          type: array
          items:
            $ref: >-
              #/components/schemas/BBP.TradingServer.TradingApi.Models.Market.v4.ApiMarketDetailsV4.ApiTimeInterval
          nullable: true
      additionalProperties: false
