implement
All checks were successful
MT5 Helm GitOps Deploy / build-and-deploy (push) Has been skipped
All checks were successful
MT5 Helm GitOps Deploy / build-and-deploy (push) Has been skipped
This commit is contained in:
parent
06031fe3fe
commit
2c4899bb98
7 changed files with 3313 additions and 5 deletions
8
bots.env
Normal file
8
bots.env
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
MT5_LOGIN=…
|
||||
MT5_PASSWORD=…
|
||||
MT5_SERVER=…
|
||||
|
||||
API_ID=1234
|
||||
API_HASH=abccccccccccccccccccd134
|
||||
PHONE_NUMBER=+41796600666
|
||||
CHANNEL2_ID=-1234
|
||||
10
bots/Dockerfile
Normal file
10
bots/Dockerfile
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
# Ein gemeinsames Image für mcp_server und live_signal_trader (~500 MB statt zwei)
|
||||
FROM python:3.11-slim
|
||||
|
||||
ENV PYTHONUNBUFFERED=1 PIP_NO_CACHE_DIR=1
|
||||
WORKDIR /app
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
COPY *.py ./
|
||||
1187
bots/live_signal_trader.py
Normal file
1187
bots/live_signal_trader.py
Normal file
File diff suppressed because it is too large
Load diff
1000
bots/mcp_server.py
Normal file
1000
bots/mcp_server.py
Normal file
File diff suppressed because it is too large
Load diff
12
bots/requirements.txt
Normal file
12
bots/requirements.txt
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# MCP-Server
|
||||
fastapi
|
||||
uvicorn
|
||||
pydantic
|
||||
mt5linux
|
||||
rpyc
|
||||
pandas
|
||||
numpy
|
||||
# Live-Trader
|
||||
requests
|
||||
telethon
|
||||
python-dotenv
|
||||
1040
bots/traderanalyser.py
Normal file
1040
bots/traderanalyser.py
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,13 +1,64 @@
|
|||
services:
|
||||
# 1. MetaTrader 5 (Wine + KasmVNC) – startet selbst den RPyC-Server auf 8001
|
||||
mt5:
|
||||
build: .
|
||||
image: gmag11/metatrader5_vnc
|
||||
image: gmag11/metatrader5_vnc # kein "build: ." – fertiges Image reicht
|
||||
container_name: mt5
|
||||
volumes:
|
||||
- ./config:/config
|
||||
ports:
|
||||
- 3000:3000
|
||||
- 8001:8001
|
||||
- 3000:3000 # Web-UI
|
||||
# 8001 (RPyC) bewusst NICHT veröffentlicht – ungeschützter Vollzugriff auf MT5
|
||||
env_file:
|
||||
- .env
|
||||
- .env # CUSTOM_USER / PASSWORD fürs Web-UI
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "bash", "-c", "exec 3<>/dev/tcp/127.0.0.1/8001"]
|
||||
interval: 30s
|
||||
timeout: 5s
|
||||
start_period: 10m # Erststart installiert Wine + MT5
|
||||
retries: 5
|
||||
|
||||
# 2. MCP-Server (FastAPI) – spricht per RPyC mit MT5, Broker-Login aus bots.env
|
||||
mt5-mcp:
|
||||
build: ./bots
|
||||
image: mt5-bots:local
|
||||
container_name: mt5-mcp
|
||||
command: ["python", "mcp_server.py", "--live", "--rpyc-host", "mt5", "--rpyc-port", "8001"]
|
||||
env_file:
|
||||
- bots.env
|
||||
ports:
|
||||
- 127.0.0.1:8000:8000 # nur lokal – hat Order-Endpunkte ohne Auth
|
||||
depends_on:
|
||||
mt5:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "python", "-c",
|
||||
"import json,urllib.request,sys; d=json.load(urllib.request.urlopen('http://127.0.0.1:8000/health',timeout=5)); sys.exit(0 if d.get('connected') else 1)"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
start_period: 2m
|
||||
retries: 3
|
||||
|
||||
# 3. Telegram Live-Trader – handelt über den MCP-Server
|
||||
live-trader:
|
||||
image: mt5-bots:local
|
||||
container_name: live-trader
|
||||
working_dir: /data # Session + diagnostics_*.json landen im Volume
|
||||
# Nur Kanal 2 (HM XAUUSD) – CHANNEL2_ID kommt aus bots.env
|
||||
command: >
|
||||
python /app/live_signal_trader.py --live
|
||||
--channels ch2
|
||||
--risk-tier low
|
||||
--mt5-base-url http://mt5-mcp:8000
|
||||
--diagnostics-dir /data
|
||||
env_file:
|
||||
- bots.env
|
||||
environment:
|
||||
- TG_SESSION=/data/mysession
|
||||
volumes:
|
||||
- ./trader-data:/data
|
||||
depends_on:
|
||||
mt5-mcp:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
|
|
|
|||
Loading…
Reference in a new issue