Skip to main content

Lunar-Trader

LunarTrader is a lightweight Python wrapper around MetaTrader5-style APIs with SQLite-backed caching so trading workflows can continue in offline or degraded-network conditions.

Features

  • MetaTrader5-compatible wrapper with account, terminal, symbol, rate, tick, order, position, and deal methods
  • SQLite-backed caching for MT5 data when the live MT5 connection is unavailable
  • OS-aware default cache locations for Linux, macOS, and Windows
  • Platform-aware installation behavior that selects MetaTrader5 on Windows and mt5linux on Linux
  • Test suite that exercises the cache layer and offline fallback path without requiring a live terminal connection

Installation

Install from the repository root:

python -m pip install -e .

For development and test dependencies:

python -m pip install -e .[dev]

Basic usage

from LunarTrader import MetaTrader5

mt5 = MetaTrader5()
print(mt5.mt5_online())
print(mt5.db_online())
print(mt5.version())

You can also provide an explicit cache directory if you want the database stored somewhere other than the default OS-specific location:

from LunarTrader import MetaTrader5

mt5 = MetaTrader5(db_name="mt5", db_dir="/tmp/lunartrader")

Running tests

Run the unit tests with:

python -m pytest -q tests

Notes

The wrapper will use the last cached value whenever a live MT5 connection is unavailable, timed out, or explicitly disabled through the offline mode.

Download files

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

Source Distribution

lunartrader-1.1.2.tar.gz (25.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

lunartrader-1.1.2-py3-none-any.whl (27.5 kB view details)

Uploaded Python 3

File details

Details for the file lunartrader-1.1.2.tar.gz.

File metadata

  • Download URL: lunartrader-1.1.2.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for lunartrader-1.1.2.tar.gz
Algorithm Hash digest
SHA256 5072651fcfb64385a985404c02a6de487bf3ca08fcb29ef24ce084ca4d842b9b
MD5 4be8d028f3dd6af63a88e736aa270d21
BLAKE2b-256 21e101e187d92df50b552d51a692c66057cebb32b2d0e6473a100a774143e3d3

See more details on using hashes here.

File details

Details for the file lunartrader-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: lunartrader-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 27.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for lunartrader-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ca98f271197b3ff44d9710949d74c2cc920a53311ba995a43edc4666b3605c1f
MD5 b7e0fbf3ea72e7a58859d0e79f558c57
BLAKE2b-256 7336b72fc9a36129db772cb0f4ce9e3b70c99f1e7c9068a8097b932fef1b017b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 files

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