openapi: 3.0.0
info:
  description: >
    This is the specification of the bLink 'order-placement' module API. (as
    implemented by providers (e.g. financial institutions) and used by SIX) 

    This API is used to place orders and check on the order status.
  version: 2.0.9.4-fi
  title: bLink API - order placement module
  contact:
    name: SIX BBS AG
    url: https://www.six-group.com/en/products-services/banking-services/blink.html
servers:
  - url: >-
      https://api-cert.six-group.com/api/bankingservices/b-link-consent-2/order-placement/v2
paths:
  /orders:
    parameters:
      - $ref: '#/components/parameters/correlation_in_header'
      - $ref: '#/components/parameters/authorization_in_header'
      - $ref: '#/components/parameters/clientid_in_header'
      - $ref: '#/components/parameters/agent_in_header'
      - $ref: '#/components/parameters/optional_targetid_in_header'
      - $ref: '#/components/parameters/optional_psu_ip_in_header'
      - $ref: '#/components/parameters/optional_psu_user_agent_in_header'
    post:
      summary: Posts a new order.
      description: Posts a new order.
      operationId: postOrder
      tags:
        - orderplacement
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/requestedOrder'
      responses:
        '202':
          description: Order accepted for further processing.
          headers:
            X-Correlation-ID:
              $ref: '#/components/headers/X-Correlation-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/order'
        '400':
          $ref: '#/components/responses/standard400'
        '401':
          $ref: '#/components/responses/standard401'
        '403':
          $ref: '#/components/responses/standard403'
        '404':
          $ref: '#/components/responses/standard404'
        '405':
          $ref: '#/components/responses/standard405'
        '500':
          $ref: '#/components/responses/standard500'
        '501':
          $ref: '#/components/responses/standard501'
        '502':
          $ref: '#/components/responses/standard502'
        '503':
          $ref: '#/components/responses/standard503'
        '504':
          $ref: '#/components/responses/standard504'
    get:
      summary: Returns a list of open security orders.
      description: >-
        Returns all open orders to which the user of the API has access to.
        Paging is done based on the order object, i.e. if limit is set to 1,
        then 1 order will be returned per page.
      operationId: getOrders
      tags:
        - orderstatus
      parameters:
        - $ref: '#/components/parameters/cursor'
        - $ref: '#/components/parameters/limit'
      responses:
        '200':
          description: Order list.
          headers:
            X-Correlation-ID:
              $ref: '#/components/headers/X-Correlation-ID'
            X-nextCursor:
              $ref: '#/components/headers/X-nextCursor'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/order'
        '400':
          $ref: '#/components/responses/standard400'
        '401':
          $ref: '#/components/responses/standard401'
        '403':
          $ref: '#/components/responses/standard403'
        '404':
          $ref: '#/components/responses/standard404'
        '405':
          $ref: '#/components/responses/standard405'
        '500':
          $ref: '#/components/responses/standard500'
        '501':
          $ref: '#/components/responses/standard501'
        '502':
          $ref: '#/components/responses/standard502'
        '503':
          $ref: '#/components/responses/standard503'
        '504':
          $ref: '#/components/responses/standard504'
  /orders/{clientOrderId}:
    parameters:
      - name: clientOrderId
        in: path
        required: true
        description: >-
          The security order id. This Id corresponds with the
          clientOrderIdentification.
        schema:
          type: string
          maxLength: 20
      - $ref: '#/components/parameters/correlation_in_header'
      - $ref: '#/components/parameters/authorization_in_header'
      - $ref: '#/components/parameters/clientid_in_header'
      - $ref: '#/components/parameters/agent_in_header'
      - $ref: '#/components/parameters/optional_targetid_in_header'
      - $ref: '#/components/parameters/optional_psu_ip_in_header'
      - $ref: '#/components/parameters/optional_psu_user_agent_in_header'
    get:
      summary: Returns a single security order.
      description: Returns a specific security order.
      operationId: getOrderByClientOrderId
      tags:
        - orderstatus
      responses:
        '200':
          description: >-
            Receive a specific order with the corresponding allocations and
            status.
          headers:
            X-Correlation-ID:
              $ref: '#/components/headers/X-Correlation-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/order'
        '400':
          $ref: '#/components/responses/standard400'
        '401':
          $ref: '#/components/responses/standard401'
        '403':
          $ref: '#/components/responses/standard403'
        '404':
          $ref: '#/components/responses/standard404'
        '405':
          $ref: '#/components/responses/standard405'
        '500':
          $ref: '#/components/responses/standard500'
        '501':
          $ref: '#/components/responses/standard501'
        '502':
          $ref: '#/components/responses/standard502'
        '503':
          $ref: '#/components/responses/standard503'
        '504':
          $ref: '#/components/responses/standard504'
    delete:
      summary: Cancellation of a specific order.
      description: Places the cancellation request for a specific order.
      operationId: deleteOrderByClientOrderId
      tags:
        - orderplacement
      responses:
        '202':
          description: Order cancellation received for further processing.
          headers:
            X-Correlation-ID:
              $ref: '#/components/headers/X-Correlation-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/order'
        '400':
          $ref: '#/components/responses/standard400'
        '401':
          $ref: '#/components/responses/standard401'
        '403':
          $ref: '#/components/responses/standard403'
        '404':
          $ref: '#/components/responses/standard404'
        '405':
          $ref: '#/components/responses/standard405'
        '500':
          $ref: '#/components/responses/standard500'
        '501':
          $ref: '#/components/responses/standard501'
        '502':
          $ref: '#/components/responses/standard502'
        '503':
          $ref: '#/components/responses/standard503'
        '504':
          $ref: '#/components/responses/standard504'
  /accountaccesses:
    parameters:
      - $ref: '#/components/parameters/correlation_in_header'
      - $ref: '#/components/parameters/authorization_in_header'
      - $ref: '#/components/parameters/clientid_in_header'
      - $ref: '#/components/parameters/agent_in_header'
      - $ref: '#/components/parameters/optional_targetid_in_header'
      - $ref: '#/components/parameters/optional_psu_ip_in_header'
      - $ref: '#/components/parameters/optional_psu_user_agent_in_header'
    get:
      summary: Returns list of accounts the requestor has access to.
      description: >-
        Returns list of accounts the requestor has access to with the type of
        access the requestor has. Paging is done based on the accountaccess
        object, i.e. if limit is set to 1, then 1 accountaccess object will be
        returned per page.
      operationId: getAccountAccesses
      tags:
        - accountaccess
      parameters:
        - $ref: '#/components/parameters/cursor'
        - $ref: '#/components/parameters/limit'
      responses:
        '200':
          description: Returns list of accounts the requestor has access to.
          headers:
            X-Correlation-ID:
              $ref: '#/components/headers/X-Correlation-ID'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/accountAccessList'
        '400':
          $ref: '#/components/responses/standard400'
        '401':
          $ref: '#/components/responses/standard401'
        '403':
          $ref: '#/components/responses/standard403'
        '404':
          $ref: '#/components/responses/standard404'
        '405':
          $ref: '#/components/responses/standard405'
        '500':
          $ref: '#/components/responses/standard500'
        '501':
          $ref: '#/components/responses/standard501'
        '502':
          $ref: '#/components/responses/standard502'
        '503':
          $ref: '#/components/responses/standard503'
        '504':
          $ref: '#/components/responses/standard504'
  /healthcheck:
    parameters:
      - $ref: '#/components/parameters/optional_correlation_in_header'
      - $ref: '#/components/parameters/optional_authorization_in_header'
      - $ref: '#/components/parameters/optional_agent_in_header'
      - $ref: '#/components/parameters/optional_targetid_in_header'
      - $ref: '#/components/parameters/clientid_in_header'
      - $ref: '#/components/parameters/optional_psu_ip_in_header'
      - $ref: '#/components/parameters/optional_psu_user_agent_in_header'
    get:
      tags:
        - diagnostics
      summary: >-
        Returns all specified request headers and additional diagnostic
        information
      operationId: healthCheckGet
      responses:
        '200':
          description: Health Check Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/healthCheckResponse'
    post:
      tags:
        - diagnostics
      summary: >-
        Returns all specified request headers, the request body and additional
        diagnostic information
      operationId: healthCheckPost
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: string
      responses:
        '200':
          description: Health Check Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/healthCheckResponse'
