{
  "asyncapi": "3.0.0",
  "info": {
    "title": "XMtrade ISOT - IDM trading Websocket API",
    "version": "1.1.0",
    "description": "The WebSocket API allows clients to subscribe to various topics via _topics_ query parameter. Clients can receive updates for multiple topics in a single connection or establish separate connections for each topic. We advise to subscribe only to necessary topics, to lower the risk of disconnection due to message processing delays. \n\n### Supported topics:\n- _orders_: Updates on the client's own orders.\n- _orderbook_: Snapshot and live updates of the orderbook.\n- _hubtohub_: Updates on available transfer capacities.\n- _marketstatus_: Updates on market trading status.\n\nThe _orderbookfrequency_ query parameter lets clients control the frequency of orderbook updates to manage processing load or reduce update intervals when real-time changes are not required. Parameter specifies the minimum interval between orderbook updates. However, the actual time between messages may vary based on market events and system configuration.\n\n### URL example\n```\nwss://isot.okte.sk/api/v1/idm/ws?topics=orders,orderbook,hubtohub,marketstatus&orderbookfrequency=500\n```\n\n## Message Format\nEach message follows a standardized JSON structure with root-level properties:\n- _type_: Specifies the type of message (e.g., _order-creat_, _orderbook-change_).\n- _payload_: Contains the data relevant to the message type.\n\n## Rate Limiting\nRate limiting is applied to prevent excessive requests. If a client exceeds the limit, the server may reject the request with a message of type _ratelimit-error_. This message includes:\n- Policy Information: For example, _50;w=10_ (50 requests allowed per 10 seconds).\n- Reset Time: Time until the request counter resets, in seconds.\n\n## Disconnection Reasons\nThe server may disconnect the client for the following reasons\n- Message Processing Delays: The client fails to process messages in a timely manner.\n- Invalid Message Type: The client sends an unrecognized or incorrect message type.\n- Planned Maintenance: A scheduled service downtime.\nIn all cases, the WebSocket protocol's close message will include the reason for disconnection.\n\n## Connection Health (Ping/Pong)\nThe server and client can verify connection health using ping and pong messages.\n- Either side can send a ping message at any time. \n- The client is not required to send ping messages.\n- The recipient must respond with a pong message to confirm the connection is still active. If no response is received within 5 seconds, the WebSocket connection will be terminated by the server.\n- Message format: _{ \"type\": \"ping\" }_\n\n## Authentication\nTo access the intraday market trading API, clients must have:\n- A valid account in XMtrade®/ISOT.\n- A valid agreement for short term market trading.\n- A configured client certificate.\n\nThe WebSocket connections use a combination of:\n- Basic Authentication: Username and password provided in the Authorization header.\n- Client Certificate: A handshake is initiated by the server to validate the certificate.\n\nIf connectivity issues occur during the client certificate handshake, try using port 8443 (e.g. _wss://isot.okte.sk:8443/api/v1/idm/ws_).\n",
    "contact": {
      "email": "support.is@sfera.sk"
    },
    "externalDocs": {
      "url": "https://okte.sk/en/api-documentation/intraday-market-trading/introduction/"
    }
  },
  "servers": {
    "test": {
      "host": "test-isot.okte.sk/api/v1/idm/ws",
      "protocol": "wss",
      "description": "Test environment",
      "security": [
        {
          "$ref": "#/components/securitySchemes/basicAuth"
        },
        {
          "$ref": "#/components/securitySchemes/clientCertAuth"
        }
      ]
    },
    "sandbox": {
      "host": "sandbox-isot.okte.sk/api/v1/idm/ws",
      "protocol": "wss",
      "description": "Sandbox environment - replica of the of production environment",
      "security": [
        {
          "$ref": "#/components/securitySchemes/basicAuth"
        },
        {
          "$ref": "#/components/securitySchemes/clientCertAuth"
        }
      ]
    },
    "production": {
      "host": "isot.okte.sk/api/v1/idm/ws",
      "protocol": "wss",
      "description": "Production environment",
      "security": [
        {
          "$ref": "#/components/securitySchemes/basicAuth"
        },
        {
          "$ref": "#/components/securitySchemes/clientCertAuth"
        }
      ]
    }
  },
  "channels": {
    "idmTrading": {
      "address": "/",
      "messages": {
        "orderbook-snapshot": {
          "$ref": "#/components/messages/orderbook-snapshot"
        },
        "orderbook-snapshot-request": {
          "$ref": "#/components/messages/orderbook-snapshot-request"
        },
        "orderbook-change": {
          "$ref": "#/components/messages/orderbook-change"
        },
        "order-create": {
          "$ref": "#/components/messages/order-create"
        },
        "order-operation": {
          "$ref": "#/components/messages/order-operation"
        },
        "order-modify": {
          "$ref": "#/components/messages/order-modify"
        },
        "order-change": {
          "$ref": "#/components/messages/order-change"
        },
        "order-error": {
          "$ref": "#/components/messages/order-error"
        },
        "order-list-request": {
          "$ref": "#/components/messages/order-list-request"
        },
        "order-list": {
          "$ref": "#/components/messages/order-list"
        },
        "order-detail-request": {
          "$ref": "#/components/messages/order-detail-request"
        },
        "order-detail": {
          "$ref": "#/components/messages/order-detail"
        },
        "hubtohub-snapshot": {
          "$ref": "#/components/messages/hubtohub-snapshot"
        },
        "hubtohub-change": {
          "$ref": "#/components/messages/hubtohub-change"
        },
        "hubtohub-snapshot-request": {
          "$ref": "#/components/messages/hubtohub-snapshot-request"
        },
        "marketstatus": {
          "$ref": "#/components/messages/marketstatus"
        },
        "ping": {
          "$ref": "#/components/messages/ping"
        },
        "pong": {
          "$ref": "#/components/messages/pong"
        },
        "error": {
          "$ref": "#/components/messages/error"
        }
      },
      "bindings": {
        "ws": {
          "query": {
            "type": "object",
            "description": "The WebSocket API allows clients to subscribe to various topics via topics query parameter. Clients can receive updates for multiple topics in a single connection or establish separate connections for each topic. We advise to subscribe only to necessary topics, to lower the risk of disconnection due to message processing delays. ",
            "properties": {
              "topics": {
                "type": "string",
                "default": "orders,orderbook,hubtohub,marketstatus",
                "description": "A comma-delimited list of topics to receive updates for."
              },
              "orderbookfrequency": {
                "type": "integer",
                "default": 0,
                "description": "Parameter lets clients control the frequency of orderbook updates to manage processing load or reduce update intervals when real-time changes are not required. Parameter specifies the minimum interval between orderbook updates in milliseconds. However, the actual time between messages may vary based on market events and system configuration."
              }
            }
          }
        }
      }
    }
  },
  "operations": {
    "sendOrderbook": {
      "action": "send",
      "summary": "Orderbook snapshot and changes",
      "description": "Message of type orderbook-snapshot is sent to the client after the connection is initiated with the orderbook topic or without any topic specified. This message represents the state of the orderbook at that moment. Subsequent messages of type orderbook-change are sent with the seqNo property incremented by one, reflecting changes to the orderbook. Client can request new snapshot anytime with message of type orderbook-snapshot.\n",
      "channel": {
        "$ref": "#/channels/idmTrading"
      },
      "messages": [
        {
          "$ref": "#/channels/idmTrading/messages/orderbook-snapshot"
        },
        {
          "$ref": "#/channels/idmTrading/messages/orderbook-change"
        }
      ]
    },
    "receiveOrderbookSnapshotRequest": {
      "action": "receive",
      "summary": "Orderbook snapshot request",
      "description": "Client can request new snapshot anytime with message of type orderbook-snapshot.",
      "channel": {
        "$ref": "#/channels/idmTrading"
      },
      "reply": {
        "channel": {
          "$ref": "#/channels/idmTrading"
        },
        "messages": [
          {
            "$ref": "#/channels/idmTrading/messages/orderbook-snapshot"
          }
        ]
      },
      "messages": [
        {
          "$ref": "#/channels/idmTrading/messages/orderbook-snapshot-request"
        }
      ]
    },
    "receiveOrderCreateRequest": {
      "action": "receive",
      "summary": "Order create request",
      "channel": {
        "$ref": "#/channels/idmTrading"
      },
      "reply": {
        "channel": {
          "$ref": "#/channels/idmTrading"
        },
        "messages": [
          {
            "$ref": "#/channels/idmTrading/messages/order-change"
          },
          {
            "$ref": "#/channels/idmTrading/messages/order-error"
          }
        ]
      },
      "messages": [
        {
          "$ref": "#/channels/idmTrading/messages/order-create"
        }
      ]
    },
    "receiveOrderOperationRequest": {
      "action": "receive",
      "summary": "Order activation/deactivation/cancelation request",
      "channel": {
        "$ref": "#/channels/idmTrading"
      },
      "reply": {
        "channel": {
          "$ref": "#/channels/idmTrading"
        },
        "messages": [
          {
            "$ref": "#/channels/idmTrading/messages/order-change"
          },
          {
            "$ref": "#/channels/idmTrading/messages/order-error"
          }
        ]
      },
      "messages": [
        {
          "$ref": "#/channels/idmTrading/messages/order-operation"
        }
      ]
    },
    "receiveOrderModifyRequest": {
      "action": "receive",
      "summary": "Order modify request",
      "channel": {
        "$ref": "#/channels/idmTrading"
      },
      "reply": {
        "channel": {
          "$ref": "#/channels/idmTrading"
        },
        "messages": [
          {
            "$ref": "#/channels/idmTrading/messages/order-change"
          },
          {
            "$ref": "#/channels/idmTrading/messages/order-error"
          }
        ]
      },
      "messages": [
        {
          "$ref": "#/channels/idmTrading/messages/order-modify"
        }
      ]
    },
    "sendOrderChange": {
      "action": "send",
      "summary": "Order change",
      "channel": {
        "$ref": "#/channels/idmTrading"
      },
      "messages": [
        {
          "$ref": "#/channels/idmTrading/messages/order-change"
        },
        {
          "$ref": "#/channels/idmTrading/messages/order-error"
        }
      ]
    },
    "receiveOrderListRequest": {
      "action": "receive",
      "summary": "Order list request.",
      "description": "Pagination is done by server, splitting orders to multiple messages sent by server. One of time range parameters is required: 'DeliveryFrom' (with/without 'DeliveryTo') or 'CreatedFrom' (with/without 'CreatedTo') or 'UpdatedFrom' (with/without 'UpdatedTo'), or Id or GroupId. The earliest allowed value for any *From field is start of the previous calendar day. Id and GroupId are limited to 1000 ids.",
      "channel": {
        "$ref": "#/channels/idmTrading"
      },
      "reply": {
        "channel": {
          "$ref": "#/channels/idmTrading"
        },
        "messages": [
          {
            "$ref": "#/channels/idmTrading/messages/order-list"
          },
          {
            "$ref": "#/channels/idmTrading/messages/error"
          }
        ]
      },
      "messages": [
        {
          "$ref": "#/channels/idmTrading/messages/order-list-request"
        }
      ]
    },
    "receiveOrderDetailRequest": {
      "action": "receive",
      "summary": "Order detail request",
      "channel": {
        "$ref": "#/channels/idmTrading"
      },
      "reply": {
        "channel": {
          "$ref": "#/channels/idmTrading"
        },
        "messages": [
          {
            "$ref": "#/channels/idmTrading/messages/order-detail"
          },
          {
            "$ref": "#/channels/idmTrading/messages/error"
          }
        ]
      },
      "messages": [
        {
          "$ref": "#/channels/idmTrading/messages/order-detail-request"
        }
      ]
    },
    "sendHubToHub": {
      "action": "send",
      "summary": "Hub-to-Hub matrix snapshot and changes",
      "description": "Data of available transfer capacities are only available for delivery periods opened for trading. Message of type hubtohub-snapshot is sent to the client after the connection is initiated with the hubtohub topic or without any topic specified. This message represents the state of the available transfer capacities at that moment. Subsequent messages of type hubtohub-change are sent to reflect changes to the available transfer capacities. Client can request new snapshot anytime with message of type hubtohub-snapshot.\n",
      "channel": {
        "$ref": "#/channels/idmTrading"
      },
      "messages": [
        {
          "$ref": "#/channels/idmTrading/messages/hubtohub-snapshot"
        },
        {
          "$ref": "#/channels/idmTrading/messages/hubtohub-change"
        }
      ]
    },
    "receiveHubToHubRequest": {
      "action": "receive",
      "summary": "Hub-to-Hub matrix snapshot request",
      "description": "Client can request new snapshot anytime with message of type hubtohub-snapshot.",
      "channel": {
        "$ref": "#/channels/idmTrading"
      },
      "reply": {
        "channel": {
          "$ref": "#/channels/idmTrading"
        },
        "messages": [
          {
            "$ref": "#/channels/idmTrading/messages/hubtohub-snapshot"
          }
        ]
      },
      "messages": [
        {
          "$ref": "#/channels/idmTrading/messages/hubtohub-snapshot-request"
        }
      ]
    },
    "sendMarketStatus": {
      "action": "send",
      "description": "Message of type marketstatus is sent to the client after the connection is initiated with the marketstatus topic or without any topic specified. This message represents the market trading status at that moment. Subsequent messages of type marketstatus are sent to reflect changes to the market status.",
      "channel": {
        "$ref": "#/channels/idmTrading"
      },
      "messages": [
        {
          "$ref": "#/channels/idmTrading/messages/marketstatus"
        }
      ]
    },
    "receivePing": {
      "action": "receive",
      "summary": "Ping server to determine whether connection is alive",
      "description": "Client can ping server to determine whether connection is alive, server responds with pong. This is an application level ping as opposed to default ping in websockets standard.",
      "channel": {
        "$ref": "#/channels/idmTrading"
      },
      "reply": {
        "channel": {
          "$ref": "#/channels/idmTrading"
        },
        "messages": [
          {
            "$ref": "#/channels/idmTrading/messages/pong"
          }
        ]
      },
      "messages": [
        {
          "$ref": "#/channels/idmTrading/messages/ping"
        }
      ]
    },
    "sendPing": {
      "action": "send",
      "summary": "Ping client to determine whether connection is alive",
      "channel": {
        "$ref": "#/channels/idmTrading"
      },
      "reply": {
        "channel": {
          "$ref": "#/channels/idmTrading"
        },
        "messages": [
          {
            "$ref": "#/channels/idmTrading/messages/pong"
          }
        ]
      },
      "messages": [
        {
          "$ref": "#/channels/idmTrading/messages/ping"
        }
      ]
    },
    "sendError": {
      "action": "send",
      "summary": "General error",
      "channel": {
        "$ref": "#/channels/idmTrading"
      },
      "messages": [
        {
          "$ref": "#/channels/idmTrading/messages/error"
        }
      ]
    }
  },
  "components": {
    "messages": {
      "orderbook-snapshot": {
        "name": "orderbook-snapshot",
        "title": "Orderbook snapshot",
        "contentType": "application/json",
        "payload": {
          "$ref": "#/components/schemas/orderbook-snapshot"
        },
        "examples": [
          {
            "name": "Orderbook snapshot example",
            "payload": {
              "type": "orderbook-snapshot",
              "payload": {
                "seqNo": 6351,
                "timeDelta": 0,
                "data": [
                  {
                    "period": {
                      "start": "2024-11-22T09:00:00.000Z",
                      "end": "2024-11-22T10:00:00.000Z",
                      "isBlock": false,
                      "tradingEnd": "2024-11-22T08:30:00.000Z"
                    },
                    "statistics": {
                      "lastTradeTime": "2024-11-22T07:35:29.000Z",
                      "lastPrice": 179.9,
                      "maxPrice": 179.9,
                      "minPrice": 24,
                      "totalVolume": 87764,
                      "lastQuantity": 46,
                      "priceDirection": 1
                    },
                    "ownStatistics": {
                      "buy": {
                        "quantity": 20.1,
                        "remainingQuantity": 0,
                        "weigtedAveragePrice": 6.1
                      }
                    },
                    "buyList": [
                      {
                        "price": 62,
                        "quantity": 6,
                        "ownQuantity": 0
                      }
                    ],
                    "sellList": [
                      {
                        "price": 72,
                        "quantity": "2,",
                        "ownQuantity": 0
                      }
                    ]
                  },
                  {
                    "period": {
                      "start": "2024-11-22T17:00:00.000Z",
                      "end": "2024-11-22T19:00:00.000Z",
                      "isBlock": true,
                      "tradingEnd": "2024-11-22T16:30:00.000Z"
                    },
                    "blockOrders": [
                      {
                        "price": 37.6,
                        "quantity": 23.1,
                        "direction": "buy"
                      }
                    ]
                  }
                ]
              }
            }
          }
        ]
      },
      "orderbook-change": {
        "name": "orderbook-change",
        "title": "Orderbook change",
        "contentType": "application/json",
        "payload": {
          "$ref": "#/components/schemas/orderbook-change"
        },
        "examples": [
          {
            "name": "Orderbook change example",
            "payload": {
              "type": "orderbook-change",
              "payload": {
                "seqNo": 3278,
                "timeDelta": 3002,
                "data": [
                  {
                    "period": {
                      "start": "2024-11-20T19:00:00.000Z",
                      "end": "2024-11-20T20:00:00.000Z",
                      "isBlock": false,
                      "tradingEnd": "2024-11-20T18:30:00.000Z"
                    },
                    "statistics": {
                      "lastTradeTime": "2024-11-19T15:41:28.885Z",
                      "lastPrice": 291.27,
                      "maxPrice": 291.27,
                      "minPrice": 291.26,
                      "totalVolume": 30,
                      "lastQuantity": 10,
                      "priceDirection": 1
                    },
                    "ownStatistics": {
                      "sell": {
                        "quantity": 0,
                        "remainingQuantity": 291.27,
                        "weigtedAveragePrice": 0
                      }
                    },
                    "buyChanges": [
                      {
                        "index": 0,
                        "action": "remove",
                        "price": 94.84,
                        "quantity": 5,
                        "quantityDelta": -5,
                        "ownQuantity": 0,
                        "ownQuantityDelta": 0
                      }
                    ],
                    "sellChanges": [
                      {
                        "index": 0,
                        "action": "update",
                        "price": 291.27,
                        "quantity": 1.7,
                        "quantityDelta": 0.7,
                        "ownQuantity": 0,
                        "ownQuantityDelta": 0
                      },
                      {
                        "index": 0,
                        "action": "add",
                        "price": 291.26,
                        "quantity": 5,
                        "quantityDelta": 5,
                        "ownQuantity": 0,
                        "ownQuantityDelta": 0
                      }
                    ],
                    "blockOrderChanges": [
                      {
                        "action": "add",
                        "price": 21.8,
                        "quantity": 11.2,
                        "direction": "sell"
                      }
                    ],
                    "action": "update"
                  },
                  {
                    "period": {
                      "start": "2024-11-20T19:00:00.000Z",
                      "end": "2024-11-20T21:00:00.000Z",
                      "isBlock": true,
                      "tradingEnd": "2024-11-20T18:30:00.000Z"
                    },
                    "blockOrderChanges": [
                      {
                        "action": "add",
                        "price": 21.8,
                        "quantity": 11.2,
                        "direction": "sell"
                      }
                    ],
                    "action": "update"
                  }
                ]
              }
            }
          }
        ]
      },
      "orderbook-snapshot-request": {
        "name": "orderbook-snapshot-request",
        "title": "Orderbook snapshot request",
        "contentType": "application/json",
        "payload": {
          "$ref": "#/components/schemas/orderbook-snapshot-request"
        }
      },
      "order-create": {
        "name": "order-create",
        "title": "Order create request",
        "contentType": "application/json",
        "payload": {
          "$ref": "#/components/schemas/order-create"
        },
        "correlationId": {
          "description": "Correlation ID",
          "location": "$message.payload#/payload/correlationId"
        }
      },
      "order-operation": {
        "name": "order-operation",
        "title": "Order operation",
        "contentType": "application/json",
        "payload": {
          "$ref": "#/components/schemas/orderOperation"
        },
        "correlationId": {
          "description": "Correlation ID",
          "location": "$message.payload#/payload/correlationId"
        }
      },
      "order-modify": {
        "name": "order-modify",
        "title": "Order modification request.",
        "description": " All changeable properties must be included in the request, even those the client does not intend to change.",
        "contentType": "application/json",
        "payload": {
          "$ref": "#/components/schemas/orderModify"
        },
        "correlationId": {
          "description": "Correlation ID",
          "location": "$message.payload#/payload/correlationId"
        }
      },
      "order-change": {
        "name": "order-change",
        "title": "Order change",
        "contentType": "application/json",
        "payload": {
          "$ref": "#/components/schemas/order-change"
        },
        "correlationId": {
          "description": "Correlation ID from order-create message",
          "location": "$message.payload#/payload/correlationId"
        }
      },
      "order-error": {
        "name": "order-error",
        "title": "Order error",
        "contentType": "application/json",
        "payload": {
          "$ref": "#/components/schemas/order-error"
        },
        "correlationId": {
          "description": "Correlation ID from order-create or order-operation message",
          "location": "$message.payload#/payload/correlationId"
        }
      },
      "order-list-request": {
        "name": "order-list-request",
        "title": "Order list request",
        "contentType": "application/json",
        "payload": {
          "$ref": "#/components/schemas/orderListRequest"
        }
      },
      "order-list": {
        "name": "order-list",
        "title": "Order list",
        "contentType": "application/json",
        "payload": {
          "$ref": "#/components/schemas/orderList"
        }
      },
      "order-detail-request": {
        "name": "order-detail-request",
        "title": "Order detail request",
        "contentType": "application/json",
        "payload": {
          "$ref": "#/components/schemas/orderDetailRequest"
        }
      },
      "order-detail": {
        "name": "order-detail",
        "title": "Order detail",
        "contentType": "application/json",
        "payload": {
          "$ref": "#/components/schemas/order-detail"
        }
      },
      "hubtohub-snapshot": {
        "name": "hubtohub-snapshot",
        "title": "Hub-to-Hub snapshot",
        "contentType": "application/json",
        "payload": {
          "$ref": "#/components/schemas/hubtohub-snapshot"
        }
      },
      "hubtohub-change": {
        "name": "hubtohub-change",
        "title": "Hub-to-Hub change",
        "contentType": "application/json",
        "payload": {
          "$ref": "#/components/schemas/hubtohub-change"
        }
      },
      "hubtohub-snapshot-request": {
        "name": "hubtohub-snapshot-request",
        "title": "Hub-to-Hub snapshot request",
        "contentType": "application/json",
        "payload": {
          "$ref": "#/components/schemas/hubtohub-snapshot-request"
        }
      },
      "marketstatus": {
        "name": "marketstatus",
        "title": "Message of type marketstatus",
        "contentType": "application/json",
        "payload": {
          "$ref": "#/components/schemas/marketstatus"
        }
      },
      "ping": {
        "name": "ping",
        "title": "Pong message",
        "payload": {
          "$ref": "#/components/schemas/ping"
        }
      },
      "pong": {
        "name": "pong",
        "title": "Pong is a response to ping message",
        "contentType": "application/json",
        "description": "Server/client pong response to a ping to determine whether connection is alive. This is an application level pong as opposed to default pong in websockets standard.",
        "payload": {
          "$ref": "#/components/schemas/pong"
        }
      },
      "error": {
        "name": "error",
        "title": "Error message",
        "payload": {
          "$ref": "#/components/schemas/error"
        }
      }
    },
    "schemas": {
      "orderbook-snapshot-request": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "orderbook-snapshot"
          }
        }
      },
      "orderbook-snapshot": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "orderbook-snapshot"
          },
          "payload": {
            "type": "object",
            "properties": {
              "seqNo": {
                "description": "Sequential message number for data consistency verification",
                "type": "integer",
                "format": "int32",
                "example": 6351
              },
              "timeDelta": {
                "description": "Time difference between the current and previous change in milliseconds",
                "type": "integer",
                "format": "int32",
                "example": 6351
              },
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "period": {
                      "$ref": "#/components/schemas/period"
                    },
                    "statistics": {
                      "$ref": "#/components/schemas/statistics"
                    },
                    "ownStatistics": {
                      "$ref": "#/components/schemas/ownStatistics"
                    },
                    "buyList": {
                      "description": "Price levels for buy side",
                      "type": "array",
                      "items": [
                        {
                          "$ref": "#/components/schemas/priceLevel"
                        }
                      ]
                    },
                    "sellList": {
                      "description": "Price levels for sell side",
                      "type": "array",
                      "items": [
                        {
                          "$ref": "#/components/schemas/priceLevel"
                        }
                      ]
                    },
                    "blockOrders": {
                      "description": "Block orders",
                      "type": "array",
                      "items": [
                        {
                          "$ref": "#/components/schemas/blockOrder"
                        }
                      ]
                    }
                  }
                }
              }
            }
          }
        }
      },
      "orderbook-change": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "orderbook-change"
          },
          "payload": {
            "type": "object",
            "properties": {
              "seqNo": {
                "description": "Sequential message number for data consistency verification",
                "type": "integer",
                "format": "int32",
                "example": 6351
              },
              "timeDelta": {
                "description": "Time difference between the current and previous change in milliseconds",
                "type": "integer",
                "format": "int32",
                "example": 6351
              },
              "data": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "period": {
                      "$ref": "#/components/schemas/period"
                    },
                    "statistics": {
                      "$ref": "#/components/schemas/statistics"
                    },
                    "ownStatistics": {
                      "$ref": "#/components/schemas/ownStatistics"
                    },
                    "buyChanges": {
                      "description": "Price levels for buy side",
                      "type": "array",
                      "items": [
                        {
                          "$ref": "#/components/schemas/priceLevelChange"
                        }
                      ]
                    },
                    "sellChanges": {
                      "description": "Price levels for sell side",
                      "type": "array",
                      "items": [
                        {
                          "$ref": "#/components/schemas/priceLevelChange"
                        }
                      ]
                    },
                    "blockOrderChanges": {
                      "description": "Block orders",
                      "type": "array",
                      "items": [
                        {
                          "$ref": "#/components/schemas/blockOrderChange"
                        }
                      ]
                    },
                    "action": {
                      "description": "Type of change of period",
                      "type": "string",
                      "enum": [
                        "add",
                        "update",
                        "remove"
                      ],
                      "example": "update"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "period": {
        "description": "Delivery period specification",
        "type": "object",
        "properties": {
          "start": {
            "description": "Delivery period start in UTC",
            "type": "string",
            "format": "date-time",
            "example": "2024-11-22T09:00:00Z"
          },
          "end": {
            "description": "Delivery period end in UTC",
            "type": "string",
            "format": "date-time",
            "example": "2024-11-22T10:00:00Z"
          },
          "isBlock": {
            "description": "Indication of whether it is a period for block orders",
            "type": "boolean",
            "example": false
          },
          "tradingEnd": {
            "description": "Trading end time for the period in UTC",
            "type": "string",
            "format": "date-time",
            "example": "2024-11-22T08:30:00Z"
          }
        }
      },
      "statistics": {
        "description": "General trading statistics",
        "type": "object",
        "properties": {
          "lastTradeTime": {
            "description": "Time of the last trade in period in UTC",
            "type": "string",
            "format": "date-time",
            "example": "2024-11-22T07:35:29Z"
          },
          "lastPrice": {
            "description": "Price of the last trade in period in EUR/MWh",
            "type": "number",
            "format": "double",
            "example": 179.9
          },
          "lastQuantity": {
            "description": "Quantity of the last trade in period in MW",
            "type": "number",
            "format": "double",
            "example": 46
          },
          "priceDirection": {
            "description": "Price trend",
            "type": "integer",
            "format": "int32",
            "example": 1
          },
          "minPrice": {
            "description": "Lowest price of all trades in period in EUR/MWh",
            "type": "number",
            "format": "double",
            "example": 24
          },
          "maxPrice": {
            "description": "Highest price of all trades in period in EUR/MWh",
            "type": "number",
            "format": "double",
            "example": 179.9
          },
          "totalVolume": {
            "description": "Total trade volume for the trading period in MW",
            "type": "number",
            "format": "double",
            "example": 87764
          }
        }
      },
      "ownStatistics": {
        "desctiption": "Own trading statistics of client",
        "type": "object",
        "properties": {
          "buy": {
            "$ref": "#/components/schemas/ownStatisticsSide"
          },
          "sell": {
            "$ref": "#/components/schemas/ownStatisticsSide"
          }
        }
      },
      "ownStatisticsSide": {
        "description": "Own statistics of buy side for period",
        "type": "object",
        "properties": {
          "quantity": {
            "description": "Own traded volume in period in MW",
            "type": "number",
            "format": "double",
            "example": 20.1
          },
          "remainingQuantity": {
            "description": "Remaining quantity of own orders for period in MW",
            "type": "number",
            "format": "double",
            "example": 0
          },
          "weigtedAveragePrice": {
            "description": "Weighted average price of own trades in EUR/MWh",
            "type": "number",
            "format": "double",
            "example": 6.1
          }
        }
      },
      "priceLevel": {
        "description": "Price level",
        "type": "object",
        "properties": {
          "price": {
            "description": "Price in EUR/MWh",
            "type": "number",
            "format": "double",
            "example": 62
          },
          "quantity": {
            "description": "Quantity in MW",
            "type": "number",
            "format": "double",
            "example": 6
          },
          "ownQuantity": {
            "description": "Remaining quantity of own orders for price level",
            "type": "number",
            "format": "double",
            "example": 0
          }
        }
      },
      "priceLevelChange": {
        "description": "Price level change",
        "allOf": [
          {
            "$ref": "#/components/schemas/priceLevel"
          },
          {
            "type": "object",
            "properties": {
              "index": {
                "description": "Position of the change within the market depth for the period",
                "type": "integer",
                "format": "int64",
                "example": 2
              },
              "action": {
                "description": "Type of price level change",
                "type": "string",
                "enum": [
                  "add",
                  "update",
                  "remove"
                ],
                "example": "remove"
              },
              "quantityDelta": {
                "description": "Change in quantity compared to the previous amount in MW",
                "type": "number",
                "format": "double",
                "example": 0.7
              },
              "ownQuantityDelta": {
                "description": "Change in own quantity compared to the previous amount in MW",
                "type": "number",
                "format": "double",
                "example": 0
              }
            }
          }
        ]
      },
      "blockOrder": {
        "description": "Block order",
        "type": "object",
        "properties": {
          "price": {
            "description": "Price in EUR/MWh",
            "type": "number",
            "format": "double",
            "example": 20.1
          },
          "quantity": {
            "description": "Quantity in MW",
            "type": "number",
            "format": "double",
            "example": 0
          },
          "direction": {
            "description": "Direction / side",
            "type": "number",
            "enum": [
              "buy",
              "sell"
            ],
            "example": "buy"
          }
        }
      },
      "blockOrderChange": {
        "description": "Block order change",
        "allOf": [
          {
            "$ref": "#/components/schemas/blockOrder"
          },
          {
            "type": "object",
            "properties": {
              "action": {
                "description": "Type of price level change",
                "type": "string",
                "enum": [
                  "add",
                  "update",
                  "remove"
                ],
                "example": "remove"
              }
            }
          }
        ]
      },
      "order-create": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "order-create"
          },
          "payload": {
            "type": "object",
            "properties": {
              "correlationId": {
                "$ref": "#/components/schemas/correlationId"
              },
              "groupIndication": {
                "description": "rejectPartially - if some order is invalid, processing of the remaining valid orders continues; rejectAll - if some order is invalid, processing of all orders is stopped; linked - execute all orders or none, all orders must have indication FOK.",
                "type": "string",
                "enum": [
                  "rejectPartially",
                  "rejectAll",
                  "linked"
                ],
                "example": "rejectPartially"
              },
              "orders": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/orderCreateRequestItem"
                }
              }
            }
          }
        }
      },
      "orderOperation": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "order-activate",
              "order-deactivate",
              "order-cancel"
            ]
          },
          "payload": {
            "type": "object",
            "properties": {
              "id": {
                "$ref": "#/components/schemas/orderId"
              },
              "correlationId": {
                "$ref": "#/components/schemas/correlationId"
              }
            }
          }
        }
      },
      "orderModify": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "order-modify"
          },
          "payload": {
            "type": "object",
            "properties": {
              "correlationId": {
                "$ref": "#/components/schemas/correlationId"
              },
              "orders": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/orderModifyRequestItem"
                }
              }
            }
          }
        }
      },
      "order-change": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "order-change"
          },
          "payload": {
            "$ref": "#/components/schemas/orderChangeItem"
          }
        }
      },
      "orderChangeItem": {
        "allOf": [
          {
            "$ref": "#/components/schemas/order"
          },
          {
            "type": "object",
            "properties": {
              "action": {
                "description": "Indicates the specific event that caused the order change.",
                "type": "string",
                "enum": [
                  "added",
                  "removed",
                  "changed",
                  "activated",
                  "deactivated",
                  "matched",
                  "canceled"
                ],
                "example": "added"
              },
              "correlationId": {
                "$ref": "#/components/schemas/correlationId"
              }
            }
          }
        ]
      },
      "orderListRequest": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "order-list"
          },
          "payload": {
            "type": "object",
            "properties": {
              "correlationId": {
                "$ref": "#/components/schemas/correlationId"
              },
              "productType": {
                "description": "Product type",
                "type": "string",
                "enum": [
                  60,
                  15
                ],
                "example": 60
              },
              "deliveryFrom": {
                "description": "Start time of delivery range (UTC). Minimal time is yesterday 00:00.",
                "type": "string",
                "format": "date-time",
                "example": "2024-12-18T14:00:00.000Z"
              },
              "deliveryTo": {
                "description": "End time of delivery range (UTC)",
                "type": "string",
                "format": "date-time",
                "example": "2024-12-18T15:00:00.000Z"
              },
              "createdFrom": {
                "description": "Start time of createdAt range (UTC)",
                "type": "string",
                "format": "date-time",
                "example": "2024-12-18T14:00:00.000Z"
              },
              "createdTo": {
                "description": "End time of createdAt range (UTC)",
                "type": "string",
                "format": "date-time",
                "example": "2024-12-18T15:00:00.000Z"
              },
              "updatedFrom": {
                "description": "Start time of updatedAt range (UTC)",
                "type": "string",
                "format": "date-time",
                "example": "2024-12-18T14:00:00.000Z"
              },
              "updatedTo": {
                "description": "End time of updatedAt range (UTC)",
                "type": "string",
                "format": "date-time",
                "example": "2024-12-18T15:00:00.000Z"
              },
              "status": {
                "description": "Current order Status",
                "type": "array",
                "items": {
                  "type": "string",
                  "enum": [
                    "active",
                    "inactive",
                    "canceled",
                    "partiallyMatched",
                    "matched",
                    "expired",
                    "expiredInactive"
                  ],
                  "example": "active"
                }
              },
              "id": {
                "description": "Order IDs",
                "type": "array",
                "items": {
                  "type": "integer",
                  "format": "int64",
                  "example": 968968
                }
              },
              "groupId": {
                "description": "Group IDs for linked and rejectAll group",
                "type": "array",
                "items": {
                  "type": "integer",
                  "format": "int64",
                  "example": 235
                }
              },
              "expandTrades": {
                "description": "Specifies whether trades information should be included in response. Default: false",
                "type": "boolean",
                "example": false
              }
            }
          }
        }
      },
      "orderList": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "order-list"
          },
          "payload": {
            "type": "object",
            "properties": {
              "correlationId": {
                "$ref": "#/components/schemas/correlationId"
              },
              "offset": {
                "description": "The zero-based index of the first item included in the current page of results. It represents how many items were skipped from the beginning of the full result set.",
                "type": "integer",
                "format": "int32",
                "example": 300
              },
              "limit": {
                "description": "The maximum number of items returned in the current response. This defines the page size used for pagination.",
                "type": "integer",
                "format": "int32",
                "example": 100
              },
              "hasNext": {
                "description": "Indicates whether additional pages of data are available after the current response.",
                "type": "boolean",
                "example": true
              },
              "data": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/order"
                }
              }
            }
          }
        }
      },
      "orderDetailRequest": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "order-detail"
          },
          "payload": {
            "type": "object",
            "properties": {
              "id": {
                "$ref": "#/components/schemas/orderId"
              },
              "correlationId": {
                "$ref": "#/components/schemas/correlationId"
              }
            }
          }
        }
      },
      "order-detail": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "order-detail"
          },
          "payload": {
            "$ref": "#/components/schemas/order"
          }
        }
      },
      "order": {
        "allOf": [
          {
            "$ref": "#/components/schemas/orderBase"
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "$ref": "#/components/schemas/orderId"
              },
              "groupId": {
                "description": "Group identifier for linked and rejectAll group",
                "type": "integer",
                "format": "int64",
                "example": null
              },
              "productType": {
                "description": "Product type",
                "type": "string",
                "enum": [
                  60,
                  15
                ],
                "example": 60
              },
              "deliveryDay": {
                "description": "Date of the delivery\t(Date 8601)",
                "type": "string",
                "format": "date-time",
                "example": "2024-12-18T00:00:00.000Z"
              },
              "status": {
                "description": "Current order Status",
                "type": "string",
                "enum": [
                  "active",
                  "inactive",
                  "canceled",
                  "partiallyMatched",
                  "matched",
                  "expired",
                  "expiredInactive"
                ],
                "example": "partiallyMatched"
              },
              "isPending": {
                "description": "Indicator of whether the order is still being processed by the system (e.g., waiting for activation).",
                "type": "boolean",
                "example": true
              },
              "realizedQuantity": {
                "description": "Realized quantity in MW (one decimal)",
                "type": "number",
                "format": "float",
                "example": 10.1
              },
              "realizedPriceWeighted": {
                "description": "Realized price in EUR/MWh (two decimals)",
                "type": "number",
                "format": "float",
                "example": 35.55
              },
              "remainingQuantity": {
                "description": "Remaining quantity in MW (one decimal)",
                "type": "number",
                "format": "float",
                "example": 5.1
              },
              "createdAt": {
                "description": "The time of the order's creation (UTC)",
                "type": "string",
                "format": "date-time",
                "example": "2024-12-18T10:05:03.000Z"
              },
              "updatedAt": {
                "description": "The time of the order's latest update. (UTC)",
                "type": "string",
                "format": "date-time",
                "example": "2024-12-18T10:05:03.000Z"
              },
              "createdBy": {
                "description": "The name of the user who created the order.",
                "type": "string",
                "example": "Ján Prúdový"
              }
            }
          }
        ]
      },
      "orderCreateRequestItem": {
        "allOf": [
          {
            "$ref": "#/components/schemas/orderBase"
          },
          {
            "type": "object",
            "properties": {
              "indication": {
                "description": "noIndication - no indication; fok - Fill Or Kill; ioc - Immediate Or Cancel; aon - All Or None (only for block orders).",
                "type": "string",
                "enum": [
                  "noIndication",
                  "fok",
                  "ioc",
                  "aon"
                ],
                "example": "ioc"
              },
              "active": {
                "description": "Create order as active",
                "type": "boolean"
              }
            },
            "required": [
              "active"
            ]
          }
        ]
      },
      "orderModifyRequestItem": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "id": {
                "$ref": "#/components/schemas/orderId"
              }
            },
            "required": [
              "id"
            ]
          },
          {
            "$ref": "#/components/schemas/orderEditableFields"
          }
        ]
      },
      "orderBase": {
        "allOf": [
          {
            "type": "object",
            "properties": {
              "type": {
                "description": "Order type",
                "type": "string",
                "enum": [
                  "simple",
                  "block",
                  "iceberg"
                ],
                "example": "simple"
              },
              "deliveryStart": {
                "description": "Delivery period start (UTC)",
                "type": "string",
                "format": "date-time",
                "example": "2024-12-18T14:00:00.000Z"
              },
              "deliveryEnd": {
                "description": "Delivery period end (UTC)",
                "type": "string",
                "format": "date-time",
                "example": "2024-12-18T15:00:00.000Z"
              },
              "direction": {
                "description": "Direction / side",
                "type": "string",
                "enum": [
                  "buy",
                  "sell"
                ],
                "example": "buy"
              },
              "clientOrderId": {
                "description": "Custom client identification of order",
                "type": "string",
                "example": "B-0001"
              }
            },
            "required": [
              "type",
              "deliveryStart",
              "deliveryEnd",
              "direction"
            ]
          },
          {
            "$ref": "#/components/schemas/orderEditableFields"
          }
        ]
      },
      "orderEditableFields": {
        "type": "object",
        "properties": {
          "quantity": {
            "description": "Quantity in MW (one decimal)",
            "type": "number",
            "format": "float",
            "example": 15.2
          },
          "price": {
            "description": "Price in EUR/MWh (two decimals)",
            "type": "number",
            "format": "float",
            "example": 35.55
          },
          "peakQuantity": {
            "description": "Peak quantity of an iceberg order in MW (one decimal)",
            "type": "number",
            "format": "float",
            "example": 5.5
          },
          "peakPriceDelta": {
            "description": "Price shift for each new part of the order related to an iceberg order in EUR/MWh (two decimals)",
            "type": "number",
            "format": "float",
            "example": 0.2
          },
          "expiration": {
            "description": "Time of client defined order expiration (UTC or null)",
            "type": "string",
            "format": "date-time",
            "example": "2024-12-18T11:12:13.000Z"
          },
          "note": {
            "description": "Custom client note",
            "type": "string",
            "example": "Just my note"
          }
        },
        "required": [
          "quantity",
          "price"
        ]
      },
      "hubtohub-snapshot": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "hubtohub-snapshot"
          },
          "payload": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/atc"
            }
          }
        }
      },
      "hubtohub-change": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "hubtohub-change"
          },
          "payload": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/atc"
            }
          }
        }
      },
      "hubtohub-snapshot-request": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "hubtohub-snapshot"
          }
        }
      },
      "atc": {
        "type": "object",
        "properties": {
          "eic": {
            "description": "EIC of the Market Area",
            "type": "string",
            "example": "10YCZ-CEPS-----N"
          },
          "areaName": {
            "description": "Name of the Market Area",
            "type": "string",
            "example": "CEPS"
          },
          "countryCode": {
            "description": "Two-letter country code",
            "type": "string",
            "example": "CZ"
          },
          "deliveryDay": {
            "description": "Date of the delivery\t(Date 8601)",
            "type": "string",
            "format": "date-time",
            "example": "2024-12-18T00:00:00.000Z"
          },
          "deliveryStart": {
            "description": "Delivery period start (UTC)",
            "type": "string",
            "format": "date-time",
            "example": "2024-12-18T14:00:00.000Z"
          },
          "deliveryEnd": {
            "description": "Delivery period end (UTC)",
            "type": "string",
            "format": "date-time",
            "example": "2024-12-18T15:00:00.000Z"
          },
          "availableCapacityIn": {
            "description": "Available import capacities in MW",
            "type": "number",
            "format": "float",
            "example": 3066
          },
          "availableCapacityOut": {
            "description": "Available export capacities in MW",
            "type": "number",
            "format": "float",
            "example": 2798
          }
        }
      },
      "marketstatus": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "marketstatus"
          },
          "payload": {
            "type": "object",
            "properties": {
              "systemTime": {
                "description": "System time",
                "type": "string",
                "format": "date-time",
                "example": "2024-11-19T22:00:50.3884144Z"
              },
              "tradeDay": {
                "description": "Current trade/delivery day",
                "type": "string",
                "format": "date",
                "example": "2024-11-19"
              },
              "tradingStatus": {
                "description": "Market trading status",
                "type": "string",
                "enum": [
                  "xbidOk",
                  "xbidNok",
                  "xbidHalt",
                  "xbidBatchMatching",
                  "localOn",
                  "localOff"
                ],
                "example": "xbidOk"
              }
            }
          }
        }
      },
      "ping": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "ping"
          }
        },
        "required": [
          "type"
        ]
      },
      "pong": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "pong"
          }
        },
        "required": [
          "type"
        ]
      },
      "order-error": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "order-error"
          },
          "payload": {
            "allOf": [
              {
                "$ref": "#/components/schemas/errorPayload"
              },
              {
                "type": "object",
                "properties": {
                  "correlationId": {
                    "$ref": "#/components/schemas/correlationId"
                  }
                }
              }
            ]
          }
        }
      },
      "error": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "const": "error"
          },
          "payload": {
            "$ref": "#/components/schemas/errorPayload"
          }
        }
      },
      "errorPayload": {
        "type": "object",
        "properties": {
          "code": {
            "description": "Error code indicating the type of error",
            "type": "string",
            "example": "ValidationProblem"
          },
          "message": {
            "description": "Optional detailed error message",
            "type": "string",
            "example": "Validation problems occurred"
          },
          "errors": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/errorDetail"
              }
            },
            "description": "Dictionary of errors categorized by customOrderId or order ID or random number"
          }
        }
      },
      "errorDetail": {
        "type": "object",
        "properties": {
          "code": {
            "description": "Specific error code",
            "type": "string",
            "example": "ExpTimeEndRule"
          },
          "message": {
            "description": "Optional message providing details about the error.",
            "type": "string",
            "example": "Order expiration time cannot be later than period trading end."
          },
          "messageArgs": {
            "description": "Arguments for formatting the detailed error message.",
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      },
      "correlationId": {
        "description": "Client's request message identifier",
        "type": "string",
        "example": "request-20241218001"
      },
      "orderId": {
        "description": "Order ID",
        "type": "integer",
        "format": "int64",
        "example": 968968
      }
    },
    "securitySchemes": {
      "basicAuth": {
        "type": "http",
        "scheme": "basic",
        "description": "Username and password provided in the Authorization header."
      },
      "clientCertAuth": {
        "type": "X509",
        "description": "Client Certificate - A handshake is initiated by the server to validate the certificate."
      }
    }
  }
}