Skip to main content

Interface comparison

The ALOR Broker trading system provides several interaction interfaces: HTTP API, WebSocket API, and GraphQL API. Each implements a different data processing model and is designed to address a specific class of tasks.

This section describes the selection criteria and typical use cases for the interfaces.


Interface Features

Each interface has its own advantages and disadvantages, which affect how effectively it can address specific tasks. To help you determine the most suitable option, the key characteristics of each interface are summarized in the table below.

| Criterion | HTTP API | WebSocket API | GraphQL API | | -------------------------- | ------------------------------ | ---------------- -------------- | -------------------------------- | | Data delivery model | Pull (request–response) | Push (message stream) | Pull (request–response) | | Data refresh mode | On demand | Real-time | On demand | | Latency requirements | Non-critical | Critical | Non-critical | | Workload type | Batch | Stream | Mixed | | Connection | Short-lived | Persistent | Short-lived | | Connection state | Stateless | Stateful | Stateless | | Interaction frequency | Low / medium | High | Low / Medium | | Data volume per query | Large | Incremental | Controllable | | Response structure | Fixed | Depends on subscription | Determined by query | | Data composition control | No | No | Yes | | Data aggregation | No | No | Yes | | Event subscription | No | Yes | No | | Number of queries | Can be high | Reduced by subscriptions | Reduced by aggregation | | Client requirements | Minimal | Increased (stream processing) | Average | | Typical scenarios | History, reference data, operations | Market data, events | Aggregated samples |


Selection Algorithm

The sequence of interface selection for solving the task can be simplified using the diagram below.


Typical Use Cases

The typical API use cases listed below should be used as a reference when designing your integration. If your use case does not match any of the scenarios, apply the selection criteria described above.

ScenarioInterfaceReason
Retrieving current quotesWebSocketData changes continuously; updates must be received without delay
Retrieving historical candlesticksHTTPData for a specific period must be retrieved in a single request
Retrieving the order bookWebSocketThe order book is updated in real time
Retrieving the instrument directoryHTTP / GraphQLLarge data volume, infrequent changes
Retrieving extended instrument informationGraphQLRequires aggregating data and selecting specific fields
Placing a single orderHTTPAtomic operation in a request-response model
Massive, high-volume order submissionWebSocketA high frequency of command transmission and asynchronous receipt of processing results are required, without the overhead associated with establishing connections
One-time retrieval of order statusHTTPA single request is sufficient
Tracking order status changesWebSocketRequires real-time status updates
Tracking transactionsWebSocketTransactions are received as a stream of events
Retrieving portfolio statusHTTPRequires a one-time snapshot of the status
Tracking portfolio changesWebSocketChanges occur asynchronously
Retrieving transaction historyHTTPRequires a sample for a specific period
Retrieving aggregated portfolio informationGraphQLRequires combining multiple entities

Sometimes the same action can be performed using different interfaces. In this case, you should choose an interface based on how often and intensively you perform that action.

For example, you can retrieve the status of a request via both the HTTP API and the WebSocket API. The difference is that the first interface will return the status at the time the request is made, while the second will transmit all changes in real time.

tip

For maximum efficiency, combine the available interfaces. For example, by requesting historical data via the HTTP API and monitoring the order book in real time via WebSocket, you’ll get a complete overview of the instrument’s price changes before purchasing it.

caution

Using the interface for purposes other than its intended use may result in access to the system being blocked.