The Reporting API is a versatile and easy-to-use solution that allows for integrating your reporting systems with the cTrader backend. You can also use it as a basis for developing a custom reporting suite. The Reporting API provides you with data about key server entities (e.g., traders, orders, and positions) that you can process using any suitable logics.
Similarly to the Manager’s API, the Reporting API uses Google Protocol Buffers (Protobufs) as a means of transferring information between services.
The Reporting API uses syntax version 2 (Proto2). When selecting a language/library for integration, make sure that it supports this version.
A detailed guide to working with with Protobufs can be found in our introduction to the Manager’s API. Additional information can also be found on the following resources.
For sending real-time data, the Reporting API uses RabbitMQ, a well-known message broker.
Integration with the Reporting API is recommended in case you need to achieve any of the following goals.
To attain these goals, the Reporting API consists of two key components.
A snapshot provides information about the state of certain server entities during the specified period. Depending on the request you make, a snapshot may either contain a list of entities and their attributes, or data about just one entity.
In contrast, events act as notifications about the creation/modification/deletion of server entities. Each event is preceded by a sequence number allowing you to detect cases where reconciliation with the cTrader backend may be required. Finally, spot events represent changes in bid/ask prices.
Snapshots are time and resource-consuming to take. In most cases, it is necessary to only take snapshots at the initial stages of integration so that you can receive information about the entire structure of the database. Snapshots should also be taken for reconciliation in case you detect that you have not received or processed any real-time events. Ideally, snapshots should be taken during weekends.
When generating sequence numbers for real-time events, each server restart produces a new sequence starting from
1. As a result, please follow the below rules when deciding whether reconciliation is needed.
1. If you receive events whose sequence numbers are incremented by
1with each consecutive event (e.g.,
23458), no reconciliation is needed.
2. If you receive events whose sequence numbers are incremented by
1and then receive an event whose sequence number is
1, a server restart has occurred and reconciliation is needed.
3. If you receive events whose sequence numbers are incremented by a number larger than
23463), some events have been missed and reconciliation is needed.
Both the Reporting API and the Manager’s API are powerful tools that could be used for receiving statistics from the cTrader backend.
Compared to the Manager’s API, the Reporting API has several characteristics that limit its functionality to just reporting. The following table summarizes the main differences between the APIs.
|Characteristic||Manager’s API||Reporting API|
|Authorization/authentication mechanism||Each participant has to be authorized using a special manager’s token which can only be received after gaining access to the cBroker back office.||There are no additional authorization/authentication mechanisms. The full functionality can be accessed by any manager from any business entity that has access to your server and knows the API connection details.|
|Access rights||Each participant can only perform actions that they have specifically been granted permissions to perform in the cBroker back office.||Each participant can always perform all actions that are permitted by the API.|
|Possible actions||Participants can receive statistics, manage trading conditions, oversee accounts, etc.||Participants can only receive statistics.|
As a result, integration with the Manager’s API is preferable in the following cases.
In any other case, integration with the Reporting API is a valid alternative.
Apart from this introduction, the documentation is divided into the following sections.
You can access the latest verion of the Reporting API Protobuf files here.