openapi: 3.0.1
info:
  title: Websocket Prices
  version: 2.10.0
  description: Websocket Prices
  contact:
    name: Tradevest GmbH
    email: hello@tradevest.ai
    url: https://tradevest.ai
servers:
  - url: https://prices-provider.platform-test.tradevest.ai
    description: Test
tags:
  - name: Prices
    description: Prices
paths:
  /websocket/prices:
    get:
      summary: Get Prices
      operationId: websocket-get-prices
      x-operation-group: prices
      x-required-permissions: rs/prices/read
      description: |-
        Get prices from websocket.

        This endpoint will return prices from websocket.
      tags:
        - Prices
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebSocketRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebSocketResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebSocketResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessage'
components:
  schemas:
    WebSocketRequest:
      title: WebSocket Request
      type: object
      required:
        - type
      properties:
        type:
          $ref: '#/components/schemas/WebSocketRequestTypesEnum'
        priceSubscription:
          $ref: '#/components/schemas/WebSocketRequestPriceSubscription'
    WebSocketRequestTypesEnum:
      title: WebSocket Request Types
      type: string
      enum:
        - PRICE_SUBSCRIPTION
    WebSocketResponse:
      title: WebSocket Response
      type: object
      required:
        - type
      properties:
        type:
          $ref: '#/components/schemas/WebSocketResponseTypesEnum'
        prices:
          type: array
          items:
            $ref: '#/components/schemas/WebSocketResponsePrice'
        error:
          type: string
        connectionId:
          type: string
    WebSocketResponseTypesEnum:
      title: WebSocket Response Types
      type: string
      enum:
        - ERROR
        - PRICES
    WebSocketRequestPriceSubscription:
      title: Price Subscription
      type: object
      properties:
        markets:
          type: array
          items:
            $ref: '#/components/schemas/WebSocketPriceMarket'
    WebSocketPriceMarket:
      title: Price Subscription Item
      type: object
      required:
        - currency
      properties:
        currency:
          $ref: '#/components/schemas/CurrencyEnum'
        cryptoSymbol:
          type: string
          description: Digital assets symbol
        symbol:
          type: string
          description: Tokenized asset symbol
    WebSocketResponsePrice:
      title: Price
      type: object
      required:
        - market
        - time
        - asks
        - bids
      properties:
        market:
          $ref: '#/components/schemas/WebSocketPriceMarket'
        time:
          type: string
          format: date-time
        asks:
          type: array
          items:
            $ref: '#/components/schemas/WebSocketResponsePriceItem'
        bids:
          type: array
          items:
            $ref: '#/components/schemas/WebSocketResponsePriceItem'
        previous:
          type: object
          title: Previous Price Item
          properties:
            time:
              type: string
              format: date-time
            ask:
              $ref: '#/components/schemas/WebSocketResponsePriceItem'
            bid:
              $ref: '#/components/schemas/WebSocketResponsePriceItem'
          required:
            - time
            - ask
            - bid
    WebSocketResponsePriceItem:
      title: Price Item
      type: object
      required:
        - price
        - quantity
      properties:
        price:
          type: string
        quantity:
          type: string
    CurrencyEnum:
      title: CurrencyEnum
      type: string
      description: Currency of the product's balance. Currency code in ISO 4217
      enum:
        - EUR
    ErrorDetailsExplanation:
      title: ErrorDetailsExplanation
      type: object
      properties:
        code:
          type: string
          maxLength: 255
        parameter:
          type: string
        message:
          type: string
      required:
        - code
        - message
    ErrorDetails:
      title: ErrorDetails
      type: object
      properties:
        field:
          type: string
          maxLength: 255
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetailsExplanation'
      required:
        - field
    ErrorMessage:
      title: ErrorMessage
      type: object
      properties:
        message:
          type: string
        responseType:
          type: string
        validationString:
          minLength: 1
          type: string
        requestId:
          type: string
        errorCode:
          type: string
          maxLength: 255
        errorDetails:
          type: array
          items:
            $ref: '#/components/schemas/ErrorDetails'
      required:
        - message
        - responseType
        - requestId
x-tagGroups:
  - name: Websocket Prices
    tags:
      - Prices
