Skip to content

Unified Trading Data in PostgreSQL

Sync trading data from all platforms into PostgreSQL for analytics, compliance reporting, and business intelligence — no ETL pipelines required.

Get Started

The Challenge

Broker analytics require data from multiple trading platforms with different schemas and export mechanisms. Building custom ETL for each platform is expensive and fragile.

The WebAPI Solution

The Report Service syncs entities from MT4 (4 types), MT5 (6 types), cTrader (20+ types), and B2Trader directly into PostgreSQL. Unified schemas make cross-platform queries trivial.

report_setup.tsTypeScript
// Configure Report Service to sync data to PostgreSQL
await webapi.reportService.SetPostgresCredentials({
  host: 'analytics-db.internal',
  port: 5432,
  database: 'trading_data',
  username: 'webapi_sync',
  password: '***'
});

// Start sync for cTrader entities
await webapi.reportService.SyncCtrader({
  entities: ['accounts', 'orders', 'positions', 'deals', 'symbols']
});

// Check sync status
const status = await webapi.reportService.GetSyncStatus();
console.log(`Last sync: ${status.lastSyncTime}, Entities: ${status.entityCount}`);

Entity Mapping

What syncs from each platform

MT44 types
Groups, Symbols, Accounts, Trades
MT56 types
Orders, Groups, Symbols, Deals, Users, Positions
cTrader20+ types
Accounts, Orders, Positions, Deals, Symbols, Groups, ...
B2TraderFull
Full entity sync
[PostgreSQL]
[Your BI Tool]

Synced Entities

Entity types available per platform

PlatformEntity TypesCount
MT4Groups, Symbols, Accounts, Trade Records4
MT5Orders, Groups, Symbols, Deals, Users, Positions6
cTraderAccounts, Orders, Positions, Deals, Symbols, Groups, Balances, ...20+
B2TraderFull entity syncFull

Sample SQL Queries

Cross-platform analytics examples

Cross-platform P&L
SELECT platform, SUM(profit) as total_pnl, COUNT(*) as deals
FROM deals WHERE close_time > NOW() - INTERVAL '24 hours'
GROUP BY platform;
Commission analytics
SELECT DATE_TRUNC('month', close_time) as month,
       platform, SUM(commission) as total_commission
FROM deals GROUP BY month, platform ORDER BY month DESC;
Active accounts
SELECT platform, COUNT(DISTINCT login) as active_traders
FROM positions WHERE open_time > NOW() - INTERVAL '7 days'
GROUP BY platform;

Data Pipeline

End-to-end flow from platforms to BI

MT4MT5cTraderB2Trader
Platforms
WebAPI Report Service
PostgreSQL
BI Tool

Relevant API Services

Report Service

sync to PostgreSQL

MT4: Groups, Symbols, Accounts, Trade Records

MT5: Orders, Groups, Symbols, Deals, Users, Positions

cTrader: 20+ entity types

B2Trader: full entity sync

Deal Service

historical trade queries

Real-world example

Build cross-platform P&L reports, commission analytics, and compliance dashboards that automatically include data from all connected trading platforms (MT4, MT5, cTrader, B2Trader).

Ready to build?

Sync trading data from MT4, MT5, cTrader, and B2Trader to PostgreSQL and build cross-platform P&L reports, commission analytics, and compliance dashboards.

Get Started