⚡
TREVLIX
v1.9.4
Algorithmic Trading Intelligence — Installations-Anleitung
LANG:
📋 Voraussetzungen
Software
- Python 3.10+
empfohlen: 3.11 - MySQL 8.0+ oder MariaDB 10.6+
- Git (optional, für Auto-Update)
- pip 23+
Hardware
- RAM: min. 1 GB (2 GB für LSTM)
- CPU: 1 Core (2+ für paralleles Scanning)
- Disk: 2 GB (inkl. Backups)
- Internet: Dauerhaft (Exchange-API)
🐳 Docker Alternative
Mit Docker Compose entfallen Python/MySQL-Installation — alles läuft im Container. Empfohlen für Server-Deployments.
⬇ Installation
Methode A — Git Clone (empfohlen)
# Repository klonen git clone https://github.com/DEIN_USER/trevlix.git cd trevlix # Virtuelle Umgebung (empfohlen) python -m venv .venv source .venv/bin/activate # Linux/Mac # .venv\Scriptsctivate # Windows # Abhängigkeiten installieren pip install -r requirements.txt # Optional: TensorFlow für LSTM + Transformer pip install tensorflow # Optional: SHAP für KI-Erklärungen pip install shap
Methode B — Direkter Download
# Alle Dateien herunterladen und in einen Ordner legen: server.py # Haupt-Bot dashboard.html # Web-Dashboard trevlix_translations.js # i18n (gleicher Ordner!) trevlix_i18n.py # Python i18n requirements.txt # Abhängigkeiten .env.example # Konfigurationsvorlage pip install -r requirements.txt
🐳 Docker Compose NEU
Docker Compose startet TREVLIX, MySQL und optional Nginx in einer einzigen Zeile — kein manuelles Setup nötig.
1
.env erstellen
Vorlage kopieren und alle Werte befüllen.
cp .env.example .env nano .env # Werte eintragen
2
Starten
docker compose up -d # Mit Nginx (HTTPS) für Production: docker compose --profile production up -d
3
Logs & Status
docker compose logs -f trevlix docker compose ps docker compose restart trevlix
4
SSL / HTTPS
Zertifikate in
docker/ssl/ legen (fullchain.pem + privkey.pem). Für Let's Encrypt:certbot certonly --standalone -d trevlix.dev cp /etc/letsencrypt/live/trevlix.dev/fullchain.pem docker/ssl/ cp /etc/letsencrypt/live/trevlix.dev/privkey.pem docker/ssl/
🗄 Datenbank
TREVLIX erstellt alle Tabellen beim ersten Start automatisch. Nur die leere Datenbank muss vorab existieren.
-- MySQL / MariaDB CREATE DATABASE trevlix CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER 'trevlix'@'localhost' IDENTIFIED BY 'SICHERES_PASSWORT'; GRANT ALL PRIVILEGES ON trevlix.* TO 'trevlix'@'localhost'; FLUSH PRIVILEGES;
Automatisch erstellte Tabellen
⚙️ Konfiguration (.env)
Alle Einstellungen werden über die .env Datei gesteuert. Vorlage: cp .env.example .env
| Variable | Beschreibung | Pflicht | Standard |
|---|---|---|---|
| EXCHANGE | Exchange (cryptocom/binance/bybit/okx/kucoin) | ✓ | cryptocom |
| API_KEY | Exchange API Key | ✓ | — |
| API_SECRET | Exchange API Secret | ✓ | — |
| MYSQL_HOST | MySQL Server (Docker: "mysql") | ✓ | localhost |
| MYSQL_USER | MySQL Benutzer | ✓ | trevlix |
| MYSQL_PASS | MySQL Passwort | ✓ | — |
| MYSQL_DB | Datenbankname | ✓ | trevlix |
| ADMIN_PASSWORD | Dashboard Passwort — unbedingt ändern! | ✓ | admin123 |
| JWT_SECRET | JWT Signing Key (min. 32 Zeichen) | ✓ | — |
| DASHBOARD_SECRET | Dashboard Session Key (min. 16 Zeichen) | ✓ | — |
| SECRET_KEY | Flask Session Key (min. 32 Zeichen) | ✓ | — |
| PAPER_TRADING | true = kein echtes Geld, false = Live | ○ | true |
| SESSION_TIMEOUT_MIN | Inaktivitäts-Timeout in Minuten NEU | ○ | 30 |
| ALLOWED_ORIGINS | Erlaubte CORS-Origins (kommagetrennt) NEU | ○ | localhost:5000 |
| GITHUB_REPO | GitHub Repo für Auto-Update (USER/REPO) | ○ | — |
| DISCORD_WEBHOOK | Discord Webhook URL | ○ | — |
| CRYPTOPANIC_TOKEN | CryptoPanic API Token | ○ | — |
| BLOCKNATIVE_KEY | Blocknative Key für Gas-Fees NEU | ○ | — |
| LANGUAGE | Sprache (de/en/es/ru/pt) | ○ | de |
| PORT | Dashboard Port | ○ | 5000 |
🔐 Sicherheit NEU
⛔ Kritische Sicherheitshinweise
- ADMIN_PASSWORD sofort ändern — "admin123" wird beim Start blockiert
- JWT_SECRET, DASHBOARD_SECRET und SECRET_KEY müssen zufällige Strings sein (min. 32 Zeichen)
- .env Datei niemals in Git committen — .gitignore ist bereits vorkonfiguriert
- Exchange API: nur Lesen + Handeln erlauben — NIEMALS Abheben
- IP-Whitelist im Exchange-Konto auf Server-IP einschränken
Enthaltene Sicherheitsfunktionen
- Rate Limiting: max. 5 Login-Versuche/Minute, 10 Minuten Sperre bei Überschreitung
- WebSocket-Auth: Jede WS-Verbindung wird mit Session oder kurzlebigem Token validiert
- CORS: Nur konfigurierte Origins (ALLOWED_ORIGINS) werden akzeptiert
- Session-Timeout: Automatischer Logout nach Inaktivität (SESSION_TIMEOUT_MIN)
- Passwort-Stärke: Schwache Passwörter werden beim Start gewarnt
- Bcrypt: Alle Passwörter werden gehasht gespeichert
Sichere Keys generieren
# Zufälligen Key generieren (Linux/Mac): python -c "import secrets; print(secrets.token_hex(32))" # Oder: openssl rand -hex 32
🚀 Bot starten
1
.env konfigurieren
cp .env.example .env nano .env
2
Bot starten
python server.py
3
Dashboard öffnen
http://localhost:5000
4
Als Dienst (systemd)
# /etc/systemd/system/trevlix.service [Unit] Description=TREVLIX Trading Bot After=network.target mysql.service [Service] User=ubuntu WorkingDirectory=/home/ubuntu/trevlix ExecStart=/home/ubuntu/trevlix/.venv/bin/python server.py Restart=always RestartSec=10 EnvironmentFile=/home/ubuntu/trevlix/.env [Install] WantedBy=multi-user.target
sudo systemctl enable --now trevlix sudo journalctl -u trevlix -f
🏦 Exchange-Konfiguration
API-Keys im Exchange erstellen: nur Lesen und Handeln erlauben — niemals Abheben!
| Exchange | EXCHANGE= | Spot | Futures | Hinweis |
|---|---|---|---|---|
| Crypto.com | cryptocom | ✅ | — | Standard |
| Binance | binance | ✅ | ✅ | Größte Liquidität |
| Bybit | bybit | ✅ | ✅ | Gut für Shorts |
| OKX | okx | ✅ | ✅ | Niedrige Gebühren |
| KuCoin | kucoin | ✅ | — | Viele Altcoins |
🔄 GitHub Auto-Update
1
GitHub Fork erstellen
Repo forken → eigene Änderungen committen → Releases erstellen.
2
Repo in .env setzen
GITHUB_REPO=DEIN_USER/trevlix GITHUB_BRANCH=main
3
Update im Dashboard
Settings → GitHub Auto-Update → "Auf Updates prüfen" → "Update installieren". Bot startet automatisch neu.
4
Release erstellen (CI)
GitHub Actions erstellt automatisch ein Release wenn der Commit "[release]" enthält:
git commit -m "[release] v1.9.4 — Neue Features" git push
🧠 KI & Backtest NEU
KI-Modelle
- Random Forest + XGBoost (Ensemble)
- LSTM (Zeitreihen)
- Transformer / Multi-Head Attention NEU
- Bull/Bear Regime-Modelle
- Walk-Forward Validierung
Features (31)
- 9 Strategie-Votes (EMA, RSI, MACD…)
- Technische Indikatoren (RSI, ATR, BB…)
- News-Sentiment (CryptoPanic)
- On-Chain Daten (CryptoQuant)
- ETH Gas Fees NEU
- Fear & Greed, BTC-Dominanz
Backtest
TREVLIX nutzt echte OHLCV-Daten von der Exchange mit realistischer Slippage- und Fee-Simulation.
| Feature | Detail |
|---|---|
| Slippage | 0.05% je Trade (Spread + Marktimpakt) |
| Fees | 0.10% Taker / 0.08% Maker |
| Kelly Sizing | Dynamische Positionsgröße basierend auf bisheriger Win-Rate |
| Trailing Stop | Optional aktivierbar |
| Metriken | Return%, Win-Rate, Sharpe, Calmar, Max-DD, Profit-Factor |
| Monatliche Aufschlüsselung | PnL und Win-Rate pro Monat |
| Pine Script Export | TradingView v5 Export per API oder Dashboard |
| Multi-Asset Vergleich | Bis zu 6 Symbole parallel backtesten |
| Markowitz | Optimale Kapitalverteilung (Monte Carlo, 5000 Portfolios) |
SHAP — KI-Erklärungen NEU
Mit
pip install shap werden SHAP-Werte für jeden Trade berechnet — erklärt warum TREVLIX eine Position geöffnet hat.🤝 Copy-Trading API NEU
Follower empfangen jeden Trade als Webhook-POST an ihre URL — ideal um mehrere Konten zu synchronisieren.
1
Follower registrieren
# POST /api/v1/copy-trading/register { "name": "Mein Konto 2", "webhook_url": "https://meine-app.com/webhook", "scale": 0.5 // 50% der TREVLIX-Positionsgröße } // Response: { "token": "abc123...", "name": "Mein Konto 2" }
2
Webhook Payload
{
"source": "TREVLIX",
"type": "BUY", // BUY | SELL | SHORT | TEST
"symbol": "BTC/USDT",
"price": 67450.0,
"invest_usdt": 500.0, // Bereits mit scale multipliziert
"confidence": 0.78,
"votes": { "EMA-Trend": 1, "RSI": 1 },
"timestamp": "2024-01-15T14:30:00Z"
}
📡 REST-API Referenz
Alle /api/v1/ Endpoints erfordern einen JWT-Token im Header: Authorization: Bearer TOKEN
# Token holen curl -X POST http://localhost:5000/api/v1/token -H "Content-Type: application/json" -d '{"username":"admin","password":"DEIN_PASSWORT"}'
Method
Endpoint
Beschreibung
GET
/api/v1/state
Bot-Status (Balance, Positionen…)
GET
/api/v1/trades
Abgeschlossene Trades
POST
/api/v1/backtest
Backtest starten
POST
/api/v1/backtest/compare
Multi-Asset Backtest NEU
GET
/api/v1/pine-script
TradingView Pine Script NEU
POST
/api/v1/portfolio/optimize
Markowitz Optimierung NEU
GET
/api/v1/ai/feature-importance
Feature Importance NEU
GET
/api/v1/gas
ETH Gas Fees NEU
POST
/api/v1/copy-trading/register
Follower registrieren NEU
PATCH
/api/v1/positions/{sym}/sl
SL manuell anpassen NEU
PATCH
/api/v1/positions/{sym}/tp
TP manuell anpassen NEU
GET
/api/v1/live-demo
Öffentliche Demo-Daten NEU
GET
/api/v1/changelog
GitHub Releases NEU
GET
/api/v1/ws-token
WS Auth Token NEU
POST
/api/v1/signal
TradingView Webhook
GET
/api/v1/tax
Steuer-Report
GET
/api/export/csv
Trades als CSV
GET
/api/v1/docs
API Dokumentation (JSON)
TradingView Webhook
Alert-URL in TradingView: http://DEINE-IP:5000/api/v1/signal
// TradingView Alert Message Body (JSON): { "symbol": "", "action": "buy", // "buy" | "sell" "price": , "token": "DEIN_JWT_TOKEN" }
💬 Discord Integration
1
Webhook erstellen
Discord → Server-Einstellungen → Integrationen → Webhooks → Neuer Webhook
2
URL in .env eintragen
DISCORD_WEBHOOK=https://discord.com/api/webhooks/ID/TOKEN
3
Benachrichtigungen
- ✅ Trade eröffnet / geschlossen (mit PnL)
- ⚠️ Circuit Breaker ausgelöst
- 💔 Heartbeat-Alarm (Bot hängt)
- 📊 Tages-Report (automatisch)
- 🔄 Update installiert
- ♻️ Positionen nach Neustart wiederhergestellt
💡 Tipps & Best Practices
⚠️ Vor Live-Trading
- Mindestens 30 Tage Paper-Trading
- Win-Rate > 55% im Backtest
- Max. Drawdown < 15%
- Sharpe-Ratio > 1.0
- Feature Importance prüfen — KI muss sinnvoll gewichten
- Position Recovery testen: Bot stoppen, neu starten
🚀 Production-Setup
- Docker Compose + Nginx für HTTPS verwenden
- GitHub Actions für automatische Tests aktivieren
- Tägliche MySQL-Backups prüfen
- Discord-Heartbeat-Alerts aktivieren
- ALLOWED_ORIGINS auf eigene Domain setzen
- SESSION_TIMEOUT_MIN auf 15 reduzieren
⌨️ Dashboard Keyboard Shortcuts NEU
Space — Start/Stop
B — Backtest
S — Settings
D — Dashboard
A — KI-Sektion
T — Dark/Light Mode
? — Alle Shortcuts