TypeScript icon, indicating that this package has built-in type declarations

4.0.1 • Public • Published

MetaStats forex metrics API

MetaStats is a fast, cost-efficient, easy to use and standards-driven cloud forex trading statistics API supporting both MetaTrader 4 and MetaTrader 5 platforms designed to boost forex application development process.

Using MetaStats API you can develop applications similar to Myfxbook or MetriX extremely fast, saving time you otherwise spend for coding, optimizing and testing your own trading metrics calculation engine, since we already did it for you.

MetaStats API is a member of MetaApi project (, a powerful cloud forex trading API which supports both MetaTrader 4 and MetaTrader 5 platforms.

MetaStats API features

Features supported:

  • support for MetaTrader 4 and MetaTrader 5 platforms
  • metrics calculation for MetaTrader accounts added to MetaApi
  • optionally include open positions in metrics calculation
  • get historical trades for MetaApi account. The historical trades data is updated when you invoke metrics calculation endpoint or when set query parameter updateHistory to true
  • get open trades for MetaApi account

The features described above are available for use via a professional, fast, easy to use, standards-driven REST API which can be easily consumed from any programming language.

The primary intended use of MetaStats API is creating trade monitoring applications.


MetaStats is available to all MetaApi users without extra charges at this point.

You pay a fee executing MetaTrader terminal on MetaApi cloud. See for more details.

MetaApi provides a free tier so that you can test our APIs without any charges.

Frequently asked questions (FAQ)

FAQ is located here:

REST API documentation

MetaStats SDK is built on top of MetaStats REST API.

MetaStats REST API docs are available at

Code examples

We published some code examples in our github repository, namely:


npm install --save

Installing SDK in browser SPA applications

npm install --save

Installing SDK in browser HTML applications

<script src=""></script>
    const token = '...';
    const metaStats = new MetaStats(token);

Retrieving API token

Please visit web UI to obtain your API token.

Configuring trading statistics

import {MetaStats} from '';

const token = '...';
const metaStats = new MetaStats(token);

See esdoc in-code documentation for full definition of possible configuration options.

Retrieving trading statistics

let accountId = '...'; // MetaApi account id

// retrieve MetaApi MetaTrader account statistics
console.log(await metaStats.getMetrics(accountId));

// retrieve MetaApi MetaTrader account statistics including open positions
console.log(await metaStats.getMetrics(accountId, true));

// retrieve MetaApi MetaTrader account trades
console.log(await metaStats.getAccountTrades(accountId, '2020-01-01 00:00:00.000', '2021-01-01 00:00:00.000'));

// retrieve MetaApi MetaTrader account open trades
console.log(await metaStats.getAccountOpenTrades(accountId));

Quotas and rate limits

API calls you make are subject to rate limits. See for more details.

Related projects:

See our website for the full list of APIs and features supported

Some of the APIs you might decide to use together with this module:

  1. MetaApi cloud forex trading API
  2. CopyFactory copy trading API
  3. MetaTrader account management API
  4. MetaApi MT manager API
  5. MetaApi risk management API

Package Sidebar


npm i

Weekly Downloads






Unpacked Size

1.69 MB

Total Files


Last publish


  • agiliumtrade