Package: metaapi-cloud-metastats-sdk
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 featuresFeatures supported:support for MetaTrader 4 and MetaTrader 5 platformsmetrics calculation for MetaTrader accounts added to MetaApioptionally include open positions in metrics calculationget historical trades for MetaApi account. The historical trades data is updated when you invoke metrics calculation
endpoint or when set query parameter updateHistory to trueget open trades for MetaApi accountThe 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.PricingMetaStats is available to all MetaApi users without extra charges at this point.You pay a fee executing MetaTrader terminal on MetaApi cloud. Seehttps://metaapi.cloud/#pricingfor 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:http://metaapi.cloud/docs/metastats/faq/REST API documentationMetaStats SDK is built on top of MetaStats REST API.MetaStats REST API docs are available athttps://metaapi.cloud/docs/metastats/Code examplesWe published some code examples in our github repository, namely:Python:https://github.com/metaapi/metaapi-metastats-python-sdk/tree/master/examplesInstallationpipinstallmetaapi-cloud-sdkRetrieving API tokenPlease visithttps://app.metaapi.cloud/tokenweb UI to obtain your API token.Configuring trading statisticsfrommetaapi_cloud_sdkimportMetaStatstoken='...'api=MetaStats(token=token)See in-code documentation for full definition of possible configuration options.Retrieving trading statisticsaccount_id='...'#  MetaApi account id# retrieve MetaApi MetaTrader account statisticsprint(awaitmetaStats.get_metrics(account_id=account_id))# retrieve MetaApi MetaTrader account statistics including open positionsprint(awaitmetaStats.get_metrics(account_id=account_id,include_open_positions=True))# retrieve MetaApi MetaTrader account tradesprint(awaitmetaStats.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 tradesprint(awaitmetaStats.get_account_open_trades(account_id=account_id))Quotas and rate limitsAPI calls you make are subject to rate limits. Seehttps://metaapi.cloud/docs/metastats/rateLimiting/for more details.Related projects:See our website for the full list of APIs and features supportedhttps://metaapi.cloud/#featuresSome of the APIs you might decide to use together with this module:MetaApi cloud forex trading APIhttps://metaapi.cloud/docs/client/CopyFactory copy trading  APIhttps://metaapi.cloud/docs/copyfactory/MetaTrader account management APIhttps://metaapi.cloud/docs/provisioning/MetaApi MT manager APIhttps://metaapi.cloud/docs/manager/MetaApi risk management APIhttps://metaapi.cloud/docs/risk-management/