Skip to main content

pyOMT5 - Python Open Metatrader 5 module

Project description

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:UsersMyUserAppDataRoamingMetaQuotesTerminal83D4764E0403A8685E84D6FCAB361AABMQL5ScriptspyOMT5

  • 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyOMT5-0.0.25.tar.gz (5.6 kB view hashes)

Uploaded Source

Built Distribution

pyOMT5-0.0.25-py2.py3-none-any.whl (6.6 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page