Skip to main content

SDK for MetaApi, a professional cloud forex API which includes MetaTrader REST API and MetaTrader websocket API. Supports both MetaTrader 5 (MT5) and MetaTrader 4 (MT4). CopyFactory copy trading API included. (https://metaapi.cloud)

Project description

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

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_sdk-28.0.7.tar.gz (286.4 kB view details)

Uploaded Source

Built Distribution

metaapi_cloud_sdk-28.0.7-py3-none-any.whl (325.4 kB view details)

Uploaded Python 3

File details

Details for the file metaapi_cloud_sdk-28.0.7.tar.gz.

File metadata

  • Download URL: metaapi_cloud_sdk-28.0.7.tar.gz
  • Upload date:
  • Size: 286.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.21

File hashes

Hashes for metaapi_cloud_sdk-28.0.7.tar.gz
Algorithm Hash digest
SHA256 f6e262c709309de564b95d1d62e55de2e10f5991e9c7393e8c8a3e5fa3e3e6d4
MD5 060ad9075052e47f25bfc194b21250be
BLAKE2b-256 5a37306acb462a792e669f8f37e197a1312d4c89b35804c7517138833cd84880

See more details on using hashes here.

File details

Details for the file metaapi_cloud_sdk-28.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for metaapi_cloud_sdk-28.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 68b49180a4ff4f623f11c4987c6b1072f24491b464be5ba75474205b3e4e7b5f
MD5 e96688a7d71e55acdd0fff2b87e99726
BLAKE2b-256 032df89c426f3c057cb3bd6de791ed288266ce2ca313973db0ec5c0aaca6b97e

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