PyMT5 SDK Documentation¶
ℹ️ Account ID / Session ID: When connecting via
Connect/ConnectEx, MetaRPC automatically generates a terminal session GUID and returns it interminalInstanceGuid. There is no need to callGetIdor supply anidheader prior to connecting. Subsequent calls (such as subscriptions or order requests) use this session ID automatically.
Complete Python SDK for MetaTrader 5 trading automation via gRPC & REST — connect, stream live ticks, and execute trades from any Python application.
Your first project from scratch in 10 minutes. Connect, read your balance, place a trade.
New here? Start with setup, configuration and an overview of how the SDK is organized.
Architecture overview — how low-level, mid-level and sugar layers fit together.
MT5 terms, return codes, enums and concepts — a reference while you build.
Direct gRPC / protobuf layer. Maximum control over every request and response.
Clean wrapper over MT5Account with native Python types and convenience methods.
One-liner operations, risk-based sizing and smart defaults for fast strategies.