Metadata-Version: 2.4
Name: LunarTrader
Version: 1.1.2
Summary: A lightweight MetaTrader5 API wrapper with sqlite-backed caching for offline fallbacks.
Author: Bradley Odimmasi
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: numpy
Requires-Dist: numba
Requires-Dist: pandas
Requires-Dist: colorama
Requires-Dist: pytest
Requires-Dist: MetaTrader5; sys_platform == "win32"
Requires-Dist: mt5linux; sys_platform == "linux"
Provides-Extra: dev
Requires-Dist: pytest; extra == "dev"
Dynamic: author
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: license-file
Dynamic: provides-extra
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

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

```bash
python -m pip install -e .
```

For development and test dependencies:

```bash
python -m pip install -e .[dev]
```

## Basic usage

```python
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:

```python
from LunarTrader import MetaTrader5

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

## Running tests

Run the unit tests with:

```bash
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.

