openapi: 3.1.0
info:
  title: ETPA XBID Public API
  version: 2.0.0
servers:
  - url: https://acc-trading.etpa.nl
paths:
  /public-api/2.0/xbid/public-trades/{deliveryAreaId}:
    get:
      tags:
        - XBID Public Trades v2
      summary: Get all public XBID trades
      description: >
        Get all public XBID trades. This endpoint can filter and page the
        results.

         **Constraints:**
            - If the system is unavailable, the request will return a `BAD REQUEST` response.`.
      operationId: getRecentTrades
      parameters:
        - name: deliveryAreaId
          in: path
          required: true
          schema:
            type: string
        - name: deliveryDay
          in: query
          required: true
          schema:
            type: string
        - name: deliveryStartTime
          in: query
          required: false
          schema:
            type: string
            format: date-time
        - name: deliveryEndTime
          in: query
          required: false
          schema:
            type: string
            format: date-time
        - name: pageable
          in: query
          required: true
          schema:
            $ref: '#/components/schemas/Pageable'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PagePublicXbidTradeApiQueryResponse'
        '503':
          description: Xbid connection is down or has been disabled
      security:
        - api-key: []
  /public-api/2.0/xbid/public-trades/history:
    get:
      tags:
        - XBID Public Trades v2
      summary: Get Historical public XBID trades
      description: >+
        Retrieve historical public trades within a specified time range.

        This endpoint is suitable when needing historical trade data in within
        controlled time ranges without overloading ETPA's system


        **Constraints:**


        - The difference between `end` and `start` must not exceed 6 hours.


        - If the requested time interval is too wide, an `400 error` will be
        thrown.


        - If the system is unavailable, the request will return a `BAD REQUEST`
        response.

      operationId: getHistoricalTrades
      parameters:
        - name: start
          in: query
          required: true
          schema:
            type: string
            format: date-time
        - name: end
          in: query
          required: true
          schema:
            type: string
            format: date-time
      responses:
        '200':
          description: OK
          content:
            '*/*':
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PublicXbidTradeApiQueryResponse'
        '400':
          description: 'Too much time was requested. Maximum value is: 6 hours.'
        '503':
          description: Xbid connection is down or has been disabled
      security:
        - api-key: []
  /public-api/1.0/xbid/public-trades:
    get:
      tags:
        - XBID Public Trades v1
      summary: Get all public XBID trades
      description: |
        Get all public XBID trades which can be filtered and paged.

          **Constraints:**
            - If no content is found for the provided parameters, the request  will return a `204 No Content`.
            - If the system is unavailable, the request will return a `BAD REQUEST` response.`.
      operationId: getAllXbidTrades
      parameters:
        - name: searchField
          in: query
          required: false
          schema:
            type: string
        - name: searchPattern
          in: query
          required: false
          schema:
            type: string
        - name: pageable
          in: query
          required: true
          schema:
            $ref: '#/components/schemas/Pageable'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PagePublicXbidTradeApiQueryResponse'
        '204':
          description: No content. No result for provided parameters.
        '503':
          description: Xbid connection is down or has been disabled
      security:
        - api-key: []
  /public-api/1.0/xbid/public-trades/recent:
    get:
      tags:
        - XBID Public Trades v1
      summary: Get Recent Public XBID Trades
      description: >
        The recent Public XBID trades API will return all the trades of the last
        2 days.


        **Constraints:**
            - If the system is unavailable, the request will return a `BAD REQUEST` response.
      operationId: getRecentTrades_1
      parameters:
        - name: pageable
          in: query
          required: true
          schema:
            $ref: '#/components/schemas/Pageable'
      responses:
        '503':
          description: Xbid connection is down or has been disabled
        default:
          description: default response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PublicXbidTradeApiQueryResponse'
      security:
        - api-key: []
components:
  schemas:
    Pageable:
      type: object
      properties:
        page:
          type: integer
          format: int32
          minimum: 0
        size:
          type: integer
          format: int32
          minimum: 1
        sort:
          type: array
          items:
            type: string
    DeliveryAreaDto:
      type: object
      properties:
        country:
          type: string
          description: Country code
          enum:
            - DE
            - NL
        eic:
          type: string
          description: Eic code
          enum:
            - 10YDE-VE-------2
            - 10YDE-RWENET---I
            - 10YDE-ENBW-----N
            - 10YDE-EON------1
            - 10YNL----------L
        name:
          type: string
          description: Name
          enum:
            - DE - 50HzT
            - DE - AMP
            - DE - TNG
            - DE - TTG
            - NL - TTN
      required:
        - country
        - eic
        - name
    PagePublicXbidTradeApiQueryResponse:
      type: object
      properties:
        totalPages:
          type: integer
          format: int32
        totalElements:
          type: integer
          format: int64
        pageable:
          $ref: '#/components/schemas/PageableObject'
        size:
          type: integer
          format: int32
        content:
          type: array
          items:
            $ref: '#/components/schemas/PublicXbidTradeApiQueryResponse'
        number:
          type: integer
          format: int32
        sort:
          $ref: '#/components/schemas/SortObject'
        numberOfElements:
          type: integer
          format: int32
        first:
          type: boolean
        last:
          type: boolean
        empty:
          type: boolean
    PageableObject:
      type: object
      properties:
        paged:
          type: boolean
        pageNumber:
          type: integer
          format: int32
        pageSize:
          type: integer
          format: int32
        offset:
          type: integer
          format: int64
        sort:
          $ref: '#/components/schemas/SortObject'
        unpaged:
          type: boolean
    PublicXbidTradeApiQueryResponse:
      type: object
      properties:
        xbidTradeId:
          type: integer
          format: int64
        revisionNo:
          type: integer
          format: int64
        tradeQuantity:
          type: number
        mwhTraded:
          type: number
        tradePrice:
          type: number
        totalPrice:
          type: number
        deliveryStartTime:
          type: string
          format: date-time
        deliveryEndTime:
          type: string
          format: date-time
        contractId:
          type: integer
          format: int64
        executionTime:
          type: string
          format: date-time
        buyDeliveryArea:
          $ref: '#/components/schemas/DeliveryAreaDto'
        sellDeliveryArea:
          $ref: '#/components/schemas/DeliveryAreaDto'
        reverted:
          type: boolean
      required:
        - contractId
        - deliveryEndTime
        - deliveryStartTime
        - executionTime
        - mwhTraded
        - reverted
        - revisionNo
        - totalPrice
        - tradePrice
        - tradeQuantity
        - xbidTradeId
    SortObject:
      type: object
      properties:
        sorted:
          type: boolean
        empty:
          type: boolean
        unsorted:
          type: boolean
  securitySchemes:
    api-key:
      type: apiKey
      name: api_key
      in: header
x-tagGroups:
  - name: XBID Public Trades
    tags:
      - XBID Public Trades v1
      - XBID Public Trades v2
