## Major Features - Session Filter: NY-only trading (13:00-21:00 UTC) - SQLite Database: Structured trade logging - Telegram Bot: Real-time notifications (@Xausd_digger_bot) - Streamlit Dashboard: Visual monitoring & analytics - JSON Import: Historical data migration ## Infrastructure - trading_database.py: SQLite trade storage - telegram_notifier.py: Telegram integration - infrastructure_patch.py: Combined DB + Telegram - trading_dashboard.py: Real-time web dashboard - import_json_to_db.py: JSON to SQLite migration ## Session Filter (V1.8 Aggressive Mode) - session_filter_patch.py: Whitelist-based filter - Blocks: Asian, London, Overlap sessions - Active: NY session only (best performance: 47.6% WR) - Base confidence: 60% ## Documentation - V1.8_AGGRESSIVE_MODE_AKTIVIERT.md - FIX_DUPLICATE_SCHEDULER.md - DASHBOARD_WINDOWS_SERVER.md - SQLITE_TELEGRAM_SETUP.md - PROJECT_CLEANUP.md ## Cleanup - Archived old V1.1-V1.7 versions - Removed obsolete analysis scripts (replaced by dashboard) - Added .gitignore for secrets and temp files ## Breaking Changes - Requires telegram_config.json (use template) - Requires Python packages: streamlit, plotly 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
12 KiB
📊 Streamlit Dashboard - Windows Server Deployment
Übersicht
Diese Anleitung zeigt dir wie du das Trading Dashboard auf einem Windows Server (oder Windows VPS) zum Laufen bringst.
🚀 Installation auf Windows Server
SCHRITT 1: Python & Dependencies prüfen
1. Öffne PowerShell als Administrator
# Prüfe Python Version
python --version
# Sollte Python 3.8+ zeigen
# Falls Python nicht gefunden wird:
# Installiere von: https://www.python.org/downloads/
2. Navigiere zum Trading Bot Ordner
# Beispiel (passe Pfad an):
cd C:\TradingBot\placeorder
3. Installiere Streamlit & Dependencies
pip install streamlit plotly pandas
Falls pip nicht funktioniert:
python -m pip install streamlit plotly pandas
SCHRITT 2: Dashboard-Datei kopieren
Option A: Via RDP (Remote Desktop)
- Verbinde per RDP zu deinem Windows Server
- Öffne Browser auf dem Server
- Lade
trading_dashboard.pyherunter (z.B. via GitHub, Email, Cloud) - Kopiere nach:
C:\TradingBot\placeorder\
Option B: Via SCP (von Mac aus)
# Auf deinem Mac (Terminal)
scp "/Users/sebastianfrohlich/Library/Mobile Documents/com~apple~CloudDocs/Jupyter Notebooks/FinancialTrading/PlaceOrder/placeorder/trading_dashboard.py" user@windows-server-ip:C:/TradingBot/placeorder/
Hinweis: Benötigt OpenSSH Server auf Windows. Siehe unten für Aktivierung.
Option C: Manuell erstellen
- Auf Windows Server: Öffne Notepad++, VSCode oder Editor
- Erstelle neue Datei:
trading_dashboard.py - Copy-Paste den Code aus der Datei
- Speichere in:
C:\TradingBot\placeorder\
SCHRITT 3: Dashboard starten
Option A: PowerShell (zum Testen)
cd C:\TradingBot\placeorder
streamlit run trading_dashboard.py --server.port 8501 --server.address 0.0.0.0
Das Dashboard startet und sollte automatisch den Browser öffnen!
Option B: CMD (Command Prompt)
cd C:\TradingBot\placeorder
streamlit run trading_dashboard.py --server.port 8501 --server.address 0.0.0.0
SCHRITT 4: Firewall-Regel erstellen
Windows Firewall für Port 8501 öffnen:
Via GUI:
- Windows-Taste → "Windows Defender Firewall"
- "Erweiterte Einstellungen"
- "Eingehende Regeln" → "Neue Regel..."
- "Port" auswählen → Weiter
- "TCP" → "Bestimmte lokale Ports": 8501 → Weiter
- "Verbindung zulassen" → Weiter
- Alle Profile aktivieren → Weiter
- Name: "Streamlit Dashboard" → Fertig
Via PowerShell (als Administrator):
New-NetFirewallRule -DisplayName "Streamlit Dashboard" -Direction Inbound -LocalPort 8501 -Protocol TCP -Action Allow
SCHRITT 5: Dashboard im Browser öffnen
Lokal auf dem Server:
http://localhost:8501
Von anderem Computer:
http://WINDOWS-SERVER-IP:8501
Beispiel:
http://192.168.1.100:8501
🔄 Dashboard permanent laufen lassen
Option 1: Als Windows Service (EMPFOHLEN)
Mit NSSM (Non-Sucking Service Manager):
1. NSSM herunterladen:
https://nssm.cc/download
2. NSSM installieren:
# NSSM entpacken nach C:\nssm
# PowerShell als Administrator öffnen
cd C:\nssm\win64
# Service erstellen
.\nssm.exe install TradingDashboard
3. Im NSSM GUI konfigurieren:
-
Application Tab:
- Path:
C:\Python310\Scripts\streamlit.exe(passe Python-Pfad an) - Startup directory:
C:\TradingBot\placeorder - Arguments:
run trading_dashboard.py --server.port 8501 --server.address 0.0.0.0
- Path:
-
Details Tab:
- Display name:
Trading Dashboard - Description:
Streamlit Dashboard for Trading Bot V1.8
- Display name:
-
Log on Tab:
- Wähle Account (z.B. dein User-Account)
-
I/O Tab:
- Output (stdout):
C:\TradingBot\placeorder\dashboard_stdout.log - Error (stderr):
C:\TradingBot\placeorder\dashboard_stderr.log
- Output (stdout):
4. Service starten:
# Service starten
.\nssm.exe start TradingDashboard
# Service Status prüfen
.\nssm.exe status TradingDashboard
# Service stoppen
.\nssm.exe stop TradingDashboard
# Service entfernen (falls nötig)
.\nssm.exe remove TradingDashboard
Oder via Windows Services:
- Windows-Taste → "services.msc"
- Finde "Trading Dashboard"
- Rechtsklick → "Starten"
Option 2: Batch-Datei + Task Scheduler
1. Erstelle Batch-Datei:
Erstelle start_dashboard.bat:
@echo off
echo Starting Trading Dashboard...
cd /d C:\TradingBot\placeorder
streamlit run trading_dashboard.py --server.port 8501 --server.address 0.0.0.0
pause
2. Task Scheduler konfigurieren:
- Windows-Taste → "Task Scheduler"
- "Create Basic Task..."
- Name: "Trading Dashboard"
- Trigger: "When the computer starts"
- Action: "Start a program"
- Program:
C:\TradingBot\placeorder\start_dashboard.bat - Finish
Task manuell starten:
- Task Scheduler → Rechtsklick auf Task → "Run"
Option 3: PowerShell Background Job (temporär)
# Starte als Background Job
Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd C:\TradingBot\placeorder; streamlit run trading_dashboard.py --server.port 8501 --server.address 0.0.0.0"
# Prüfe laufende Prozesse
Get-Process | Where-Object {$_.ProcessName -like "*streamlit*"}
# Stoppe Dashboard
Stop-Process -Name streamlit -Force
🔒 Sicherheit & Zugriff
Option 1: SSH Tunnel (von Mac aus)
Falls OpenSSH Server auf Windows aktiviert:
# Auf Mac
ssh -L 8501:localhost:8501 user@windows-server-ip
# Dann Browser öffnen
http://localhost:8501
OpenSSH Server auf Windows aktivieren:
# PowerShell als Administrator
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
# SSH Service starten
Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'
# Firewall-Regel (falls nötig)
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
Option 2: IIS Reverse Proxy (für HTTPS)
Falls du IIS verwendest, kannst du einen Reverse Proxy einrichten:
- Installiere "Application Request Routing" (ARR)
- Installiere "URL Rewrite"
- Konfiguriere Reverse Proxy von Port 80/443 → 8501
Option 3: VPN-Only Access
Öffne Port 8501 nur im VPN-Netzwerk, nicht öffentlich.
📱 Zugriff von außen (Internet)
Router Port Forwarding (falls Home Server)
-
Router-Verwaltung öffnen
-
Port Forwarding Regel erstellen:
- External Port: 8501
- Internal IP: Windows Server IP (z.B. 192.168.1.100)
- Internal Port: 8501
- Protocol: TCP
-
Zugriff via:
http://DEINE-ÖFFENTLICHE-IP:8501
Cloud VPS (z.B. Azure, AWS)
Firewall/Security Group konfigurieren:
- Erlaube eingehenden Traffic auf Port 8501 (TCP)
- Von deiner IP oder 0.0.0.0/0 (öffentlich, vorsichtig!)
🛠️ Troubleshooting
Dashboard startet nicht
1. Prüfe Python/Streamlit Installation:
python --version
streamlit --version
2. Prüfe ob Port belegt:
netstat -ano | findstr :8501
Falls Port belegt, finde Prozess:
# Nutze die PID aus netstat output
tasklist | findstr <PID>
# Prozess killen
taskkill /PID <PID> /F
3. Prüfe Logs:
Falls als Service läuft, schaue in:
C:\TradingBot\placeorder\dashboard_stdout.log
C:\TradingBot\placeorder\dashboard_stderr.log
Dashboard nicht erreichbar von außen
1. Firewall prüfen:
Get-NetFirewallRule | Where-Object {$_.LocalPort -eq 8501}
2. Prüfe ob Streamlit auf richtiger IP hört:
netstat -ano | findstr :8501
Sollte zeigen: 0.0.0.0:8501 (nicht 127.0.0.1:8501)
Falls falsch, starte mit --server.address 0.0.0.0:
streamlit run trading_dashboard.py --server.port 8501 --server.address 0.0.0.0
Database Error
# Prüfe ob trading_bot.db existiert
dir trading_bot.db
# Falls nicht:
# 1. Starte zuerst den Trading Bot (Jupyter Notebook)
# 2. Der erstellt automatisch die Datenbank
📊 PowerShell Helper Scripts
start_dashboard.ps1
# Trading Dashboard Starter Script
Write-Host "Starting Trading Dashboard..." -ForegroundColor Green
$path = "C:\TradingBot\placeorder"
Set-Location $path
# Check if database exists
if (!(Test-Path "trading_bot.db")) {
Write-Host "WARNING: trading_bot.db not found!" -ForegroundColor Yellow
Write-Host "Make sure the Trading Bot is running first." -ForegroundColor Yellow
}
# Start Streamlit
Write-Host "Dashboard starting on http://localhost:8501" -ForegroundColor Cyan
streamlit run trading_dashboard.py --server.port 8501 --server.address 0.0.0.0
stop_dashboard.ps1
# Stop Trading Dashboard
Write-Host "Stopping Trading Dashboard..." -ForegroundColor Yellow
Get-Process | Where-Object {$_.ProcessName -like "*streamlit*"} | Stop-Process -Force
Write-Host "Dashboard stopped!" -ForegroundColor Green
check_dashboard.ps1
# Check Dashboard Status
Write-Host "Checking Trading Dashboard Status..." -ForegroundColor Cyan
$process = Get-Process | Where-Object {$_.ProcessName -like "*streamlit*"}
if ($process) {
Write-Host "Dashboard is RUNNING" -ForegroundColor Green
Write-Host "Process ID: $($process.Id)" -ForegroundColor White
Write-Host "URL: http://localhost:8501" -ForegroundColor Cyan
} else {
Write-Host "Dashboard is NOT running" -ForegroundColor Red
}
# Check if port is listening
$port = Get-NetTCPConnection -LocalPort 8501 -ErrorAction SilentlyContinue
if ($port) {
Write-Host "Port 8501 is LISTENING" -ForegroundColor Green
} else {
Write-Host "Port 8501 is NOT listening" -ForegroundColor Yellow
}
✅ Installation Checklist
- Python 3.8+ installiert
- Streamlit installiert (
pip install streamlit plotly pandas) - trading_dashboard.py im richtigen Ordner
- Windows Firewall Port 8501 geöffnet
- Dashboard gestartet (manuell oder als Service)
- Im Browser erreichbar (
http://localhost:8501) - Von außen erreichbar (
http://SERVER-IP:8501) - Als Windows Service konfiguriert (optional, empfohlen)
- Auto-Start beim Boot konfiguriert (optional)
🎯 Empfohlenes Setup für Windows Server
Beste Praxis:
-
Dashboard als Windows Service (mit NSSM)
- Auto-Start beim Boot
- Läuft auch ohne User-Login
-
Firewall konfiguriert
- Port 8501 nur von vertrauenswürdigen IPs
-
Logs aktiviert
- stdout/stderr Logs für Debugging
-
Auto-Refresh im Dashboard (30s)
🎉 Quick Start Commands
# Dashboard starten (manuell)
cd C:\TradingBot\placeorder
streamlit run trading_dashboard.py --server.port 8501 --server.address 0.0.0.0
# Dashboard Status prüfen
Get-Process | Where-Object {$_.ProcessName -like "*streamlit*"}
# Dashboard stoppen
Stop-Process -Name streamlit -Force
# Service starten (falls als Service installiert)
Start-Service TradingDashboard
# Service stoppen
Stop-Service TradingDashboard
📝 Zugriff URLs
Lokal auf Server:
http://localhost:8501
Vom Netzwerk:
http://WINDOWS-SERVER-IP:8501
Von außen (Internet):
http://ÖFFENTLICHE-IP:8501
Via SSH Tunnel:
# Auf Mac
ssh -L 8501:localhost:8501 user@windows-server-ip
# Browser öffnen
http://localhost:8501
🔗 Nützliche Links
- NSSM Download: https://nssm.cc/download
- Python Windows: https://www.python.org/downloads/windows/
- Streamlit Docs: https://docs.streamlit.io/
💡 Pro-Tipps
- Dedicated User Account: Erstelle einen separaten Windows User nur für den Trading Bot
- Scheduled Restart: Task Scheduler für täglichen Neustart (z.B. 3:00 nachts)
- Backup: Sichere
trading_bot.dbregelmäßig - Monitoring: Nutze Windows Performance Monitor für Ressourcen-Überwachung
- Updates: Halte Streamlit aktuell:
pip install --upgrade streamlit
🚨 Wichtige Sicherheitshinweise
⚠️ NIEMALS Port 8501 öffentlich ohne Authentifizierung öffnen!
Empfohlene Absicherung:
- VPN-Only Access
- SSH Tunnel
- IIS Reverse Proxy mit Basic Auth
- IP Whitelist in Firewall
Du bist jetzt bereit das Dashboard auf Windows Server zu deployen! 🎉