Interaction with ScaleTrade Servers¶
A developer guide to the internal interaction between ScaleTrade trade servers and Linux-based report modules.
Overview¶
This section explains how the ScaleTrade trade server communicates with report modules.
The Report API enables servers to detect, load, initialize, and execute report plugins dynamically at runtime.
Environment Notice
Unlike its predecessors, ScaleTrade operates entirely under Linux, and report plugins are implemented as shared libraries (.so), not DLLs.
Compatibility¶
Each server can work only with modules matching its architecture bitness.
That means:
- A 64-bit ScaleTrade server will load only 64-bit modules.
- A 32-bit server will load only 32-bit modules.
Developers should therefore provide both versions when distributing plugins.
Recommended Naming Convention
trade_summary.so → 32-bit build
trade_summary64.so → 64-bit build
Report plugins are executed exclusively on trade servers, not access or backup nodes.
Module Initialization¶
When the server starts, it automatically scans the /opt/ScaleTrade/reports/ directory, including subdirectories, to detect report modules.
Initialization Process¶
flowchart TD
A[ScaleTrade Server Startup] --> B[Scan /opt/ScaleTrade/reports/]
B --> C[Locate .so files]
C --> D[Load each shared library]
D --> E[Call ITReportAbout()]
E --> F[Retrieve ReportInfo structure]
F --> G[Verify API version compatibility]
G --> H{Supported?}
H -->|Yes| I[Register report module]
H -->|No| J[Skip and log incompatibility]
- The server loads each shared object file (
.so). - It calls the
ITReportAbout()function, which returns aReportInfostructure describing the module (metadata, name, version, capabilities). - If the module doesn’t export
ITReportAbout(), it’s skipped and logged as a non-report binary. - Each plugin can expose up to 1024 reports within a single
.so. - The server enumerates these reports sequentially until it receives
RET_ERR_NOTFOUNDorRET_ERROR_NOTIMPLEMENTED.
Version Compatibility
The Report API version declared in ReportInfo must match the version supported by the ScaleTrade server.
Incompatible modules are ignored and logged with a warning.
Rebuild your plugin using the latest ScaleTrade Report API SDK to restore compatibility.
Configuration Loading¶
After initialization, the server reads all report configurations stored in the system.
Only those report modules defined in administrator configurations are activated.
Each report module can be instantiated multiple times with different configuration parameters.
Multiple Configurations
For example, a single report module performance_report.so can be run:
- once for daily trade summaries, and
- once for monthly PnL analytics.
This is configured through the Administrator Terminal or directly via /etc/ScaleTrade/config/reports.conf.
Report Request Handling¶
Reports are generated on demand when requested by a manager terminal or automation script.
When a request arrives, the server:
1. Creates a report context via the ITReportCreate() function.
2. Passes an API interface pointer (IReportAPI* api) to allow data access.
3. Calls the context’s methods defined by the IReportContext interface to generate the output.
IReportContext Interface¶
The IReportContext interface defines the lifecycle of a report and includes the following core methods:
| Method | Description |
|---|---|
Release() |
Deletes the created report object. Unlike reference-counted systems, ScaleTrade removes the object immediately without decrementing a counter. |
Generate() |
Invoked by the server to start report generation. The method receives a pointer to the active IReportAPI interface, which the plugin uses to query data and generate output. |
Interface Workflow
sequenceDiagram
participant Server
participant Plugin
participant API
Server->>Plugin: ITReportCreate()
Plugin-->>Server: Return IReportContext
Server->>Plugin: Generate(API*)
Plugin->>API: Query data (users, trades, accounts)
API-->>Plugin: Data stream
Plugin-->>Server: Report ready
Server->>Plugin: Release()
Summary¶
- ScaleTrade servers load report modules dynamically from
/opt/ScaleTrade/reports/. - Plugins must match server architecture and Report API version.
- Modules are configured by admins and executed upon request.
- Reports are generated through the
IReportContextinterface using the providedIReportAPI. - All components operate under Linux, ensuring performance and reliability.