mt5-httpapi
MetaTrader 5 trading via REST API — get market data, place/modify/close orders, manage positions, pull history. Use when you need to interact with forex/cryp... Skill: mt5-httpapi Owner: psyb0t Summary: MetaTrader 5 trading via REST API — get market data, place/modify/close orders, manage positions, pull history. Use when you need to interact with forex/cryp... Tags: latest:1.1.0 Version history: v1.1.0 | 2026-02-19T16:47:22.192Z | user Initial public release. - Added API reference covering health checks, account info, symbols, orders, positions, and history endpoints. - Inc
Rank
62
Safety
84
Downloads
552
Updated
Apr 15, 2026
Version
1.1.0
Source
CLAWHUB
About
What it does, and when to use it.
Capability contract not published. No trust telemetry is available yet. 552 downloads reported by the source. Last updated 4/15/2026.
Avoid when
- Contract metadata is missing or unavailable for deterministic execution.
Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing
Public facts
Every fact links back to the source it came from.
- Vendor
- Clawhubvendor · observed Apr 15, 2026
- Protocol compatibility
- OpenClawcompatibility · observed Apr 15, 2026
- Adoption signal
- 552 downloadsadoption · observed Apr 15, 2026
- Latest release
- 1.1.0release · observed Feb 19, 2026
- Handshake status
- UNKNOWNsecurity
Install and run
Setup complexity: low.
clawhub skill install kn79dhvmpjng4rp2jjk8k0v5xx80ccbk:mt5-httpapi- Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.
- Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.
Contract: missing
curl -s "https://www.xpersona.co/api/v1/agents/clawhub-psyb0t-mt5-httpapi/snapshot"
Documentation
CLAWHUB
36,419 characters of source documentation, loaded on request.
Extracted files
3 files captured from the source.
SKILL.md
---
name: mt5-httpapi
description: MetaTrader 5 trading via REST API — get market data, place/modify/close orders, manage positions, pull history. Use when you need to interact with forex/crypto/stock markets through MT5.
compatibility: Requires curl and a running mt5-httpapi instance. MT5_API_URL env var must be set.
metadata:
author: psyb0t
homepage: https://github.com/psyb0t/mt5-httpapi
---
# mt5-httpapi
REST API on top of MetaTrader 5 running inside a Windows VM. Talk to it with plain HTTP/JSON — no MT5 libraries, no Windows, no bullshit. Just curl and go.
For installation and setup, see [references/setup.md](references/setup.md).
## Setup
The API should already be running. Set the base URL:
```bash
export MT5_API_URL=http://localhost:6542
```
Each terminal has its own port (configured in `terminals.json`). If running multiple terminals, set `MT5_API_URL` to the port for the terminal you want to talk to.
**Verify:** `curl $MT5_API_URL/ping` — should return `{"status": "ok"}`. If not, the API isn't up yet (may still be initializing — it retries in the background).
## How It Works
GET for reading, POST for creating, PUT for modifying, DELETE for closing/canceling. All bodies are JSON.
Every error response:
```json
{"error": "description of what went wrong"}
```
## Pre-Trade Checks (DO NOT SKIP)
Before placing any trade:
1. `GET /account` → `trade_allowed` must be `true`
2. `GET /symbols/SYMBOL` → `trade_mode` must be `4` (full trading)
3. `GET /symbols/SYMBOL` → check `trade_contract_size` — 1 lot of EURUSD = 100,000 EUR, not 1 EUR
4. `GET /terminal` → `connected` must be `true`
## API Reference
### Health
```bash
curl $MT5_API_URL/ping
# {"status": "ok"}
curl $MT5_API_URL/error
# {"code": 1, "message": "Success"}
```
### Terminal
```bash
curl $MT5_API_URL/terminal
curl -X POST $MT5_API_URL/terminal/init
curl -X POST $MT5_API_URL/terminal/shutdown
```
Key fields on `/terminal`: `connected`, `trade_allowed`, `build`, `company`.
### Account
```bash
curl $MT5_API_URL/account
```
```json
{
"login": 12345678,
"balance": 10000.0,
"equity": 10000.0,
"margin": 0.0,
"margin_free": 10000.0,
"margin_level": 0.0,
"leverage": 500,
"currency": "USD",
"trade_allowed": true,
"margin_so_call": 70.0,
"margin_so_so": 20.0
}
```
### Symbols
```bash
curl $MT5_API_URL/symbols
curl "$MT5_API_URL/symbols?group=*USD*"
curl $MT5_API_URL/symbols/EURUSD
curl $MT5_API_URL/symbols/EURUSD/tick
curl "$MT5_API_URL/symbols/EURUSD/rates?timeframe=H4&count=100"
curl "$MT5_API_URL/symbols/EURUSD/ticks?count=100"
```
Timeframes: `M1` `M2` `M3` `M4` `M5` `M6` `M10` `M12` `M15` `M20` `M30` `H1` `H2` `H3` `H4` `H6` `H8` `H12` `D1` `W1` `MN1`
Key symbol fields: `bid`, `ask`, `digits`, `point`, `trade_contract_size`, `trade_tick_value`, `trade_tick_size`, `volume_min`, `volume_max`, `volume_step`, `spread`, `swap_long`, `swap_short`, `trade_stops_level`, `trade_mode`.
### Orders
```bash
# Place market order
c_meta.json
{
"ownerId": "kn79dhvmpjng4rp2jjk8k0v5xx80ccbk",
"slug": "mt5-httpapi",
"version": "1.1.0",
"publishedAt": 1771519642192
}references/setup.md
# mt5-httpapi setup
## Requirements
- Linux host with KVM enabled (`/dev/kvm`)
- Docker + Docker Compose
- ~10 GB disk (Windows ISO + VM storage)
- 5 GB RAM (runs mostly on swap — tiny11 + debloat idles at ~1.4 GB)
## Quick Install
```bash
git clone https://github.com/psyb0t/mt5-httpapi
cd mt5-httpapi
cp config/accounts.json.example config/accounts.json
cp config/terminals.example.json config/terminals.json
# Edit both files with your broker credentials
```
Drop your broker's MT5 installer in `mt5installers/`, named `mt5setup-<broker>.exe`, then:
```bash
make up
```
First run downloads tiny11 (~4 GB), installs Windows (~10 min), then sets up Python + MT5 automatically. On first boot it debloats Windows, reboots, installs MT5 terminals, reboots again, then starts everything. After that, boots in ~1 min.
## Configuration
### `config/accounts.json`
Broker credentials organized by broker, then account name:
```json
{
"roboforex": {
"main": {
"login": 12345678,
"password": "your_password",
"server": "RoboForex-Pro"
}
}
}
```
### `config/terminals.json`
Which terminals to run — each gets its own MT5 instance and API port:
```json
[
{
"broker": "roboforex",
"account": "main",
"port": 6542
},
{
"broker": "roboforex",
"account": "demo",
"port": 6543
}
]
```
`broker` matches both the `mt5setup-<broker>.exe` installer name and the key in `accounts.json`. Each terminal installs to `<broker>/base/` and gets copied to `<broker>/<account>/` at startup so multiple accounts of the same broker don't conflict.
## Ports
| Port | Service |
| ----- | ------------------ |
| 8006 | noVNC (VM desktop) |
| 6542+ | HTTP API per terminal (set in terminals.json) |
noVNC is mainly useful for watching the install progress. After that, just use the REST API.
## Management
```bash
make up # start
make down # stop
make logs # tail logs
make status # check status
make clean # nuke VM disk (keeps ISO)
make distclean # nuke everything including ISO
```
## Logs
Inside the VM shared folder (`data/metatrader5/logs/`):
- `install.log` — MT5 installation progress
- `setup.log` — boot-time setup output
- `pip.log` — Python package install
- `api-<broker>-<account>.log` — per-terminal API logsactivepieces
AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
cherry-studio
AI productivity studio with smart chat, autonomous agents, and 300+ assistants.
AionUi
Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!
CopilotKit
The Frontend for Agents & Generative UI. React + Angular
Machine-readable data
The same record, as JSON, for agents and crawlers.
{
"facts": [
{
"factKey": "vendor",
"category": "vendor",
"label": "Vendor",
"value": "Clawhub",
"href": "https://clawhub.ai/psyb0t/mt5-httpapi",
"sourceUrl": "https://clawhub.ai/psyb0t/mt5-httpapi",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-04-15T00:45:39.800Z",
"isPublic": true
},
{
"factKey": "protocols",
"category": "compatibility",
"label": "Protocol compatibility",
"value": "OpenClaw",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-psyb0t-mt5-httpapi/contract",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-psyb0t-mt5-httpapi/contract",
"sourceType": "contract",
"confidence": "medium",
"observedAt": "2026-04-15T00:45:39.800Z",
"isPublic": true
},
{
"factKey": "traction",
"category": "adoption",
"label": "Adoption signal",
"value": "552 downloads",
"href": "https://clawhub.ai/psyb0t/mt5-httpapi",
"sourceUrl": "https://clawhub.ai/psyb0t/mt5-httpapi",
"sourceType": "profile",
"confidence": "medium",
"observedAt": "2026-04-15T00:45:39.800Z",
"isPublic": true
},
{
"factKey": "latest_release",
"category": "release",
"label": "Latest release",
"value": "1.1.0",
"href": "https://clawhub.ai/psyb0t/mt5-httpapi",
"sourceUrl": "https://clawhub.ai/psyb0t/mt5-httpapi",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-02-19T16:47:22.192Z",
"isPublic": true
},
{
"factKey": "handshake_status",
"category": "security",
"label": "Handshake status",
"value": "UNKNOWN",
"href": "https://www.xpersona.co/api/v1/agents/clawhub-psyb0t-mt5-httpapi/trust",
"sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-psyb0t-mt5-httpapi/trust",
"sourceType": "trust",
"confidence": "medium",
"observedAt": null,
"isPublic": true
}
],
"events": [
{
"eventType": "release",
"title": "Release 1.1.0",
"description": "Initial public release. - Added API reference covering health checks, account info, symbols, orders, positions, and history endpoints. - Included detailed field/key descriptions for safer pre-trade checks and parameter usage. - Provided concise setup instructions and example curl commands for all major endpoints. - Documented example position sizing calculations and helpful trading tips. - Added dedicated [references/setup.md] file for installation details.",
"href": "https://clawhub.ai/psyb0t/mt5-httpapi",
"sourceUrl": "https://clawhub.ai/psyb0t/mt5-httpapi",
"sourceType": "release",
"confidence": "medium",
"observedAt": "2026-02-19T16:47:22.192Z",
"isPublic": true
}
]
}Record generated Oct 9, 2026.
