Skip to main content

pyOMT5 - Python Open MetaTrader 5

Python module to request data from MetaTrader 5

To get started:

  • install visual c++ 2010 redistributable (x86 or x64 according with your os)
  • install visual c++ 2015 redistributable (x86 or x64 according with your os)
  • create a new directory called pyOMT5 inside your MT5 Scrips folder. Ex: C:\Users\MyUser\AppData\Roaming\MetaQuotes\Terminal\83D4764E0403A8685E84D6FCAB361AAB\MQL5\Scripts\pyOMT5
  • download DLL files according your OS (32|64 Bits) from ZMQ to the new direcotry called pyOMT5
  • copy the files pyOMT5Server.mq5 and pyOMT5Server.ex5 from util directory called pyOMT5 to this new directory and compile it using MetaEditor if necessary.
  • run pyOMT5Server as a expert. Remember to have enabled auto trading option and allow DLLs imports when asked.

This module provides data in pandas representation because we believe that whether in finance, scientific fields, or data science, a familiarity with Pandas is known by everyone.

This library uses ZeroMQ and create a internal tcp server on MetaTrader, with the purpose of exchange data with MT5.

Install

To install the package use:

pip install pyOMT5

If you want to install from source, then use:

git clone https://github.com/paulorodriguesxv/pyOMT5.git
pip install -e pyOMT5

Usage

from datetime import datetime
from pyomt5.api import MT5TimeFrame
from pyomt5.stock import StockPriceHistory

c = StockPriceHistory()

start_date = datetime(2019, 1, 1)
end_date = datetime(2019, 5, 2)
data = c.get_price_from(symbol='PETR4',
                        from_date=start_date,
                        to_date=end_date,
                        timeframe=MT5TimeFrame.Daily)

print(data)

start_date = datetime(2019, 1, 2, 10, 0)
end_date = datetime(2019, 1, 2, 12, 0, 0)
data = c.get_price_from(symbol='PETR4',
                        from_date=start_date,
                        to_date=end_date,
                        timeframe=MT5TimeFrame.M5)

print(data)

Contributing

Contributing is always welcome, so, feel free to getting in touch and contribute.

TODOs

  • Add test for library.
  • Create sphinx docs
  • Create travis
  • Extend Api

Star if you like it.

If you like or use this project, consider showing your support by starring it.

Release files for pyOMT5 0.0.29

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyOMT5 0.0.29
File Size Uploaded
pyOMT5-0.0.29.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyOMT5 0.0.29
File Interpreter ABI Platform
pyOMT5-0.0.29-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 12.1 kB

Release files / pyOMT5-0.0.29.tar.gz

Download URL pyOMT5-0.0.29.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
99fd92b8a45d9c155fd67e5aa8291ad5cb6eb993b849b67ece2a254def47af96
BLAKE2b-256 checksum
How to use checksums
ad6ab700cf20f98f80c7ee6c9e5798c00e665cc1c3e3edebb18c3a1a8027b29d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6

Release files / pyOMT5-0.0.29-py2.py3-none-any.whl

Download URL pyOMT5-0.0.29-py2.py3-none-any.whl
Size 6.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
22c3098c29c411887a79d1ce496d1e37f7920e386fc0434e1915918103f2f8f9
BLAKE2b-256 checksum
How to use checksums
ed1fcb291bf49febae1803e987538cf55336e15d320ba3c0bb37239475c62995
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.6

Release history Release notifications | RSS feed

This release

0.0.29 This release

2 release files

0.0.28

2 release files

0.0.27

2 release files

0.0.26

2 release files

0.0.25

2 release files

0.0.24

2 release files

0.0.23

2 release files

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page