Skip to main content

MetaApi is a powerful, fast, cost-efficient, easy to use and standards-driven cloud forex trading API for MetaTrader 4 and MetaTrader 5 platform designed for traders, investors and forex application developers to boost forex application development process. MetaApi can be used with any broker and does not require you to be a brokerage.

CopyFactory is a simple yet powerful copy-trading API which is a part of MetaApi. See below for CopyFactory readme section.

MetaApi is a paid service, however we may offer a free tier access in some cases.

The MetaApi pricing was developed with the intent to make your charges less or equal to what you would have to pay for hosting your own infrastructure. This is possible because over time we managed to heavily optimize our MetaTrader infrastructure. And with MetaApi you can save significantly on application development and maintenance costs and time thanks to high-quality API, open-source SDKs and convenience of a cloud service.

Official REST and websocket API documentation: https://metaapi.cloud/docs/client/

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

Please note that this SDK provides an abstraction over REST and websocket API to simplify your application logic.

For more information about SDK APIs please check docstring documentation in source codes located inside lib folder of this package.

Working code examples

Please check this short video to see how you can download samples via our web application.

You can find code examples at examples folder of our github repo or in the examples folder of the pip package.

We have composed a short guide explaining how to use the example code

Installation

pip install metaapi-cloud-sdk

Connecting to MetaApi

Please use one of these ways:

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

  2. An account access token which grants access to a single account. See section below on instructions on how to retrieve account access token.

Supply token to the MetaApi class constructor.

from metaapi_cloud_sdk import MetaApi

token = '...'
api = MetaApi(token=token)

Retrieving account access token

Account access token grants access to a single account. You can retrieve account access token via API:

account_id = '...'
validity_in_hours = 24
account_access_token = await api.token_management_api.narrow_down_token(
    {
        'applications': ['trading-account-management-api', 'copyfactory-api', 'metaapi-rest-api', 'metaapi-rpc-api', 'metaapi-real-time-streaming-api', 'metastats-api', 'risk-management-api'],
        'roles': ['reader'],
        'resources': [{'entity': 'account', 'id': account_id}]

    },
    validity_in_hours
)
print(account_access_token)

Alternatively, you can retrieve account access token via web UI on https://app.metaapi.cloud/accounts page (see this video).

Table of contents

  1. MT account management

  2. MetaApi RPC API

  3. MetaApi real-time streaming API (websocket API)

  4. Risk management API

  5. CopyFactory copy trading API

  6. MetaStats trading statistics API

  7. MetaApi MT manager API

  8. Tracking latencies

  9. Enable log4js logging

  10. Rate limits & quotas

  11. Token management API

  12. Debugging

Release files for metaapi-cloud-sdk 29.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for metaapi-cloud-sdk 29.1.1
File Size Uploaded
metaapi_cloud_sdk-29.1.1.tar.gz 157.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for metaapi-cloud-sdk 29.1.1
File Interpreter ABI Platform
metaapi_cloud_sdk-29.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 338.4 kB

Release files / metaapi_cloud_sdk-29.1.1.tar.gz

Download URL metaapi_cloud_sdk-29.1.1.tar.gz
Size 157.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9b728d5c1f0fd402ad58e346938149ac84114390a0424a747c585d1b5177d818
BLAKE2b-256 checksum
How to use checksums
38fdaabe31fe062c96535223318d874c3f70e61dbceff87057f11dd25086448f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / metaapi_cloud_sdk-29.1.1-py3-none-any.whl

Download URL metaapi_cloud_sdk-29.1.1-py3-none-any.whl
Size 180.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a2b16ab0277614aff8be2c6d02704cb3b4dd75fa946ed64f1445f8d775cf57f0
BLAKE2b-256 checksum
How to use checksums
c37b82237ba89eb5bc343f22b052d59d6252a5fab129ae4cf05ab48725ae062f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

29.1.1 This release

2 release files

29.1.0

2 release files

28.0.7

2 release files

28.0.6

2 release files

28.0.3

2 release files

28.0.2

2 release files

28.0.1

2 release files

28.0.0

2 release files

27.1.1

1 release file

27.1.0

1 release file

27.0.5

1 release file

27.0.4

1 release file

27.0.3

1 release file

21.5.2

1 release file

21.5.1

1 release file

21.5.0

1 release file

21.4.1

1 release file

21.4.0

1 release file

21.3.0

1 release file

21.2.0

1 release file

21.1.1

1 release file

21.1.0

1 release file

21.0.0

1 release file

20.9.1

1 release file

20.9.0

1 release file

20.8.4

1 release file

20.8.3

1 release file

20.8.2

1 release file

19.7.0

1 release file

19.6.0

1 release file

19.5.0

1 release file

19.2.0

1 release file

16.2.0

1 release file

16.1.0

1 release file

16.0.0

1 release file

15.1.3

1 release file

15.1.2

1 release file

15.1.1

1 release file

15.1.0

1 release file

15.0.0

1 release file

14.3.0

1 release file

13.2.2

1 release file

13.2.1

1 release file

13.2.0

1 release file

13.0.0

1 release file

12.4.0

1 release file

12.3.0

1 release file

12.2.0

1 release file

12.1.0

1 release file

12.0.5

1 release file

12.0.4

1 release file

12.0.3

1 release file

12.0.1

1 release file

11.0.0

1 release file

9.1.0

1 release file

9.0.0

1 release file

6.1.0

1 release file

6.0.1

1 release file

6.0.0

1 release file

4.0.0

1 release file

3.0.0

1 release file

2.0.0

1 release file

1.1.4

1 release file

1.1.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page