Registry / finance / metaapi-cloud-sdk

metaapi-cloud-sdk

JSON →
library29.1.1pypypi✓ verified 84d ago

SDK for MetaApi, a professional cloud forex API providing MetaTrader REST and websocket APIs for MT4/MT5. Includes CopyFactory copy trading API. Current version 29.1.1, released monthly.

pip install metaapi-cloud-sdk
INSTALL
IMPORT
SIG · METAAPI-CLOUD-SDK
M
metaapi-cloud-sdk
financepythonv29.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

MetaApi
from metaapi_cloud_sdk import MetaApi
from metaapi import MetaApi
Old package name 'metaapi' is deprecated.
CopyFactory
from metaapi_cloud_sdk import CopyFactory
from metaapi_cloud_sdk.copyfactory import CopyFactory
CopyFactory is now directly importable from top-level.

Initialize MetaApi client and list MT4/MT5 accounts.

import os from metaapi_cloud_sdk import MetaApi api = MetaApi(token=os.environ.get('METAAPI_TOKEN', '')) accounts = api.metatrader_account_api.get_accounts() print(accounts)
Debug
Known issues
breakingIn version 29.0.0, the MetaApi class constructor no longer accepts positional arguments for token and region. Use keyword arguments only.
fix
Use MetaApi(token='...', region='...') instead of MetaApi('...', '...').
affects: >=29.0.0
deprecatedThe 'MetaApiSDK' alias is deprecated; use 'MetaApi' directly.
fix
Replace 'from metaapi_cloud_sdk import MetaApiSDK' with 'from metaapi_cloud_sdk import MetaApi'.
affects: >=29.0.0
gotchaUsing an invalid or expired token raises a 401 Unauthorized exception, not a specific token-related error. Always wrap initialization in a try-except.
fix
try:
    api = MetaApi(token=token)
except Exception as e:
    print('Auth failed:', e)
affects: all
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'metaapi'
Importing from the wrong package name; deprecated package 'metaapi' is not installed.
fix
pip install metaapi-cloud-sdk and use import from metaapi_cloud_sdk.
TypeError: __init__() got multiple values for argument 'token'
Passing token as positional argument in MetaApi constructor with additional positional argument for region.
fix
Use keyword arguments: MetaApi(token='...', region='...').
websockets.exceptions.ConnectionClosedError: no close frame received or sent
Network interruption or idle timeout on the WebSocket connection to MetaApi servers.
fix
Reinitialize the client or implement reconnection logic. Ensure your network allows outgoing WebSocket connections on port 443.
Upgrade
Version history
29.1.1latest on PyPI · released Nov 20, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
28 hits · last 30 days
node
25
Bingbot
1
OpenAI (training)
1
Resources
metaapi-cloud-sdk — pip install metaapi-cloud-sdk · libregistry