Always-in-sync types
Types are auto-generated from the live OpenAPI spec — no hand-maintained mirror. Run bun run generate after a server-side DTO change and your IDE is up-to-date the same day.
OAuth2, retries, pagination and SignalR real-time included; types regenerated from the OpenAPI spec so they never drift.
npm install @mywebapi.com/sdk
Types are auto-generated from the live OpenAPI spec — no hand-maintained mirror. Run bun run generate after a server-side DTO change and your IDE is up-to-date the same day.
OAuth2 client-credentials flow with auto-refresh; idempotent retries on 408/429/502/503/504 with exponential backoff; v2 envelope unwrap; structured ApiError with code / description / activityId for log correlation.
One client object exposes client.mt4 / client.mt5 for REST and client.realtime.mt4(tp) for streaming — same token, same env, no second handshake.
Copy this snippet, set your environment variables, and you are up and running in under a minute.
import { CPluginWebApiClient } from '@mywebapi.com/sdk';
const client = CPluginWebApiClient.fromEnvironment();
// or: new CPluginWebApiClient({ env: 'prod', clientId: '...', clientSecret: '...' });
const tp = '3029d415-d0a6-4710-a9c1-8cb063ef872f';
const time = await client.mt4.getServerTime(tp);
console.log('MT4 server time:', time.data.timestamp);
Built into the same package — no separate install. The optional peer dependency @microsoft/signalr is required only when you use real-time.
npm install @microsoft/signalr (only if you use real-time). The REST surface works without it.
const rt = client.realtime.mt4(tp); // or .mt5
rt.onConnectionStatus((s) => console.log('connected:', s.connected));
await rt.start();
for await (const tick of rt.streamTicks('EURUSD')) {
console.log(tick.symbol, tick.bid, tick.ask);
}
await rt.stop();
Jump-start your integration with ready-to-run examples from the repository.
List your trade platforms and read MT4/MT5 server time, version, and connection status.
Subscribe to real-time price streams for any symbol using the built-in SignalR client.
Combine REST endpoints and real-time streams to display positions, orders, and market data.
API keys (clientId / clientSecret) and trade-platform IDs are managed in the CPlugin Toolbox. Toolbox provisions your WebAPI access; the SDK is the client.
Browse every class, interface, function, and type — auto-generated from the OpenAPI spec and always up-to-date.
29 modules, auto-generated from the OpenAPI spec.