Detailed Comparison With Official MetaTrader5 Python API
This page compares the official MetaTrader5 Python package function set
published on MQL5 Python Integration
with the current pymt5 client as checked on 2026-03-17.
What Is Being Compared
The official package talks to a locally installed desktop terminal. pymt5
talks to the public MT5 Web Terminal over the reverse-engineered WebSocket
protocol. Because of that, the names now line up closely, but some semantics
do not:
Official package: synchronous module-level functions such as
mt5.initialize()andmt5.order_send()pymt5: async instance methods such asawait client.initialize()andawait client.order_send({...})Official package: terminal-managed snapshots, namedtuples, and array-like return types
pymt5: dicts, lists, and dataclasses, with some views reconstructed from push streams or local formulas
Status Labels
Direct: backed by a confirmed Web Terminal command or response pathDerived: built from another command, cached push data, or local filteringBest-effort: exposed publicly, but not backed by a dedicated Web Terminal RPC with fully equivalent semantics
Connection, Session, and Terminal Metadata
Official function |
|
Status |
Notes |
|---|---|---|---|
|
|
Direct |
Maps to |
|
|
Direct |
Logs in through the Web Terminal protocol. |
|
|
Direct |
Closes the WebSocket session instead of detaching from a desktop terminal process. |
|
|
Best-effort |
Returns |
|
|
Best-effort |
Tracks compatibility-layer failures in |
|
|
Direct |
Alias for |
|
|
Best-effort |
Exposes only the server/build/timezone/trade-right subset that the Web account config can prove. Desktop-only filesystem and community fields are intentionally omitted. |
Symbols, MarketWatch, and DOM
Official function |
|
Status |
Notes |
|---|---|---|---|
|
|
Direct |
Counts cached symbols or fetches the Web symbol list directly. |
|
|
Direct |
Backed by |
|
|
Direct |
Uses |
|
|
Derived |
Returns the latest cached |
|
|
Derived |
Implemented as tick subscription management, not persistent desktop MarketWatch visibility. |
|
|
Direct |
Uses |
|
|
Derived |
Returns the last cached |
|
|
Direct |
Removes the symbol from the current DOM subscription set. |
Bars and Ticks
Official function |
|
Status |
Notes |
|---|---|---|---|
|
|
Direct |
Thin wrapper over |
|
|
Derived |
Fetches a bar range through |
|
|
Derived |
Reconstructs current-bar-relative access by requesting enough history and slicing in client code. |
|
|
Derived |
Returns cached tick history assembled from observed |
|
|
Derived |
Same cached-stream model as |
Orders, Positions, History, and Calculations
Official function |
|
Status |
Notes |
|---|---|---|---|
|
|
Direct |
Built on the current pending-order view from |
|
|
Direct |
Supports |
|
|
Direct |
Built on the current open-position view from |
|
|
Direct |
Supports |
|
|
Direct |
Counts locally filtered historical orders from |
|
|
Direct |
Supports |
|
|
Direct |
Counts locally filtered deals from |
|
|
Direct |
Supports |
|
|
Direct |
Wraps |
|
|
Best-effort |
Local pre-flight validator only. It checks symbol rules, stops,
expiration, fill mode, and margin sufficiency without a dedicated server
|
|
|
Best-effort |
Uses local formulas plus cached FX conversion quotes. Common forex/CFD/ futures/stock/bond modes are covered; broker-specific margin tiers remain approximate. |
|
|
Best-effort |
Same local-formula model as |
No Official Equivalent In The Desktop Package
pymt5 also exposes Web-Terminal-specific or protocol-level helpers that do
not have a direct official desktop-package counterpart:
Account onboarding and verification:
request_opening_verification(),submit_opening_verification(),open_demo_account(),open_real_account()OTP and verification helpers:
verify_code(),enable_otp(),disable_otp()Web-only broker/UI commands:
trader_params(),send_notification(),get_corporate_links()Protocol escape hatches:
send_raw_command(),send_bootstrap_command_52()Async stream callbacks:
on_tick(),on_book_update(),on_trade_result(), and the other push-handler registrationsHigh-level trade ergonomics:
buy_market(),sell_market(),buy_limit(),sell_limit(),buy_stop(),sell_stop(),buy_stop_limit(),sell_stop_limit(),close_position(),close_position_by(),modify_position_sltp(),modify_pending_order(),cancel_pending_order()
Practical Conclusion
At the interface level, pymt5 now covers the same official function names
that matter for trading, symbols, positions, orders, rates, ticks, history,
and terminal/account metadata. The real differences are semantic:
the official package is desktop-terminal IPC, while
pymt5is Web Terminal WebSocket transportsome official snapshot APIs are modeled as cached views in
pymt5some terminal-side calculations are modeled as local best-effort formulas
return shapes are Pythonic dict/list/dataclass structures rather than official namedtuple or array-oriented results
For a shorter status-only summary, see Official Python API Compatibility.