Open-source Python SDK for MetaTrader 5

The MT5 API,
reimagined.

An open-source Python package and REST bridge for MetaTrader 5. Free for personal use. Enterprise support for multi-account desks, monitoring and integration.

open-api-mt5 / local server
Account
Connected
login 51234567
Symbol
XAUUSD
bid 2381.64
Open orders
3
2 buy, 1 sell
Equity
$12,408
+1.2% today
pip
One command install
REST
FastAPI endpoints
MIT
Open-source license
Python
>= 3.11

Features

What open-api-mt5 does today.

One-command install

pip install open-api-mt5 then run open-api-mt5 --config server_config.json.

Account connect / disconnect

POST /account/connect with username, password and server; /account/disconnect to switch.

Quotes, ticks and bars

GET /quotes/{symbol}, /ticks/{symbol}, /bars/{symbol}?timeframe=M1&n=100 and /market-depth/{symbol}.

Positions & SL/TP control

Modify SL/TP directly or by money value via /positions/modify and /positions/adjust-by-money.

Live positions WebSocket

Subscribe to /ws/positions/open for snapshots with per-position and total PnL.

News-aware order close

Tag orders with closeOnNews (M15_High, M10_Medium, M5_Low) using the Fair Economy calendar.

Verified package

Install from PyPI.
Connect in minutes.

Verified by PyPI
open-api-mt5 · v0.8.4
Maintainerolza
ReleasedJul 12, 2026
RequiresPython >=3.11
LicenseMIT
View on PyPI
quickstart.mdbash / json
# 1. Install (Python >=3.11, Windows + MT5 terminal)
pip install open-api-mt5

# 2. Create server_config.json
{
  "path": "C:\\Program Files\\MetaTrader 5\\terminal64.exe",
  "username": "12345678",
  "password": "your-password",
  "server": "YourBroker-Server",
  "account": "12345678",
  "port": 8000
}

# 3. Start the API
open-api-mt5 --config server_config.json

# 4. Verify it is running
curl http://127.0.0.1:8000/health
# Swagger UI: http://127.0.0.1:8000/docs

Developer experience

Real code. Real endpoints.

The package exposes a FastAPI service on your local machine. Use curl, Python requests, or any HTTP client.

example.pypython 3.11+
# Connect an MT5 account and read a live quote
import requests

BASE = "http://127.0.0.1:8000"

requests.get(f"{BASE}/health").raise_for_status()

requests.post(f"{BASE}/account/connect", json={
    "username": "12345678",
    "password": "your-password",
    "server": "YourBroker-Server",
    "account": "12345678",
}).raise_for_status()

quote = requests.get(f"{BASE}/quotes/XAUUSD").json()
print(quote["bid"], quote["ask"])

bars = requests.get(
    f"{BASE}/bars/XAUUSD",
    params={"timeframe": "M1", "n": 100},
).json()
print(len(bars), "M1 bars")
Coming to the project

What is next for Scenixa.

The open-source core is shipping now. These layers are on the roadmap for desks that want to scale.

MT5 terminal automation

Headless terminal launch, login and watchdog scripts so the API starts and recovers automatically without manual clicks.

Docker-ready runtime

A containerised deployment path for the open-api-mt5 server with environment-driven config and health checks.

Multi-account API mode

Native support for managing several MT5 accounts from a single API instance — ideal for prop desks and trade copiers.

Account dashboards

A unified view of every connected MT5 account: balance, equity, open positions, PnL and connection health at a glance.

Python scenario management

Author, run and monitor Python automations against your accounts — with logs, run history and one-click rollback.

Pluggable scenarios

Drop-in scenario packages with a clean interface so teams can share, version and reuse strategies without forking the core.

Scenario scheduler

Cron-style scheduling for scenarios — run at market open, on economic events or in recurring windows, per account.