skillfed

metatrader5

API Connector to MetaTrader 5 Terminal

metatrader5 v5.0.6090 184.4K downloads/30d#10,037 on PyPI
Permissive license MIT Active released

What it is and what it does

MetaTrader 5 for Python is a connector that bridges Python code to the MetaTrader 5 Terminal, a multi-asset trading platform used primarily for Forex and stock market access. It lets you programmatically fetch historical price data (bars and ticks), query instrument metadata, and execute trading operations from Python, automating what would otherwise require manual interaction with the terminal's UI. The package handles platform launch, data synchronization with the broker's server, and data transfer automatically.

The package depends on numpy for data handling and runs on Python 3.6–3.14 on Windows only. It is actively maintained and carries no known security vulnerabilities. Installation requires both the Python package and a working MetaTrader 5 Terminal installation on your system; the package itself is a thin wrapper around the terminal's C API.

Use it for:

  • Fetch historical OHLC bars and tick data for backtesting trading strategies in Python.
  • Automate order placement and position management across multiple instruments via Python scripts.
  • Analyze price data from hundreds of instruments using numpy and pandas without manual terminal interaction.
  • Build algorithmic trading systems that react to real-time market data streamed from MetaTrader 5.
  • Integrate MetaTrader 5 data into a larger Python analytics or machine-learning pipeline.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Connects Python to MetaTrader 5 Terminal to retrieve financial market data (bars, ticks, instrument details) and execute trading operations via the platform's API.

Yes, if you trade or analyze markets via MetaTrader 5 and want to automate data retrieval or trading logic in Python. The package is actively maintained, carries no security issues, and has a permissive license. The main constraint is that it requires Windows and a running MetaTrader 5 Terminal installation—if you lack either, it will not work.

Install

metatrader5 on PyPI

pip

pip install metatrader5

uv

uv add metatrader5

poetry

poetry add metatrader5

Installing metatrader5

Before you install

Medium install friction: Windows-only wheels for Python 3.6–3.14. Requires MetaTrader 5 Terminal installed and running on the system; the package itself is actively maintained with a recent release.

License in practice

MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions.

Quickstart

import metatrader5 as mt5
import numpy as np

mt5.initialize()
rates = mt5.copy_rates_from("EURUSD", mt5.TIMEFRAME_D1, 0, 10)
mt5.shutdown()

MetaTrader 5 Terminal must be installed and running on Windows; the package does not work on macOS or Linux.

Verify before relying

  • Whether the package works with MetaTrader 5 Terminal versions other than the latest.
  • Real-world latency and throughput limits for high-frequency data retrieval.
  • Broker-specific limitations or compatibility issues beyond the platform itself.

Package facts

License MIT (permissive)
Python support supports the current Python release (<4,>=3.6)
Install friction medium — platform-specific wheel
Runtime dependencies 1 — numpy
Maintenance actively maintained — 13 days since the last release
First released
Downloads 184,423/month — #10,037 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: metatrader5-5.0.6090-cp310-cp310-win_amd64.whl; metatrader5-5.0.6090-cp311-cp311-win_amd64.whl; metatrader5-5.0.6090-cp312-cp312-win_amd64.whl; metatrader5-5.0.6090-cp313-cp313-win_amd64.whl; metatrader5-5.0.6090-cp314-cp314-win_amd64.whl; metatrader5-5.0.6090-cp36-cp36m-win_amd64.whl; metatrader5-5.0.6090-cp37-cp37m-win_amd64.whl; metatrader5-5.0.6090-cp38-cp38-win_amd64.whl; metatrader5-5.0.6090-cp39-cp39-win_amd64.whl

Keywords: metatrader, mt5, metaquotes, mql5, forex, currency, exchange

Development Status :: 5 - Production/StableLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.6Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Office/Business :: Financial

Tags

metatrader 5 python apimt5 data connectorforex trading pythonfinancial market data retrievaltrading platform integrationprice data analysismetatrader terminal python
trading-apifinancial-datawindows-only

More Financial packages