A package that uses Wine, RPyC, and a Python Windows version to run MetaTrader5 on Linux.
For an explanation of who should use mt5linux and why, see Motivation and Use Cases.
-
Install Wine.
-
Install Python for Windows on Linux using Wine.
-
Install the MetaTrader5 library on your Windows Python:
pip install MetaTrader5
-
Install this package on both Windows and Linux Python:
pip install mt5linux
Alternatively, you can run this library using Docker, see the docs.
-
Open MetaTrader5.
-
Start the server:
-
Windows (native):
python -m mt5linux
-
Linux (with Wine):
wine python -m mt5linux
The server accepts various options. View them with:
python -m mt5linux --help
-
-
On the Linux side, use the library as usual:
from mt5linux import MetaTrader5 mt5 = MetaTrader5() mt5.initialize() mt5.terminal_info() mt5.shutdown()
For full API documentation, see the official MetaTrader5 Python integration.
- hpdeandrade for many improvements and insights about docker.
- ananta-dev for project motivation.