Registry / finance / metaapi.cloud-sdk

metaapi.cloud-sdk

JSON →
library29.3.3jsnpmunverified

Official JavaScript SDK for MetaApi.cloud, a cloud-based forex trading API supporting MetaTrader 4 (MT4) and MetaTrader 5 (MT5). Current stable version is 29.3.3, with active releases. Key differentiators: provides both REST and WebSocket APIs, includes CopyFactory copy trading support, works in Node.js and browser environments, and ships TypeScript types. It abstracts away MetaTrader infrastructure complexity, offering a paid service with pricing comparable to self-hosting.

npm install metaapi.cloud-sdk
INSTALL
IMPORT
SIG · METAAPI.CLOUD-SDK
M
metaapi.cloud-sdk
financejavascriptv29.3.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MetaApi
✓ import MetaApi from 'metaapi.cloud-sdk';
✗ import { MetaApi } from 'metaapi.cloud-sdk';
MetaApi is the default export from the main package. Named import will not work.
MetaApi (from ESM subpath)
✓ import MetaApi from 'metaapi.cloud-sdk/esm-node';
✗ import MetaApi from 'metaapi.cloud-sdk'; // only for CommonJS
For Node.js native ESM (type: module), use the esm-node subpath import.
MetaApi (browser UMD)
✓ const api = new MetaApi.default(token);
✗ const api = new MetaApi(token); // wrong when loaded via script tag
When using the UMD bundle (e.g. via unpkg), the exported global is MetaApi and the constructor is MetaApi.default.

Initializes MetaApi client with API token and retrieves all MetaTrader accounts associated with the token.

import MetaApi from 'metaapi.cloud-sdk'; const token = process.env.METAAPI_TOKEN ?? 'your-api-token'; const api = new MetaApi(token); async function main() { const accounts = await api.metatraderAccountApi.getAccounts(); console.log('Accounts:', accounts); } main().catch(console.error);
Debug
Known issues
gotchaThe main package import is CommonJS. For ESM projects, use subpath import 'metaapi.cloud-sdk/esm-node'.
fix
Use 'import MetaApi from "metaapi.cloud-sdk/esm-node";' in ESM Node.js projects.
affects: *
gotchaWhen using UMD bundle in browser via script tag, the constructor is MetaApi.default, not MetaApi.
fix
Use 'new MetaApi.default(token)' instead of 'new MetaApi(token)'.
affects: *
deprecatedOlder SDK versions used require() by default; as of v29+ the primary export is still CommonJS but ES modules are supported via subpath.
fix
Prefer ES module imports: import MetaApi from 'metaapi.cloud-sdk/esm-node'.
affects: >=29.0.0
gotchaThe SDK is a paid service; API tokens require a valid subscription. Using free-tier tokens may result in '401 Unauthorized' or quota errors.
fix
Ensure your account has sufficient quota and API key is correct.
affects: *
Errors
Common errors & fixes
Cannot find module 'metaapi.cloud-sdk'
Package not installed or import path is wrong.
fix
Run 'npm install --save metaapi.cloud-sdk' and ensure import statement is correct: 'import MetaApi from "metaapi.cloud-sdk";'
Must use import to load ES Module: metaapi.cloud-sdk
CommonJS require() used on an ES module subpath.
fix
Use the correct import path: 'import MetaApi from "metaapi.cloud-sdk/esm-node";'
MetaApi.default is not a constructor
Using UMD bundle but calling new MetaApi.default() incorrectly (missing .default).
fix
Use 'new MetaApi.default(token)' when using the UMD bundle via script tag.
Upgrade
Version history
29.3.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
29 hits · last 30 days
node
24
OpenAI (training)
1
Resources
metaapi.cloud-sdk — npm install metaapi.cloud-sdk · libregistry