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.

Metadata

Release files for LunarTrader 1.1.2

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

Source distribution (sdist)

Source distribution for LunarTrader 1.1.2
File Size Uploaded
lunartrader-1.1.2.tar.gz 25.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for LunarTrader 1.1.2
File Interpreter ABI Platform
lunartrader-1.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 52.7 kB

Release files / lunartrader-1.1.2.tar.gz

Download URL lunartrader-1.1.2.tar.gz
Size 25.2 kB
Tags Source
SHA-256 checksum
How to use checksums
5072651fcfb64385a985404c02a6de487bf3ca08fcb29ef24ce084ca4d842b9b
BLAKE2b-256 checksum
How to use checksums
21e101e187d92df50b552d51a692c66057cebb32b2d0e6473a100a774143e3d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / lunartrader-1.1.2-py3-none-any.whl

Download URL lunartrader-1.1.2-py3-none-any.whl
Size 27.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ca98f271197b3ff44d9710949d74c2cc920a53311ba995a43edc4666b3605c1f
BLAKE2b-256 checksum
How to use checksums
7336b72fc9a36129db772cb0f4ce9e3b70c99f1e7c9068a8097b932fef1b017b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

1.1.2 This release

2 release 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