components:
  parameters:
    limit:
      name: limit
      in: query
      description: Maximum number of items to return.
      required: false
      schema:
        type: integer
        format: int32
        minimum: 1
    cursor:
      name: cursor
      in: query
      description: An opaque string value used for pagination
      required: false
      schema:
        type: string
    correlation_in_header:
      name: X-Correlation-ID
      in: header
      description: >-
        Unique ID (defined by the caller) which will be reflected back in the
        response.
      required: true
      schema:
        type: string
        maxLength: 64
    optional_correlation_in_header:
      name: X-Correlation-ID
      in: header
      description: >-
        Unique ID (defined by the caller) which will be reflected back in the
        response.
      required: false
      schema:
        type: string
        maxLength: 64
    agent_in_header:
      name: User-Agent
      in: header
      description: Name and version of the of the Client software
      required: true
      schema:
        type: string
    optional_agent_in_header:
      name: User-Agent
      in: header
      description: Name and version of the of the client software
      required: false
      schema:
        type: string
    optional_psu_ip_in_header:
      name: X-PSU-IP-Address
      in: header
      description: 'IP address of the user initiating the operation (SCOPE: FI - optional)'
      required: false
      schema:
        type: string
    optional_psu_user_agent_in_header:
      name: X-PSU-User-Agent
      in: header
      description: 'User of the client software (SCOPE: FI - optional)'
      required: false
      schema:
        type: string
    authorization_in_header:
      name: Authorization
      in: header
      description: Bearer followed by a base64 encoded OAuth access token
      required: true
      schema:
        type: string
    optional_authorization_in_header:
      name: Authorization
      in: header
      description: Bearer followed by a base64 encoded OAuth access token
      required: false
      schema:
        type: string
    optional_targetid_in_header:
      name: X-CorAPI-Target-ID
      in: header
      description: 'ID of the target, e.g., a financial institution. (SCOPE: FI - optional)'
      required: false
      schema:
        type: string
    clientid_in_header:
      name: X-CorAPI-Client-ID
      in: header
      description: 'ID of the client forwarded to the provider. (SCOPE: FI)'
      required: true
      schema:
        type: string
  headers:
    X-Correlation-ID:
      description: >-
        Client defined ID from request to correlates HTTP requests between a
        client and server.
      schema:
        type: string
        maxLength: 64
        example: f058ebd6-02f7-4d3f-942e-904344e8cde5
    Content-Type:
      schema:
        type: string
        description: application/problem+json; charset=utf-8 according to RFC7807
        example: application/problem+json
    Content-Language:
      schema:
        type: string
        description: Response language - always en
        example: en
    WWW-Authenticate:
      description: i.e. "Bearer error='invalid_token'" according to RFC6750 section-3
      schema:
        type: string
    X-nextCursor:
      description: An opaque string value, or an empty string if there are no more results.
      required: false
      schema:
        type: string
  schemas:
    account:
      type: object
      properties:
        identification:
          type: string
          maxLength: 35
          example: '876543219'
          description: Unambiguous identification for the account
        type:
          type: string
          description: Indicates the type of the account.
          example: safekeepingAccount
          enum:
            - cashAccount
            - safekeepingAccount
            - other
    accounts:
      type: array
      description: List of affected cashAccount and safekeepingAccount
      items:
        $ref: '#/components/schemas/account'
    accountAccess:
      type: object
      required:
        - account
        - accessType
      properties:
        account:
          $ref: '#/components/schemas/account'
        accessType:
          type: string
          description: >-
            Indicates what type of access the requestor has for the specified
            account.
          enum:
            - read
            - write
    accountAccessList:
      type: array
      description: List of accountAccess objects
      items:
        $ref: '#/components/schemas/accountAccess'
    accruedInterests:
      type: object
      properties:
        numberDaysAccrued:
          type: number
          format: integer
          example: 28
          description: >-
            Specifies the number of days used for calculating the accrued
            interest amount.
        amount:
          $ref: '#/components/schemas/amount'
        currency:
          $ref: '#/components/schemas/currency'
        creditDebitIndicator:
          $ref: '#/components/schemas/creditDebitIndicator'
        foreignExchangeRate:
          $ref: '#/components/schemas/foreignExchangeRate'
    requestedAllocation:
      type: object
      required:
        - accounts
        - clientAllocationIdentification
        - amount
      properties:
        accounts:
          $ref: '#/components/schemas/accounts'
        clientAllocationIdentification:
          type: string
          description: >-
            Unambiguous identifier for the individual allocation of the bulk
            order, as assigned by the instructing party.
          example: '321321321'
        amount:
          type: string
          pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
          maxLength: 22
          description: Quantity to be allocated to specific safekeeping account
          example: '100'
    allocation:
      required:
        - requestedAllocation
      type: object
      description: >-
        Extended details regarding the allocations including validity of the
        allocation and billing details.
      properties:
        requestedAllocation:
          $ref: '#/components/schemas/requestedAllocation'
        allocationCancellationReasonList:
          $ref: '#/components/schemas/allocationCancellationReasonList'
        remainingAllocation:
          $ref: '#/components/schemas/remainingAllocation'
        completeAllocationList:
          $ref: '#/components/schemas/completeAllocationList'
    allocationCancellationReason:
      type: object
      properties:
        code:
          type: string
          description: Cancelled reason expressed as a code.
          enum:
            - accountIdentificationMissing
            - accountInvalidForOrderPlacement
            - accountTypeMissing
            - accountTypeNotMatchingAccount
            - allocationQuantityTooHigh
            - cashAccountMissing
            - cashAccountNotFound
            - insufficientBuyingPower
            - insufficientQuantityAvailable
            - invalidCurrencyForAccount
            - pretradeCheckFailed
            - safekeepingAccountMissing
            - safekeepingAccountNotFound
            - tooManyCashAccountsIndicated
            - tooManySafekeepingAccounts
            - valueTooHigh
            - zeroQuantity
            - other
          example: zeroQuantity
        proprietary:
          type: string
          description: >-
            Cancelled reason expressed as a proprietary description that
            provides more details about the reason of the cancellation.
    allocationCancellationReasonList:
      type: array
      description: Reasons for cancellation of the allocation.
      items:
        $ref: '#/components/schemas/allocationCancellationReason'
    remainingAllocation:
      type: object
      description: >-
        Provides an overview of what quantity has already been allocated to the
        allocation and what quantity is still outstanding.
      properties:
        executedQuantity:
          $ref: '#/components/schemas/executedQuantity'
        remainingQuantity:
          $ref: '#/components/schemas/remainingQuantity'
    completeAllocation:
      type: object
      description: Completed allocation
      properties:
        allocationIdentification:
          type: string
          description: >-
            Unambiguous identifier of the individual allocation of the bulk
            order , as assigned by the confirming party. Corresponds with the
            transactionIdentification of the OpenWealth Custody Services API.
          example: '123123123'
        executedQuantity:
          $ref: '#/components/schemas/executedQuantity'
        averagePrice:
          $ref: '#/components/schemas/dayAveragePrice'
        bookingDate:
          $ref: '#/components/schemas/bookingDate'
        billingDetails:
          $ref: '#/components/schemas/billingDetails'
    completeAllocationList:
      type: array
      description: List of completed allocations.
      items:
        $ref: '#/components/schemas/completeAllocation'
    bookingDate:
      type: object
      description: Indicates the booking date for an order or allocation.
      properties:
        date:
          $ref: '#/components/schemas/date'
    amount:
      type: string
      pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
      maxLength: 22
      example: '12000'
      description: Absolute amount
    billingDetails:
      type: object
      properties:
        billingAmountList:
          type: array
          items:
            $ref: '#/components/schemas/billingAmount'
        accruedInterests:
          $ref: '#/components/schemas/accruedInterests'
        feesOrTaxList:
          type: array
          items:
            $ref: '#/components/schemas/feeOrTax'
    billingAmount:
      type: object
      properties:
        type:
          type: string
          description: Indicates the type of billing amount.
          example: grossTradeAmount
          enum:
            - grossTradeAmount
            - grossSettlementAmount
            - netSettlementAmount
            - netBillingAmount
        amount:
          $ref: '#/components/schemas/amount'
        currency:
          $ref: '#/components/schemas/currency'
        creditDebitIndicator:
          $ref: '#/components/schemas/creditDebitIndicator'
        foreignExchangeRate:
          $ref: '#/components/schemas/foreignExchangeRate'
    bulkOrderDetails:
      required:
        - side
        - orderQuantity
        - financialInstrumentDetails
        - currency
        - executionType
        - timeInForce
        - numberOfAllocations
      type: object
      properties:
        side:
          type: string
          description: Side taken by a party on an order.
          example: buy
          enum:
            - buy
            - sell
        orderQuantity:
          $ref: '#/components/schemas/orderQuantity'
        displayQuantity:
          $ref: '#/components/schemas/amount'
        numberOfAllocations:
          type: number
          format: integer
          example: 5
          description: >-
            Indicates number of orders to be combined for average pricing and
            allocation.
        financialInstrumentDetails:
          $ref: '#/components/schemas/financialInstrumentDetails'
        placeOfTrade:
          $ref: '#/components/schemas/placeOfTrade'
        currency:
          $ref: '#/components/schemas/currency'
        executionType:
          type: string
          description: Type of the execution of the order
          example: limit
          enum:
            - market
            - limit
            - stop
            - stopLimit
        limitPrice:
          type: string
          pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
          maxLength: 22
          description: Limit price per unit of quantity (e.g. per share)
          example: '12.50'
        stopPrice:
          type: string
          pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
          maxLength: 22
          description: Stop price per unit of quantity (e.g. per share)
          example: '10.05'
        timeInForce:
          type: string
          description: Specifies how long the order remains in effect.
          example: day
          enum:
            - day
            - goodTillCancel
            - atTheOpening
            - immediateOrCancel
            - fillOrKill
            - goodTillCrossing
            - goodTillDate
            - atTheClose
            - goodThroughCrossing
            - atCrossing
            - goodForTime
            - goodForAuction
            - goodForMonth
        expiryDateTime:
          type: string
          format: date-time
          example: '2018-04-13T11:11:11Z'
          description: >-
            Date and time of the order expiration (UTC Timestamp). In accordance
            with ISO 8601.
    order:
      required:
        - extendedOrder
        - orderState
      type: object
      properties:
        statementDateTime:
          $ref: '#/components/schemas/statementDateTime'
        extendedOrder:
          $ref: '#/components/schemas/extendedOrder'
        orderState:
          $ref: '#/components/schemas/orderState'
        dateList:
          $ref: '#/components/schemas/dateList'
    creditDebitIndicator:
      type: string
      enum:
        - credit
        - debit
      example: debit
      description: >-
        Specifies if the amount is a debit (negative) or credit (positive)
        amount.
    currency:
      description: ISO 4217 code
      type: string
      pattern: '[A-Z]{3}'
      example: CHF
    date:
      type: string
      format: date
      description: Date according to ISO 8601 i.e. YYYY-MM-DD format
      example: '2018-04-13'
    dateList:
      type: array
      description: Indicates dates relevant for the respective order
      items:
        $ref: '#/components/schemas/orderDate'
    dayOrderQuantity:
      type: string
      pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
      maxLength: 22
      description: >-
        For GoodTill(GT) orders the orderQuantity less all quantity (adjusted
        for stock splits) that traded on previous days. DayOrderQuantity =
        OrderQuantity - (executedQuantity - dayExecutedQuantity).
      example: '15'
    dayExecutedQuantity:
      type: string
      pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
      maxLength: 22
      description: For GT orders the quantity on a GT order that has traded today.
      example: '5'
    executedQuantity:
      type: string
      pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
      maxLength: 22
      description: Total quantity (e.g. number of shares) filled.
      example: '100'
    extendedOrder:
      required:
        - clientOrderIdentification
        - bulkOrderDetails
      type: object
      description: Order object with extended allocation information.
      properties:
        clientOrderIdentification:
          type: string
          example: '123123123'
          description: >-
            Unambiguous identifier for the bulk order, as assigned by the
            instructing party.
          maxLength: 20
        orderDateTime:
          type: string
          format: date-time
          example: '2018-04-13T11:11:11Z'
          description: >-
            Date and time the order has been received. In accordance with ISO
            8601.
          readOnly: true
        orderIdentification:
          type: string
          description: >-
            Unambiguous identifier for the bulk order, as assigned by the
            confirming party.
          example: '321321321'
          readOnly: true
        bulkOrderDetails:
          $ref: '#/components/schemas/bulkOrderDetails'
        allocationList:
          type: array
          items:
            $ref: '#/components/schemas/allocation'
    feeOrTax:
      type: object
      properties:
        feeType:
          type: string
          description: Indicates the type of fee/tax
          enum:
            - stampDuty
            - withholdingTax
            - capitalGainTax
            - financialTransactionTax
            - otherTaxes
            - transactionFee
            - brokerageFee
            - managementFee
            - courtage
            - custodyFee
            - exchangeFee
            - thirdPartyFee
            - otherFee
            - others
        amount:
          $ref: '#/components/schemas/amount'
        currency:
          $ref: '#/components/schemas/currency'
        creditDebitIndicator:
          $ref: '#/components/schemas/creditDebitIndicator'
        foreignExchangeRate:
          $ref: '#/components/schemas/foreignExchangeRate'
    foreignExchangeRate:
      type: object
      properties:
        sourceCurrency:
          description: Currency of the amount to be converted in a currency conversion.
          type: string
          pattern: '[A-Z]{3}'
          example: CHF
        rate:
          type: string
          pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
          maxLength: 22
          example: '1.0963'
          description: >-
            Indicates the rate of a fx transaction for one source currency unit
            to the target currency. E.g. 1GBP=xxxEUR, where the source currency
            is GBP and the target currency is EUR.
        targetCurrency:
          description: >-
            Currency into which an amount is to be converted in a currency
            conversion.
          type: string
          pattern: '[A-Z]{3}'
          example: CHF
        fxType:
          type: string
          description: >-
            Defines, if the indicated fx rate includes ('costPrice') or excludes
            ('dealPrice') fees and taxes.
          example: costPrice
          enum:
            - costPrice
            - dealPrice
    financialInstrumentDetails:
      type: object
      required:
        - financialInstrumentIdentification
      properties:
        financialInstrumentIdentification:
          type: object
          required:
            - identification
            - type
          properties:
            identification:
              type: string
              example: CH0012005267
              description: Instrument identification
            type:
              type: string
              example: isin
              description: Type of the instrument identification
              enum:
                - isin
                - sedol
                - cusip
                - ric
                - tickerSymbol
                - bloomberg
                - cta
                - quick
                - wertpapier
                - dutch
                - valoren
                - sicovam
                - belgian
                - common
                - otherProprietaryIdentification
    requestedOrder:
      required:
        - clientOrderIdentification
        - bulkOrderDetails
        - requestedAllocationList
      type: object
      properties:
        clientOrderIdentification:
          type: string
          example: '123123123'
          description: >-
            Unambiguous identifier for the bulk order, as assigned by the
            instructing party.
          maxLength: 20
        orderDateTime:
          type: string
          format: date-time
          example: '2018-04-13T11:11:11Z'
          description: >-
            Date and time of the order placement (UTC Timestamp). In accordance
            with ISO 8601.
          readOnly: true
        orderIdentification:
          type: string
          description: >-
            Unambiguous identifier for the bulk order, as assigned by the
            confirming party.
          example: '321321321'
          readOnly: true
        bulkOrderDetails:
          $ref: '#/components/schemas/bulkOrderDetails'
        requestedAllocationList:
          type: array
          items:
            $ref: '#/components/schemas/requestedAllocation'
    orderQuantity:
      type: object
      properties:
        amount:
          type: string
          pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
          maxLength: 22
          example: '300'
        type:
          type: string
          description: Type of the amount
          example: unitsNumber
          enum:
            - unitsNumber
            - nominal
    orderState:
      required:
        - status
        - executedQuantity
        - remainingQuantity
      type: object
      properties:
        status:
          $ref: '#/components/schemas/orderStatus'
        statusDateTime:
          $ref: '#/components/schemas/statusDateTime'
        orderCancellationReasonList:
          $ref: '#/components/schemas/orderCancellationReasonList'
        executedQuantity:
          $ref: '#/components/schemas/executedQuantity'
        remainingQuantity:
          $ref: '#/components/schemas/remainingQuantity'
        averagePrice:
          type: string
          pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
          maxLength: 22
          description: Calculated average price of all fills on this order.
          example: '17.85'
        dayOrderQuantity:
          $ref: '#/components/schemas/dayOrderQuantity'
        dayExecutedQuantity:
          $ref: '#/components/schemas/dayExecutedQuantity'
        dayAveragePrice:
          $ref: '#/components/schemas/dayAveragePrice'
        factor:
          type: string
          pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
          maxLength: 22
          example: '100'
          description: >
            For Fixed Income: Amorization Factor for deriving Current face from
            Original face for ABS or MBS securities, note the fraction may be
            greater than, equal to or less than . In TIPS securities this is the
            Inflation index.

            Qty * Factor * Price = Gross Trade Amount


            For Derivatives: Contract Value Factor by which price must be
            adjusted to determine the true nominal value of one futures/options
            contract.

            (Qty * Price) * Factor = Nominal Value"
        orderStatusHistoryList:
          $ref: '#/components/schemas/orderStatusHistoryList'
    statusDateTime:
      type: string
      format: date-time
      example: '2018-04-13T11:11:11Z'
      description: >-
        Indicates the date and time at which the status has been updated into
        the status indicated under "status" (UTC Timestamp). In accordance with
        ISO 8601.
    orderStatusHistory:
      type: object
      description: Provides the status of the order was at a certain time in its lifecycle.
      properties:
        status:
          $ref: '#/components/schemas/orderStatus'
        statusDateTime:
          $ref: '#/components/schemas/statusDateTime'
    orderStatusHistoryList:
      type: array
      description: >-
        Provides all the status that the order was in at a certain time in its
        lifecycle.
      items:
        $ref: '#/components/schemas/orderStatusHistory'
    orderStatus:
      type: string
      description: Shows in which stage of its life cycle an order is.
      enum:
        - acknowledged
        - accepted
        - customerRelease
        - placed
        - partiallyFilled
        - filled
        - executed
        - cancelled
        - partiallyCancelled
        - marketCancelled
        - pendingCancel
        - rejected
        - partiallyRejected
        - marketRejected
        - expired
        - partiallyExpired
        - marketExpired
      example: partiallyFilled
    dayAveragePrice:
      type: string
      pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
      maxLength: 22
      description: The average price for quantity that has traded today.
      example: '17.8'
    orderDate:
      type: object
      description: Indicates a date with a dateType relevant for the respective order.
      properties:
        date:
          $ref: '#/components/schemas/date'
        dateType:
          type: string
          example: bookingDate
          enum:
            - transactionDate
            - bookingDate
            - valueDate
    orderCancellationReason:
      type: object
      description: Indicates the reason, why an order is invalid/cancelled/rejected
      properties:
        code:
          type: string
          description: Cancelled reason expressed as a code.
          enum:
            - allocationInvalid
            - cancelledByHub
            - cancelledByInstructingParty
            - cancelledByOther
            - cannotContainMarketIdentificationAndMarketDescription
            - currencyNotSupportedForFinancialInstrument
            - displayQuantityNotImplemented
            - endOfLife
            - executionTypeInconsequential
            - executionTypeNotSupported
            - expiryDateTimeInThePast
            - expiryDateTimeMissing
            - expiryDateTimeNotAllowed
            - financialInstrumentIdentificationNotUnique
            - financialInstrumentIdentificationTypeNotSupported
            - financialInstrumentNotAllowedViaInterface
            - financialInstrumentNotFound
            - financialInstrumentNotTradedOnMarket
            - icebergOrderTooLarge
            - invalidPrices
            - limitPriceMissingForExecutionType
            - limitPriceNotAllowedForExecutionType
            - marketCurrentlyBlockedForTrading
            - marketQuoteNotAvailableForProduct
            - maximumNumberOfAllocationsExceeded
            - numberOfAllocationsDeviateFromAllocationsProvided
            - numberOfAllocationsEmpty
            - numberOfAllocationsZero
            - orderQuantityDeviatesFromSumOfAllocationQuantities
            - orderQuantityTooHigh
            - orderQuantityTooSmall
            - orderQuantityTypeNotImplemented
            - orderQuantityTypeWrong
            - orderTypeNotSupportedByMarket
            - placeOfTradeNotImplemented
            - placeOfTradeNotSupported
            - productExpired
            - selectedTimeInForceNotImplemented
            - stopPriceMissingForExecutionType
            - stopPriceNotAllowedForExecutionType
            - timeInForceAndExpiryDateInconsistent
            - valueTooHigh
            - wrongDenomination
            - other
          example: endOfLife
        proprietary:
          type: string
          description: >-
            Cancelled reason expressed as a proprietary description that
            provides more details about the reason of the cancellation.
    orderCancellationReasonList:
      type: array
      description: Indicates the reasons, why an order is invalid/cancelled/rejected
      items:
        $ref: '#/components/schemas/orderCancellationReason'
    placeOfTrade:
      type: object
      description: Market in which a trade transaction is to be or has been executed.
      properties:
        marketIdentificationCode:
          type: string
          maxLength: 4
          description: >-
            Market Identifier Code. Identification of a financial market, as
            stipulated in the norm ISOMarket Identifier Code. Identification of
            a financial market, as stipulated in the norm ISO 10383 "Codes for
            exchanges and market identifications".
          example: XSWX
        marketDescription:
          type: string
          description: >-
            Description of the market when no Market Identification Code is
            available.
          example: OTC
    remainingQuantity:
      type: string
      pattern: '[0-9]{1,12}([.][0-9]{1,9})?'
      maxLength: 22
      description: >-
        Quantity open for further execution. If the status is cancelled, 
        expired, or rejected (in which case the order is no longer active) then
        remainingQuantity could be 0, otherwise remainingQuantity =
        orderQuantity - executedQuantity.
      example: '20'
    statementDateTime:
      type: string
      format: date-time
      example: '2018-04-13T11:11:11Z'
      description: >-
        Date and time of the statement creation (UTC Timestamp). In accordance
        with ISO 8601.
    healthCheckResponse:
      title: Health Check Response
      type: object
      properties:
        requestDateTime:
          title: Request Time
          type: string
          format: date-time
          example: '2018-04-13T11:11:11Z'
        receivedHeaders:
          title: Received Headers
          type: array
          items:
            type: object
            properties:
              headerName:
                type: string
                example: X-Correlation-ID
              headerValue:
                type: string
                description: As received
        receivedPayload:
          title: Received Payload
          type: string
          example: ... as received ...
    commonErrorResponse:
      title: Common Error Response
      type: object
      properties:
        type:
          $ref: '#/components/schemas/commonErrorType'
        title:
          type: string
          example: This is the general problem description
        detail:
          type: string
          example: Detailed problem description with respect to the current request
        instance:
          type: string
          example: path/to/corresponding/resource
    commonErrorType:
      title: Common Error Type
      description: Error Types for commonErrorResponse.
      type: string
      enum:
        - /problems/INVALID_PAYLOAD
        - /problems/MALFORMED_PAYLOAD
        - /problems/INVALID_TOKEN
        - /problems/EXPIRED_TOKEN
        - /problems/INSUFFICIENT_PRIVILEGES
        - /problems/NO_ACCESS_TO_RESOURCE
        - /problems/RESOURCE_DOES_NOT_EXIST
        - /problems/RESOURCE_NOT_READY
        - /problems/RESOURCE_TOO_LARGE
        - /problems/WRONG_METHOD
        - /problems/OPERATION_NOT_ALLOWED
        - /problems/TECHNICAL_ERROR
        - /problems/NOT_IMPLEMENTED
        - /problems/SERVICE_UNAVAILABLE
      example: /problems/TECHNICAL_ERROR
  responses:
    standard400:
      headers:
        Content-Type:
          $ref: '#/components/headers/Content-Type'
        Content-Language:
          $ref: '#/components/headers/Content-Language'
        WWW-Authenticate:
          $ref: '#/components/headers/WWW-Authenticate'
        X-Correlation-ID:
          $ref: '#/components/headers/X-Correlation-ID'
      description: >-
        Bad Request - The server cannot or will not process the request due to
        something that is perceived to be a client error as malformed request
        syntax.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/commonErrorResponse'
    standard401:
      headers:
        Content-Type:
          $ref: '#/components/headers/Content-Type'
        Content-Language:
          $ref: '#/components/headers/Content-Language'
        WWW-Authenticate:
          $ref: '#/components/headers/WWW-Authenticate'
        X-Correlation-ID:
          $ref: '#/components/headers/X-Correlation-ID'
      description: >-
        Unauthorized - The request has not been applied because it lacks valid
        authentication credentials for the target resource.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/commonErrorResponse'
    standard403:
      headers:
        Content-Type:
          $ref: '#/components/headers/Content-Type'
        Content-Language:
          $ref: '#/components/headers/Content-Language'
        WWW-Authenticate:
          $ref: '#/components/headers/WWW-Authenticate'
        X-Correlation-ID:
          $ref: '#/components/headers/X-Correlation-ID'
      description: >-
        Forbidden - The server understood the request but refuses to authorize
        it.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/commonErrorResponse'
    standard404:
      headers:
        Content-Type:
          $ref: '#/components/headers/Content-Type'
        Content-Language:
          $ref: '#/components/headers/Content-Language'
        X-Correlation-ID:
          $ref: '#/components/headers/X-Correlation-ID'
      description: >-
        Not Found - The origin server did not find a current representation for
        the target resource or is not willing to disclose that one exists.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/commonErrorResponse'
    standard405:
      headers:
        Content-Type:
          $ref: '#/components/headers/Content-Type'
        Content-Language:
          $ref: '#/components/headers/Content-Language'
        X-Correlation-ID:
          $ref: '#/components/headers/X-Correlation-ID'
      description: >-
        Method Not Allowed - The method received in the request-line is known by
        the origin server but not supported by the target resource.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/commonErrorResponse'
    standard500:
      headers:
        Content-Type:
          $ref: '#/components/headers/Content-Type'
        Content-Language:
          $ref: '#/components/headers/Content-Language'
        X-Correlation-ID:
          $ref: '#/components/headers/X-Correlation-ID'
      description: >-
        Internal Server Error - The server encountered an unexpected condition
        that prevented it from fulfilling the request.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/commonErrorResponse'
    standard501:
      headers:
        Content-Type:
          $ref: '#/components/headers/Content-Type'
        Content-Language:
          $ref: '#/components/headers/Content-Language'
        X-Correlation-ID:
          $ref: '#/components/headers/X-Correlation-ID'
      description: >-
        Not Implemented - The server does not support the functionality required
        to fulfill the request.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/commonErrorResponse'
    standard502:
      headers:
        Content-Type:
          $ref: '#/components/headers/Content-Type'
        Content-Language:
          $ref: '#/components/headers/Content-Language'
        X-Correlation-ID:
          $ref: '#/components/headers/X-Correlation-ID'
      description: >-
        Bad Gateway - The server received an invalid response from the upstream
        server.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/commonErrorResponse'
    standard503:
      headers:
        Content-Type:
          $ref: '#/components/headers/Content-Type'
        Content-Language:
          $ref: '#/components/headers/Content-Language'
        X-Correlation-ID:
          $ref: '#/components/headers/X-Correlation-ID'
      description: >-
        Service Unavailable - The server is currently unable to handle the
        request due to a temporary overload or scheduled maintenance.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/commonErrorResponse'
    standard504:
      headers:
        Content-Type:
          $ref: '#/components/headers/Content-Type'
        Content-Language:
          $ref: '#/components/headers/Content-Language'
        X-Correlation-ID:
          $ref: '#/components/headers/X-Correlation-ID'
      description: >-
        Gateway Timeout - The server did not get a response in time that it
        needed in order to complete the request.
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/commonErrorResponse'
