Registry / communication / metatrader5

metatrader5

JSON →
library5.0.5735pypypiunverified

Python interface for connecting to and trading with MetaTrader 5 (MT5) terminal. Current version 5.0.5735; actively maintained with frequent updates mirroring MT5 build changes.

pip install metatrader5
INSTALL
IMPORT
SIG · METATRADER5
M
metatrader5
communicationpythonv5.0.5735
Install
Import
Disk
Pass rate
0/ 10
Env Coverage0 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v? · pip install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
build_error
glibc
py 3.103.95 runs
build_error
Code
Verified usage

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

MetaTrader5
import MetaTrader5 as mt5
from metatrader5 import *
Avoid wildcard import; use mt5 alias convention.

Initialize connection to MT5 terminal (must be running on local machine).

import MetaTrader5 as mt5 if not mt5.initialize(): print("initialize() failed") mt5.shutdown() else: print("MetaTrader5 version:", mt5.__version__) mt5.shutdown()
Debug
Known issues
breakingIn version 5.0.5735, the return type of mt5.copy_rates_from_pos changed from tuple to numpy array. Code expecting list or tuple may break.
fix
Ensure your code handles numpy arrays, or convert: list(mt5.copy_rates_from_pos(...))
affects: >=5.0.5735
gotchamt5.initialize() requires the MT5 terminal to be already running and logged in. Fails silently if terminal is not open.
fix
Always check the return value and print error with mt5.last_error() if available.
affects: all
deprecatedThe function mt5.CopyRates (capital C) was deprecated in favor of mt5.copy_rates_from_pos and mt5.copy_rates_from_range.
fix
Use mt5.copy_rates_from_pos or mt5.copy_rates_from_range with lowercase.
affects: >=5.0.5000
Upgrade
Version history
5.0.5735latest on PyPI · released Apr 4, 2026
Audit
Dependencies
pandasoptionalReturned data frames often used; optional but recommended.
Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
metatrader5 — pip install metatrader5 · libregistry