mt5api 1.0.4__tar.gz → 1.0.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mt5api-1.0.4 → mt5api-1.0.5}/PKG-INFO +1 -2
- {mt5api-1.0.4 → mt5api-1.0.5}/pyproject.toml +4 -2
- mt5api-1.0.4/.agents/skills/local-qa/SKILL.md +0 -22
- mt5api-1.0.4/.agents/skills/local-qa/scripts/qa.sh +0 -32
- mt5api-1.0.4/.agents/skills/mt5api/SKILL.md +0 -396
- mt5api-1.0.4/.github/CODEOWNERS +0 -2
- mt5api-1.0.4/.github/FUNDING.yml +0 -3
- mt5api-1.0.4/.github/dependabot.yml +0 -17
- mt5api-1.0.4/.github/renovate.json +0 -13
- mt5api-1.0.4/.github/workflows/ci.yml +0 -92
- mt5api-1.0.4/.github/workflows/claude.yml +0 -57
- mt5api-1.0.4/.github/workflows/release.yml +0 -44
- mt5api-1.0.4/AGENTS.md +0 -38
- mt5api-1.0.4/CLAUDE.md +0 -1
- mt5api-1.0.4/docs/api/deployment.md +0 -62
- mt5api-1.0.4/docs/api/index.md +0 -69
- mt5api-1.0.4/docs/api/rest-api.md +0 -336
- mt5api-1.0.4/docs/index.md +0 -75
- mt5api-1.0.4/mkdocs.yml +0 -72
- mt5api-1.0.4/tests/__init__.py +0 -1
- mt5api-1.0.4/tests/conftest.py +0 -231
- mt5api-1.0.4/tests/mt5_constants.py +0 -75
- mt5api-1.0.4/tests/openapi_mt5_constants.py +0 -34
- mt5api-1.0.4/tests/test_account.py +0 -78
- mt5api-1.0.4/tests/test_auth.py +0 -177
- mt5api-1.0.4/tests/test_calc.py +0 -312
- mt5api-1.0.4/tests/test_cli.py +0 -127
- mt5api-1.0.4/tests/test_config.py +0 -213
- mt5api-1.0.4/tests/test_connection.py +0 -318
- mt5api-1.0.4/tests/test_dependencies.py +0 -205
- mt5api-1.0.4/tests/test_formatters.py +0 -182
- mt5api-1.0.4/tests/test_health.py +0 -256
- mt5api-1.0.4/tests/test_history.py +0 -394
- mt5api-1.0.4/tests/test_lifespan.py +0 -30
- mt5api-1.0.4/tests/test_main.py +0 -215
- mt5api-1.0.4/tests/test_market.py +0 -493
- mt5api-1.0.4/tests/test_middleware.py +0 -221
- mt5api-1.0.4/tests/test_models.py +0 -295
- mt5api-1.0.4/tests/test_symbols.py +0 -160
- mt5api-1.0.4/tests/test_trading.py +0 -308
- mt5api-1.0.4/uv.lock +0 -1742
- {mt5api-1.0.4 → mt5api-1.0.5}/.gitignore +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/LICENSE +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/README.md +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/mt5api/__init__.py +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/mt5api/__main__.py +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/mt5api/auth.py +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/mt5api/config.py +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/mt5api/constants.py +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/mt5api/dependencies.py +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/mt5api/formatters.py +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/mt5api/main.py +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/mt5api/middleware.py +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/mt5api/models.py +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/mt5api/routers/__init__.py +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/mt5api/routers/account.py +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/mt5api/routers/calc.py +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/mt5api/routers/connection.py +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/mt5api/routers/health.py +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/mt5api/routers/history.py +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/mt5api/routers/market.py +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/mt5api/routers/symbols.py +0 -0
- {mt5api-1.0.4 → mt5api-1.0.5}/mt5api/routers/trading.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mt5api
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.5
|
|
4
4
|
Summary: MetaTrader 5 REST API
|
|
5
5
|
Project-URL: Repository, https://github.com/dceoy/mt5api.git
|
|
6
6
|
Author-email: dceoy <dceoy@users.noreply.github.com>
|
|
@@ -21,7 +21,6 @@ Requires-Dist: pandas>=3.0.3
|
|
|
21
21
|
Requires-Dist: pdmt5>=1.2.0
|
|
22
22
|
Requires-Dist: pyarrow>=18.0.0
|
|
23
23
|
Requires-Dist: pydantic>=2.13.4
|
|
24
|
-
Requires-Dist: python-multipart>=0.0.31
|
|
25
24
|
Requires-Dist: uvicorn[standard]>=0.32.0
|
|
26
25
|
Description-Content-Type: text/markdown
|
|
27
26
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "mt5api"
|
|
3
|
-
version = "1.0.
|
|
3
|
+
version = "1.0.5"
|
|
4
4
|
description = "MetaTrader 5 REST API"
|
|
5
5
|
authors = [{name = "dceoy", email = "dceoy@users.noreply.github.com"}]
|
|
6
6
|
maintainers = [{name = "dceoy", email = "dceoy@users.noreply.github.com"}]
|
|
@@ -15,7 +15,6 @@ dependencies = [
|
|
|
15
15
|
"pandas >= 3.0.3",
|
|
16
16
|
"pydantic >= 2.13.4",
|
|
17
17
|
"pyarrow >= 18.0.0",
|
|
18
|
-
"python-multipart >= 0.0.31",
|
|
19
18
|
]
|
|
20
19
|
classifiers = [
|
|
21
20
|
"Development Status :: 4 - Beta",
|
|
@@ -55,6 +54,9 @@ dev = [
|
|
|
55
54
|
"mkdocstrings[python] >= 0.29.1",
|
|
56
55
|
]
|
|
57
56
|
|
|
57
|
+
[tool.hatch.build.targets.sdist]
|
|
58
|
+
only-include = ["mt5api"]
|
|
59
|
+
|
|
58
60
|
[tool.hatch.build.targets.wheel]
|
|
59
61
|
packages = ["mt5api"]
|
|
60
62
|
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: local-qa
|
|
3
|
-
description: Run local QA including formatting, linting, and testing for the repository. Use whenever any file has been updated.
|
|
4
|
-
disable-model-invocation: false
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Local QA (format, lint, and test)
|
|
8
|
-
|
|
9
|
-
Run the local QA script `scripts/qa.sh` in this skill.
|
|
10
|
-
|
|
11
|
-
## Procedure
|
|
12
|
-
|
|
13
|
-
- Execute the script exactly as shown above when this skill is triggered.
|
|
14
|
-
- Capture and summarize key output (success/failure, major warnings, and any files modified).
|
|
15
|
-
- If the script fails due to missing tooling (`command not found`, missing executable, or equivalent), install the missing tool(s) and rerun `./scripts/qa.sh`.
|
|
16
|
-
- Install tools using this order of preference:
|
|
17
|
-
1. Use the project's package manager when applicable (`uv`/`poetry` for Python, package manager scripts/dependencies for Node.js).
|
|
18
|
-
2. Use a system package manager (`brew` on macOS, `apt` on Debian/Ubuntu) when project-local install is not applicable.
|
|
19
|
-
3. Use language-specific installers as fallback (`pipx`/`pip`, `npm`, `go install`, etc.).
|
|
20
|
-
- If multiple tools are missing, repeat install -> rerun until QA completes or you hit a blocker.
|
|
21
|
-
- If installation fails or requires unavailable privileges, report what was attempted, the exact failure, and stop.
|
|
22
|
-
- Do not run unrelated commands; only run commands needed for QA and missing-tool installation.
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
set -euox pipefail
|
|
4
|
-
cd "$(git rev-parse --show-toplevel)"
|
|
5
|
-
|
|
6
|
-
COOLDOWN_DAYS=7
|
|
7
|
-
export UV_EXCLUDE_NEWER="${COOLDOWN_DAYS} days"
|
|
8
|
-
export NPM_CONFIG_MIN_RELEASE_AGE="${COOLDOWN_DAYS}"
|
|
9
|
-
export PNPM_CONFIG_MINIMUM_RELEASE_AGE=$((COOLDOWN_DAYS * 24 * 60))
|
|
10
|
-
|
|
11
|
-
# Python
|
|
12
|
-
uv sync
|
|
13
|
-
uv run ruff format .
|
|
14
|
-
uv run ruff check --fix .
|
|
15
|
-
uv run pyright .
|
|
16
|
-
uv run pytest
|
|
17
|
-
|
|
18
|
-
# Markdown
|
|
19
|
-
npx -y prettier --write './**/*.md'
|
|
20
|
-
|
|
21
|
-
# GitHub Actions
|
|
22
|
-
case "${OSTYPE}" in
|
|
23
|
-
darwin* | linux* )
|
|
24
|
-
zizmor --fix=safe .github/workflows
|
|
25
|
-
git ls-files -z -- '.github/workflows/*.yml' | xargs -0 -t actionlint
|
|
26
|
-
git ls-files -z -- '.github/workflows/*.yml' | xargs -0 -t yamllint -d '{"extends": "relaxed", "rules": {"line-length": "disable"}}'
|
|
27
|
-
checkov --framework=all --output=github_failed_only --directory=.
|
|
28
|
-
;;
|
|
29
|
-
* )
|
|
30
|
-
echo "GitHub Actions linting is only supported on Linux and macOS."
|
|
31
|
-
;;
|
|
32
|
-
esac
|
|
@@ -1,396 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: mt5api
|
|
3
|
-
description: >-
|
|
4
|
-
Query the MT5 API for account info, terminal status, health checks, symbol
|
|
5
|
-
data, market data (OHLCV rates, ticks, market depth), open positions, pending
|
|
6
|
-
orders, trade history, and reconnecting the MT5 terminal with new
|
|
7
|
-
credentials. Use when the user wants to interact with any mt5api endpoint.
|
|
8
|
-
allowed-tools: Bash
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# MT5 API
|
|
12
|
-
|
|
13
|
-
Query all mt5api endpoints: health, version, account, terminal, symbols, market
|
|
14
|
-
data, positions, orders, and trade history.
|
|
15
|
-
|
|
16
|
-
## Configuration
|
|
17
|
-
|
|
18
|
-
The API base URL defaults to `http://localhost:8000`. Set `MT5API_URL` to
|
|
19
|
-
override. When the server is configured with `MT5API_SECRET_KEY`, send the same value
|
|
20
|
-
in the `X-API-Key` header. When server-side auth is disabled, omit the header
|
|
21
|
-
instead of sending an empty `X-API-Key`.
|
|
22
|
-
|
|
23
|
-
Use these shell helpers in examples:
|
|
24
|
-
|
|
25
|
-
```bash
|
|
26
|
-
MT5API_URL="${MT5API_URL:-http://localhost:8000}"
|
|
27
|
-
AUTH_HEADER=()
|
|
28
|
-
if [ -n "${MT5API_SECRET_KEY:-}" ]; then
|
|
29
|
-
AUTH_HEADER=(-H "X-API-Key: ${MT5API_SECRET_KEY}")
|
|
30
|
-
fi
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Login credentials for `/connection/login` are read from the environment so
|
|
34
|
-
the password is never hard-coded in a command:
|
|
35
|
-
|
|
36
|
-
| Variable | Description | Required for login |
|
|
37
|
-
| ----------------- | ------------------------------------------ | ------------------ |
|
|
38
|
-
| `MT5API_LOGIN` | Trading account login (integer) | yes |
|
|
39
|
-
| `MT5API_PASSWORD` | Trading account password | yes |
|
|
40
|
-
| `MT5API_SERVER` | Trading server name (e.g., `Broker-Demo`) | yes |
|
|
41
|
-
| `MT5API_TIMEOUT` | Connection timeout in milliseconds (`> 0`) | no |
|
|
42
|
-
|
|
43
|
-
## Response Formats
|
|
44
|
-
|
|
45
|
-
All endpoints (except `/health`) return JSON by default. Request Parquet with
|
|
46
|
-
`format=parquet` or `Accept: application/parquet`.
|
|
47
|
-
|
|
48
|
-
## Operational Notes
|
|
49
|
-
|
|
50
|
-
- Start `ticks/range` with a narrow window. Large ranges can be slow; use
|
|
51
|
-
`ticks/from` when the user only needs the latest `N` ticks.
|
|
52
|
-
- `/market-book/{symbol}` may return `503` when MT5 depth-of-market data is not
|
|
53
|
-
available for the symbol. Report the exact MT5 error and suggest another
|
|
54
|
-
symbol or skipping DOM data.
|
|
55
|
-
- Empty arrays from `/positions`, `/orders`, `/history/orders`, or
|
|
56
|
-
`/history/deals` are valid results.
|
|
57
|
-
- `/connection/login` reconnects the shared MT5 client to a different account.
|
|
58
|
-
It shuts down the current connection and releases any active market-book
|
|
59
|
-
subscriptions before logging in. Never echo the password back to the user
|
|
60
|
-
and do not log it; the response only confirms `login`, `server`, `timeout`,
|
|
61
|
-
and `connected`.
|
|
62
|
-
|
|
63
|
-
---
|
|
64
|
-
|
|
65
|
-
## Health & Version
|
|
66
|
-
|
|
67
|
-
### Health Check (public, no auth required)
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
curl -s "${MT5API_URL}/health" | python -m json.tool
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Returns:
|
|
74
|
-
|
|
75
|
-
| Field | Type | Description |
|
|
76
|
-
| ------------- | ------- | ------------------------------ |
|
|
77
|
-
| status | string | `healthy` or `unhealthy` |
|
|
78
|
-
| mt5_connected | bool | MT5 terminal connection status |
|
|
79
|
-
| mt5_version | string? | MT5 terminal version string |
|
|
80
|
-
| api_version | string | API version (e.g., `1.0.0`) |
|
|
81
|
-
|
|
82
|
-
### MT5 Version
|
|
83
|
-
|
|
84
|
-
```bash
|
|
85
|
-
curl -s "${AUTH_HEADER[@]}" \
|
|
86
|
-
"${MT5API_URL}/version" | python -m json.tool
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
| Parameter | Type | Required | Description |
|
|
90
|
-
| --------- | ------ | -------- | ------------------------ |
|
|
91
|
-
| format | string | no | Response format override |
|
|
92
|
-
|
|
93
|
-
---
|
|
94
|
-
|
|
95
|
-
## Connection
|
|
96
|
-
|
|
97
|
-
### Reconnect to MT5
|
|
98
|
-
|
|
99
|
-
Shut down the current MT5 client and reconnect with new credentials. Active
|
|
100
|
-
market-book subscriptions are released first. The call is serialized so
|
|
101
|
-
concurrent reconnect attempts do not race. The password is sent only in the
|
|
102
|
-
request body and is never echoed in the response.
|
|
103
|
-
|
|
104
|
-
```bash
|
|
105
|
-
# Build JSON body from env vars; include timeout only when set
|
|
106
|
-
LOGIN_BODY=$(python3 -c "
|
|
107
|
-
import json, os, sys
|
|
108
|
-
body = {
|
|
109
|
-
'login': int(os.environ['MT5API_LOGIN']),
|
|
110
|
-
'password': os.environ['MT5API_PASSWORD'],
|
|
111
|
-
'server': os.environ['MT5API_SERVER'],
|
|
112
|
-
}
|
|
113
|
-
t = os.environ.get('MT5API_TIMEOUT')
|
|
114
|
-
if t:
|
|
115
|
-
body['timeout'] = int(t)
|
|
116
|
-
print(json.dumps(body))
|
|
117
|
-
")
|
|
118
|
-
curl -s -X POST "${AUTH_HEADER[@]}" \
|
|
119
|
-
-H 'Content-Type: application/json' \
|
|
120
|
-
-d "${LOGIN_BODY}" \
|
|
121
|
-
"${MT5API_URL}/connection/login" | python -m json.tool
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
Request body:
|
|
125
|
-
|
|
126
|
-
| Field | Type | Required | Description |
|
|
127
|
-
| -------- | ------ | -------- | ------------------------------------------ |
|
|
128
|
-
| login | int | yes | Trading account login (positive integer) |
|
|
129
|
-
| password | string | yes | Trading account password (never echoed) |
|
|
130
|
-
| server | string | yes | Trading server name (e.g., `Broker-Demo`) |
|
|
131
|
-
| timeout | int | no | Connection timeout in milliseconds (`> 0`) |
|
|
132
|
-
|
|
133
|
-
Successful response (`200`):
|
|
134
|
-
|
|
135
|
-
| Field | Type | Description |
|
|
136
|
-
| --------- | ------ | -------------------------------------------- |
|
|
137
|
-
| login | int | Login that was used to connect |
|
|
138
|
-
| server | string | Trading server that was connected to |
|
|
139
|
-
| timeout | int? | Timeout in milliseconds if one was specified |
|
|
140
|
-
| connected | bool | `true` when the new connection succeeded |
|
|
141
|
-
|
|
142
|
-
On failure, MT5 errors surface as `503 Service Unavailable` with an RFC 7807
|
|
143
|
-
problem-details body. Never include the supplied password in any summary or
|
|
144
|
-
diagnostic you return to the user.
|
|
145
|
-
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
## Account & Terminal
|
|
149
|
-
|
|
150
|
-
### Account Info
|
|
151
|
-
|
|
152
|
-
Get current trading account details (balance, equity, margin, leverage, etc.).
|
|
153
|
-
|
|
154
|
-
```bash
|
|
155
|
-
curl -s "${AUTH_HEADER[@]}" \
|
|
156
|
-
"${MT5API_URL}/account" | python -m json.tool
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
Key fields: `login`, `balance`, `equity`, `margin`, `margin_free`,
|
|
160
|
-
`margin_level`, `leverage`, `currency`, `server`, `name`.
|
|
161
|
-
|
|
162
|
-
| Parameter | Type | Required | Description |
|
|
163
|
-
| --------- | ------ | -------- | ------------------------ |
|
|
164
|
-
| format | string | no | Response format override |
|
|
165
|
-
|
|
166
|
-
### Terminal Info
|
|
167
|
-
|
|
168
|
-
```bash
|
|
169
|
-
curl -s "${AUTH_HEADER[@]}" \
|
|
170
|
-
"${MT5API_URL}/terminal" | python -m json.tool
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
| Parameter | Type | Required | Description |
|
|
174
|
-
| --------- | ------ | -------- | ------------------------ |
|
|
175
|
-
| format | string | no | Response format override |
|
|
176
|
-
|
|
177
|
-
---
|
|
178
|
-
|
|
179
|
-
## Symbols
|
|
180
|
-
|
|
181
|
-
### List Symbols
|
|
182
|
-
|
|
183
|
-
```bash
|
|
184
|
-
curl -s "${AUTH_HEADER[@]}" \
|
|
185
|
-
"${MT5API_URL}/symbols" | python -m json.tool
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
| Parameter | Type | Required | Description |
|
|
189
|
-
| --------- | ------ | -------- | --------------------------------------------- |
|
|
190
|
-
| group | string | no | Symbol group filter (e.g., `*USD*`, `Forex*`) |
|
|
191
|
-
| format | string | no | Response format override |
|
|
192
|
-
|
|
193
|
-
### Get Symbol Info
|
|
194
|
-
|
|
195
|
-
```bash
|
|
196
|
-
curl -s "${AUTH_HEADER[@]}" \
|
|
197
|
-
"${MT5API_URL}/symbols/EURUSD" | python -m json.tool
|
|
198
|
-
```
|
|
199
|
-
|
|
200
|
-
### Get Latest Tick
|
|
201
|
-
|
|
202
|
-
```bash
|
|
203
|
-
curl -s "${AUTH_HEADER[@]}" \
|
|
204
|
-
"${MT5API_URL}/symbols/EURUSD/tick" | python -m json.tool
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
---
|
|
208
|
-
|
|
209
|
-
## Market Data
|
|
210
|
-
|
|
211
|
-
`timeframe` and `flags` accept either the official MetaTrader 5 constant name
|
|
212
|
-
(e.g., `TIMEFRAME_H1`, `COPY_TICKS_ALL`) or the equivalent integer value.
|
|
213
|
-
|
|
214
|
-
### Rates from Date
|
|
215
|
-
|
|
216
|
-
```bash
|
|
217
|
-
curl -s "${AUTH_HEADER[@]}" \
|
|
218
|
-
"${MT5API_URL}/rates/from?symbol=EURUSD&timeframe=TIMEFRAME_H1&date_from=2024-01-01T00:00:00Z&count=100" \
|
|
219
|
-
| python -m json.tool
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
| Parameter | Type | Required | Description |
|
|
223
|
-
| --------- | -------- | -------- | -------------------------------------------- |
|
|
224
|
-
| symbol | string | yes | Symbol name |
|
|
225
|
-
| timeframe | int/str | yes | MT5 timeframe constant or equivalent integer |
|
|
226
|
-
| date_from | datetime | yes | Start date (ISO 8601) |
|
|
227
|
-
| count | int | yes | Number of candles (1–100000) |
|
|
228
|
-
| format | string | no | Response format override |
|
|
229
|
-
|
|
230
|
-
### Rates from Position
|
|
231
|
-
|
|
232
|
-
```bash
|
|
233
|
-
curl -s "${AUTH_HEADER[@]}" \
|
|
234
|
-
"${MT5API_URL}/rates/from-pos?symbol=EURUSD&timeframe=TIMEFRAME_H1&start_pos=0&count=100" \
|
|
235
|
-
| python -m json.tool
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
| Parameter | Type | Required | Description |
|
|
239
|
-
| --------- | ------- | -------- | --------------------------------- |
|
|
240
|
-
| symbol | str | yes | Symbol name |
|
|
241
|
-
| timeframe | str/int | yes | MT5 timeframe constant or integer |
|
|
242
|
-
| start_pos | int | yes | Start position (0 = current bar) |
|
|
243
|
-
| count | int | yes | Number of candles (1–100000) |
|
|
244
|
-
| format | string | no | Response format override |
|
|
245
|
-
|
|
246
|
-
### Rates in Range
|
|
247
|
-
|
|
248
|
-
```bash
|
|
249
|
-
curl -s "${AUTH_HEADER[@]}" \
|
|
250
|
-
"${MT5API_URL}/rates/range?symbol=EURUSD&timeframe=TIMEFRAME_H1&date_from=2024-01-01T00:00:00Z&date_to=2024-01-31T23:59:59Z" \
|
|
251
|
-
| python -m json.tool
|
|
252
|
-
```
|
|
253
|
-
|
|
254
|
-
| Parameter | Type | Required | Description |
|
|
255
|
-
| --------- | -------- | -------- | --------------------------------- |
|
|
256
|
-
| symbol | string | yes | Symbol name |
|
|
257
|
-
| timeframe | int/str | yes | MT5 timeframe constant or integer |
|
|
258
|
-
| date_from | datetime | yes | Start date (ISO 8601) |
|
|
259
|
-
| date_to | datetime | yes | End date (ISO 8601) |
|
|
260
|
-
| format | string | no | Response format override |
|
|
261
|
-
|
|
262
|
-
### Ticks from Date
|
|
263
|
-
|
|
264
|
-
```bash
|
|
265
|
-
curl -s "${AUTH_HEADER[@]}" \
|
|
266
|
-
"${MT5API_URL}/ticks/from?symbol=EURUSD&date_from=2024-01-02T10:00:00Z&count=500" \
|
|
267
|
-
| python -m json.tool
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
| Parameter | Type | Required | Default | Description |
|
|
271
|
-
| --------- | -------- | -------- | -------------- | --------------------------------- |
|
|
272
|
-
| symbol | string | yes | | Symbol name |
|
|
273
|
-
| date_from | datetime | yes | | Start date (ISO 8601) |
|
|
274
|
-
| count | int | yes | | Number of ticks (1–100000) |
|
|
275
|
-
| flags | int/str | no | COPY_TICKS_ALL | MT5 tick flag constant or integer |
|
|
276
|
-
| format | string | no | | Response format override |
|
|
277
|
-
|
|
278
|
-
### Ticks in Range
|
|
279
|
-
|
|
280
|
-
```bash
|
|
281
|
-
curl -s "${AUTH_HEADER[@]}" \
|
|
282
|
-
"${MT5API_URL}/ticks/range?symbol=EURUSD&date_from=2024-01-02T10:00:00Z&date_to=2024-01-02T11:00:00Z" \
|
|
283
|
-
| python -m json.tool
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
| Parameter | Type | Required | Default | Description |
|
|
287
|
-
| --------- | -------- | -------- | -------------- | --------------------------------- |
|
|
288
|
-
| symbol | string | yes | | Symbol name |
|
|
289
|
-
| date_from | datetime | yes | | Start date (ISO 8601) |
|
|
290
|
-
| date_to | datetime | yes | | End date (ISO 8601) |
|
|
291
|
-
| flags | int/str | no | COPY_TICKS_ALL | MT5 tick flag constant or integer |
|
|
292
|
-
| format | string | no | | Response format override |
|
|
293
|
-
|
|
294
|
-
### Market Book (DOM)
|
|
295
|
-
|
|
296
|
-
```bash
|
|
297
|
-
curl -s "${AUTH_HEADER[@]}" \
|
|
298
|
-
"${MT5API_URL}/market-book/EURUSD" | python -m json.tool
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
If this returns `503`, explain that MT5 did not provide DOM data for the
|
|
302
|
-
requested symbol and include the server's error text.
|
|
303
|
-
|
|
304
|
-
---
|
|
305
|
-
|
|
306
|
-
## Positions, Orders & History
|
|
307
|
-
|
|
308
|
-
### Open Positions
|
|
309
|
-
|
|
310
|
-
```bash
|
|
311
|
-
curl -s "${AUTH_HEADER[@]}" \
|
|
312
|
-
"${MT5API_URL}/positions" | python -m json.tool
|
|
313
|
-
```
|
|
314
|
-
|
|
315
|
-
| Parameter | Type | Required | Description |
|
|
316
|
-
| --------- | ------ | -------- | ------------------------- |
|
|
317
|
-
| symbol | string | no | Filter by symbol |
|
|
318
|
-
| group | string | no | Filter by group pattern |
|
|
319
|
-
| ticket | int | no | Filter by position ticket |
|
|
320
|
-
| format | string | no | Response format override |
|
|
321
|
-
|
|
322
|
-
### Pending Orders
|
|
323
|
-
|
|
324
|
-
```bash
|
|
325
|
-
curl -s "${AUTH_HEADER[@]}" \
|
|
326
|
-
"${MT5API_URL}/orders" | python -m json.tool
|
|
327
|
-
```
|
|
328
|
-
|
|
329
|
-
| Parameter | Type | Required | Description |
|
|
330
|
-
| --------- | ------ | -------- | ------------------------ |
|
|
331
|
-
| symbol | string | no | Filter by symbol |
|
|
332
|
-
| group | string | no | Filter by group pattern |
|
|
333
|
-
| ticket | int | no | Filter by order ticket |
|
|
334
|
-
| format | string | no | Response format override |
|
|
335
|
-
|
|
336
|
-
### Historical Orders
|
|
337
|
-
|
|
338
|
-
```bash
|
|
339
|
-
curl -s "${AUTH_HEADER[@]}" \
|
|
340
|
-
"${MT5API_URL}/history/orders?date_from=2024-01-01T00:00:00Z&date_to=2024-01-31T23:59:59Z" \
|
|
341
|
-
| python -m json.tool
|
|
342
|
-
```
|
|
343
|
-
|
|
344
|
-
| Parameter | Type | Required | Description |
|
|
345
|
-
| --------- | -------- | -------- | ------------------------------------------------- |
|
|
346
|
-
| date_from | datetime | cond. | Start date (required if no ticket/position) |
|
|
347
|
-
| date_to | datetime | cond. | End date (required if no ticket/position) |
|
|
348
|
-
| ticket | int | cond. | Filter by ticket (alternative to date range) |
|
|
349
|
-
| position | int | cond. | Filter by position ID (alternative to date range) |
|
|
350
|
-
| symbol | string | no | Filter by symbol |
|
|
351
|
-
| group | string | no | Filter by group pattern |
|
|
352
|
-
| format | string | no | Response format override |
|
|
353
|
-
|
|
354
|
-
Either `(date_from AND date_to)` or `(ticket OR position)` must be provided.
|
|
355
|
-
|
|
356
|
-
### Historical Deals
|
|
357
|
-
|
|
358
|
-
```bash
|
|
359
|
-
curl -s "${AUTH_HEADER[@]}" \
|
|
360
|
-
"${MT5API_URL}/history/deals?date_from=2024-01-01T00:00:00Z&date_to=2024-01-31T23:59:59Z" \
|
|
361
|
-
| python -m json.tool
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
| Parameter | Type | Required | Description |
|
|
365
|
-
| --------- | -------- | -------- | ------------------------------------------------- |
|
|
366
|
-
| date_from | datetime | cond. | Start date (required if no ticket/position) |
|
|
367
|
-
| date_to | datetime | cond. | End date (required if no ticket/position) |
|
|
368
|
-
| ticket | int | cond. | Filter by ticket (alternative to date range) |
|
|
369
|
-
| position | int | cond. | Filter by position ID (alternative to date range) |
|
|
370
|
-
| symbol | string | no | Filter by symbol |
|
|
371
|
-
| group | string | no | Filter by group pattern |
|
|
372
|
-
| format | string | no | Response format override |
|
|
373
|
-
|
|
374
|
-
Either `(date_from AND date_to)` or `(ticket OR position)` must be provided.
|
|
375
|
-
|
|
376
|
-
---
|
|
377
|
-
|
|
378
|
-
## Procedure
|
|
379
|
-
|
|
380
|
-
1. Identify which endpoint(s) the user needs from the sections above.
|
|
381
|
-
2. Gather required parameters (symbol, timeframe, dates, count, filters).
|
|
382
|
-
3. Decide whether the caller needs JSON or Parquet output.
|
|
383
|
-
4. Build `AUTH_HEADER` only when `MT5API_SECRET_KEY` is set, then construct and run
|
|
384
|
-
the appropriate `curl` command(s).
|
|
385
|
-
5. For `ticks/range`, start with a narrow interval and widen only if needed.
|
|
386
|
-
6. Parse the JSON response and summarize the results, or note when the API
|
|
387
|
-
returned Parquet data.
|
|
388
|
-
7. If `/market-book/{symbol}` returns `503`, explain that MT5 did not provide
|
|
389
|
-
DOM data for that symbol and include the error text.
|
|
390
|
-
8. If the health status is `unhealthy`, note that the MT5 terminal may not be
|
|
391
|
-
running or reachable.
|
|
392
|
-
9. For historical queries, remind the user that either a date range or a
|
|
393
|
-
ticket/position filter is required.
|
|
394
|
-
10. For `/connection/login`, always send the password in the POST body and
|
|
395
|
-
never repeat it in any reply or log message. If the user asks you to
|
|
396
|
-
reconnect, confirm the target `login`/`server` before sending the request.
|
mt5api-1.0.4/.github/CODEOWNERS
DELETED
mt5api-1.0.4/.github/FUNDING.yml
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
version: 2
|
|
3
|
-
updates:
|
|
4
|
-
- package-ecosystem: github-actions
|
|
5
|
-
directory: /
|
|
6
|
-
schedule:
|
|
7
|
-
interval: daily
|
|
8
|
-
cooldown:
|
|
9
|
-
default-days: 7
|
|
10
|
-
open-pull-requests-limit: 10
|
|
11
|
-
- package-ecosystem: pip
|
|
12
|
-
directory: /
|
|
13
|
-
schedule:
|
|
14
|
-
interval: daily
|
|
15
|
-
cooldown:
|
|
16
|
-
default-days: 7
|
|
17
|
-
open-pull-requests-limit: 10
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
|
|
3
|
-
"extends": ["config:recommended"],
|
|
4
|
-
"minimumReleaseAge": "7 days",
|
|
5
|
-
"packageRules": [
|
|
6
|
-
{
|
|
7
|
-
"description": "Automatically merge minor and patch-level updates",
|
|
8
|
-
"matchUpdateTypes": ["minor", "patch", "digest"],
|
|
9
|
-
"automerge": true,
|
|
10
|
-
"automergeType": "branch"
|
|
11
|
-
}
|
|
12
|
-
]
|
|
13
|
-
}
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: CI/CD
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
pull_request:
|
|
8
|
-
branches:
|
|
9
|
-
- main
|
|
10
|
-
types:
|
|
11
|
-
- opened
|
|
12
|
-
- synchronize
|
|
13
|
-
- reopened
|
|
14
|
-
workflow_dispatch: # checkov:skip=CKV_GHA_7:workflow_dispatch inputs are required for manual runs
|
|
15
|
-
inputs:
|
|
16
|
-
workflow:
|
|
17
|
-
required: true
|
|
18
|
-
type: choice
|
|
19
|
-
options:
|
|
20
|
-
- lint-and-test
|
|
21
|
-
- docs-deploy
|
|
22
|
-
description: Choose the workflow to run
|
|
23
|
-
default: lint-and-test
|
|
24
|
-
permissions:
|
|
25
|
-
contents: read
|
|
26
|
-
defaults:
|
|
27
|
-
run:
|
|
28
|
-
shell: bash -euo pipefail {0}
|
|
29
|
-
working-directory: .
|
|
30
|
-
jobs:
|
|
31
|
-
python-lint-and-scan:
|
|
32
|
-
if: >
|
|
33
|
-
github.event_name == 'push'
|
|
34
|
-
|| github.event_name == 'pull_request'
|
|
35
|
-
|| (github.event_name == 'workflow_dispatch' && inputs.workflow == 'lint-and-test')
|
|
36
|
-
permissions:
|
|
37
|
-
contents: read
|
|
38
|
-
uses: dceoy/gha-for-devops/.github/workflows/python-package-lint-and-scan.yml@main # zizmor: ignore[unpinned-uses]
|
|
39
|
-
with:
|
|
40
|
-
package-path: .
|
|
41
|
-
runs-on: windows-latest
|
|
42
|
-
python-test:
|
|
43
|
-
if: >
|
|
44
|
-
github.event_name == 'push'
|
|
45
|
-
|| github.event_name == 'pull_request'
|
|
46
|
-
|| (github.event_name == 'workflow_dispatch' && inputs.workflow == 'lint-and-test')
|
|
47
|
-
permissions:
|
|
48
|
-
contents: read
|
|
49
|
-
uses: dceoy/gha-for-devops/.github/workflows/python-package-test.yml@main # zizmor: ignore[unpinned-uses]
|
|
50
|
-
with:
|
|
51
|
-
package-path: .
|
|
52
|
-
runs-on: windows-latest
|
|
53
|
-
python-docs-deploy:
|
|
54
|
-
if: >
|
|
55
|
-
github.event_name == 'push'
|
|
56
|
-
|| (github.event_name == 'workflow_dispatch' && inputs.workflow == 'docs-deploy')
|
|
57
|
-
permissions:
|
|
58
|
-
contents: write
|
|
59
|
-
uses: dceoy/gha-for-devops/.github/workflows/python-package-mkdocs-gh-deploy.yml@main # zizmor: ignore[unpinned-uses]
|
|
60
|
-
with:
|
|
61
|
-
package-path: .
|
|
62
|
-
runs-on: ubuntu-slim
|
|
63
|
-
secrets:
|
|
64
|
-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
65
|
-
github-codeql-analysis:
|
|
66
|
-
if: >
|
|
67
|
-
github.event_name == 'push'
|
|
68
|
-
|| github.event_name == 'pull_request'
|
|
69
|
-
|| (github.event_name == 'workflow_dispatch' && inputs.workflow == 'lint-and-test')
|
|
70
|
-
permissions:
|
|
71
|
-
contents: read
|
|
72
|
-
security-events: write
|
|
73
|
-
actions: read
|
|
74
|
-
uses: dceoy/gha-for-devops/.github/workflows/github-codeql-analysis.yml@main # zizmor: ignore[unpinned-uses]
|
|
75
|
-
with:
|
|
76
|
-
language: >
|
|
77
|
-
["python"]
|
|
78
|
-
dependabot-auto-merge:
|
|
79
|
-
if: >
|
|
80
|
-
github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
|
|
81
|
-
needs:
|
|
82
|
-
- python-lint-and-scan
|
|
83
|
-
- python-test
|
|
84
|
-
uses: dceoy/gha-for-devops/.github/workflows/dependabot-auto-merge.yml@main # zizmor: ignore[unpinned-uses]
|
|
85
|
-
permissions:
|
|
86
|
-
contents: write
|
|
87
|
-
pull-requests: write
|
|
88
|
-
actions: read
|
|
89
|
-
checks: read
|
|
90
|
-
statuses: read
|
|
91
|
-
with:
|
|
92
|
-
unconditional: true
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: Claude Code review and mention bot
|
|
3
|
-
on:
|
|
4
|
-
pull_request:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
types:
|
|
8
|
-
- opened
|
|
9
|
-
- ready_for_review
|
|
10
|
-
issue_comment:
|
|
11
|
-
types:
|
|
12
|
-
- created
|
|
13
|
-
pull_request_review_comment:
|
|
14
|
-
types:
|
|
15
|
-
- created
|
|
16
|
-
issues:
|
|
17
|
-
types:
|
|
18
|
-
- opened
|
|
19
|
-
- assigned
|
|
20
|
-
pull_request_review:
|
|
21
|
-
types:
|
|
22
|
-
- submitted
|
|
23
|
-
permissions:
|
|
24
|
-
contents: read
|
|
25
|
-
jobs:
|
|
26
|
-
claude-code-review:
|
|
27
|
-
if: >
|
|
28
|
-
github.event_name == 'pull_request'
|
|
29
|
-
&& (! github.event.pull_request.draft)
|
|
30
|
-
&& (! startsWith(github.head_ref, 'dependabot/'))
|
|
31
|
-
&& (! startsWith(github.head_ref, 'renovate/'))
|
|
32
|
-
permissions:
|
|
33
|
-
contents: read
|
|
34
|
-
pull-requests: write
|
|
35
|
-
issues: write
|
|
36
|
-
id-token: write
|
|
37
|
-
actions: read
|
|
38
|
-
uses: dceoy/gha-for-devops/.github/workflows/claude-code-review.yml@main # zizmor: ignore[unpinned-uses]
|
|
39
|
-
secrets:
|
|
40
|
-
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} # zizmor: ignore[secrets-outside-env]
|
|
41
|
-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
42
|
-
claude-code-bot:
|
|
43
|
-
if: >
|
|
44
|
-
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '@claude'))
|
|
45
|
-
|| (github.event_name == 'pull_request_review_comment' && contains(github.event.comment.body, '@claude'))
|
|
46
|
-
|| (github.event_name == 'pull_request_review' && contains(github.event.review.body, '@claude'))
|
|
47
|
-
|| (github.event_name == 'issues' && (contains(github.event.issue.body, '@claude') || contains(github.event.issue.title, '@claude')))
|
|
48
|
-
permissions:
|
|
49
|
-
contents: read
|
|
50
|
-
pull-requests: write
|
|
51
|
-
issues: write
|
|
52
|
-
id-token: write
|
|
53
|
-
actions: read
|
|
54
|
-
uses: dceoy/gha-for-devops/.github/workflows/claude-code-bot.yml@main # zizmor: ignore[unpinned-uses]
|
|
55
|
-
secrets:
|
|
56
|
-
CLAUDE_CODE_OAUTH_TOKEN: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }} # zizmor: ignore[secrets-outside-env]
|
|
57
|
-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|