Skip to main content

Python SDK for MetaStats forex trading statistics API. Can calculate metrics for MetaTrader accounts added to MetaApi. Supports both MetaTrader 5 (MT5) and MetaTrader 4 (MT4). (https://metaapi.cloud)

Project description

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 (https://metaapi.cloud), a powerful cloud forex trading API which supports both MetaTrader 4 and MetaTrader 5 platforms.

This SDK requires a 3.8+ version of Python to run.

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.

Pricing

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

You pay a fee executing MetaTrader terminal on MetaApi cloud. See https://metaapi.cloud/#pricing for more details. In some cases a free tier access can be available.

Frequently asked questions (FAQ)

FAQ is located here: http://metaapi.cloud/docs/metastats/faq/

REST API documentation

MetaStats SDK is built on top of MetaStats REST API.

MetaStats REST API docs are available at https://metaapi.cloud/docs/metastats/

Code examples

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

Installation

pip install metaapi-cloud-sdk

Retrieving API token

Please visit https://app.metaapi.cloud/token web UI to obtain your API token.

Configuring trading statistics

from metaapi_cloud_sdk import MetaStats

token = '...'
api = MetaStats(token=token)

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

Retrieving trading statistics

account_id = '...'  #  MetaApi account id

# retrieve MetaApi MetaTrader account statistics
print(await metaStats.get_metrics(account_id=account_id))

# retrieve MetaApi MetaTrader account statistics including open positions
print(await metaStats.get_metrics(account_id=account_id, include_open_positions=True))

# retrieve MetaApi MetaTrader account trades
print(await metaStats.get_account_trades(account_id=account_id, start_time='2020-01-01 00:00:00.000',
                                         end_time='2021-01-01 00:00:00.000'))

# retrieve MetaApi MetaTrader account open trades
print(await metaStats.get_account_open_trades(account_id=account_id))

# reset MetaApi MetaTrader account metrics
print(await metaStats.reset_metrics(account_id=account_id))

Quotas and rate limits

API calls you make are subject to rate limits. See https://metaapi.cloud/docs/metastats/rateLimiting/ for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

metaapi_cloud_metastats_sdk-5.1.0.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

metaapi_cloud_metastats_sdk-5.1.0-py3-none-any.whl (22.0 kB view details)

Uploaded Python 3

File details

Details for the file metaapi_cloud_metastats_sdk-5.1.0.tar.gz.

File metadata

File hashes

Hashes for metaapi_cloud_metastats_sdk-5.1.0.tar.gz
Algorithm Hash digest
SHA256 3eb380973b24358fd00715b329bef9ae255e4b2122674e96c391fb8a2ac118bd
MD5 33e43bec42fb1cfa4ee04b38b78e0f40
BLAKE2b-256 223ef1956c5ccb2e92ab9f16a465615f23f4acfe7acd7903dd5af4346dc23cf4

See more details on using hashes here.

File details

Details for the file metaapi_cloud_metastats_sdk-5.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for metaapi_cloud_metastats_sdk-5.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 001f4cbc30f41908cb851cf9652c7f8c5915421387df79cb83b36a7f85d7ad8a
MD5 808ee9ee26d29bf7c8755d2e0ce94193
BLAKE2b-256 8f733a294b33ae6d7131c186a8d200a5076690b7bc265f548735ba28100d361b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page