Bot auto-update: src/__pycache__/web_dashboard.cpython-310.pyc,src/web_dashboard.py

This commit is contained in:
Marc Blatter 2026-07-04 13:14:44 +02:00
parent 24ad000c3b
commit 51bf3df227
2 changed files with 184 additions and 207 deletions

View File

@ -210,207 +210,184 @@ html_content = """
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Trading Bot Dashboard</title> <title>Trading Bot Dashboard</title>
<style> <style>
* { * {
margin: 0; margin: 0;
padding: 0; padding: 0;
box-sizing: border-box; box-sizing: border-box;
} }
body { body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #0a0a0a;
background: linear-gradient(135deg, #2ecc71c29 0%, #302b63 100%); color: #d0d0d0;
color: #e0e0e0; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
padding: 20px; line-height: 1.6;
min-height: 100vh; }
}
h1, h2, h3, h4 {
.container { color: #ffffff;
max-width: 1400px; }
margin: 0 auto;
} .container {
max-width: 1400px;
.header { margin: 0 auto;
text-align: center; padding: 40px;
margin-bottom: 30px; }
border-bottom: 2px solid #6c63ff;
padding-bottom: 20px; .header {
} display: flex;
justify-content: space-between;
.header h1 { align-items: center;
font-size: 2.5em; margin-bottom: 40px;
color: #6c63ff; padding-bottom: 20px;
margin-bottom: 10px; border-bottom: 1px solid #2a2a2a;
} }
.status { .header h1 {
display: inline-block; color: #ffffff;
padding: 8px 16px; font-size: 28px;
background: #00c853; }
color: white;
border-radius: 20px; .status-badge {
font-weight: bold; background-color: #2ecc71;
font-size: 0.9em; color: #000;
} padding: 6px 14px;
border-radius: 20px;
.grid { font-size: 12px;
display: grid; font-weight: 600;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
gap: 20px;
margin-bottom: 30px; .metrics-grid {
} display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
.card { gap: 20px;
background: rgba(255, 255, 255, 0.1); margin-bottom: 40px;
border: 1px solid #6c63ff; }
border-radius: 10px;
padding: 20px; .card {
backdrop-filter: blur(10px); background-color: #1a1a1a;
transition: all 0.3s ease; border: 1px solid #2a2a2a;
} border-radius: 8px;
padding: 24px;
.card:hover { }
background: rgba(255, 255, 255, 0.15);
border-color: #00c853; .card:hover {
transform: translateY(-5px); border-color: #3a3a3a;
} }
.card-title { .card-label {
color: #6c63ff; color: #888888;
font-size: 0.9em; font-size: 11px;
text-transform: uppercase; text-transform: uppercase;
letter-spacing: 1px; letter-spacing: 1px;
margin-bottom: 10px; margin-bottom: 12px;
} font-weight: 600;
}
.card-value {
font-size: 2em; .card-value {
font-weight: bold; color: #ffffff;
color: #e0e0e0; font-size: 32px;
margin-bottom: 5px; font-weight: 700;
} margin-bottom: 4px;
}
.card-sub {
color: #a0a0a0; .card-subtext {
font-size: 0.85em; color: #666666;
} font-size: 12px;
}
.positive {
color: #00c853; .positive {
} color: #2ecc71;
}
.negative {
color: #ff3d00; .negative {
} color: #ff5555;
}
.section {
margin-bottom: 30px; .section-title {
} color: #ffffff;
font-size: 18px;
.section-title { font-weight: 700;
color: #6c63ff; margin: 40px 0 20px 0;
font-size: 1.5em; padding-bottom: 10px;
margin-bottom: 15px; border-bottom: 1px solid #2a2a2a;
border-bottom: 1px solid #6c63ff; }
padding-bottom: 10px;
} .performance-grid {
display: grid;
.trades-list { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
display: grid; gap: 16px;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-bottom: 40px;
gap: 15px; }
}
.performance-card {
.trade-card { background-color: #1a1a1a;
background: rgba(255, 255, 255, 0.08); border: 1px solid #2a2a2a;
border-left: 4px solid #6c63ff; border-radius: 8px;
border-radius: 5px; padding: 20px;
padding: 15px; text-align: center;
font-size: 0.9em; }
}
.performance-label {
.trade-card.open { color: #888888;
border-left-color: #6c63ff; font-size: 11px;
} text-transform: uppercase;
letter-spacing: 1px;
.trade-card.closed { margin-bottom: 10px;
border-left-color: #00c853; font-weight: 600;
} }
.trade-pair { .performance-value {
font-weight: bold; color: #2ecc71;
color: #6c63ff; font-size: 28px;
margin-bottom: 8px; font-weight: 700;
} }
.trade-info { table {
display: grid; width: 100%;
grid-template-columns: 1fr 1fr; border-collapse: collapse;
gap: 10px; margin-bottom: 40px;
font-size: 0.85em; }
color: #a0a0a0;
} th {
background-color: #151515;
.trade-info strong { color: #888888;
color: #e0e0e0; padding: 14px;
} text-align: left;
font-size: 11px;
.swap-item { font-weight: 600;
background: rgba(255, 255, 255, 0.05); text-transform: uppercase;
padding: 10px; letter-spacing: 0.5px;
border-radius: 5px; border-bottom: 1px solid #2a2a2a;
margin-bottom: 8px; }
font-size: 0.85em;
} td {
padding: 14px;
.performance-grid { border-bottom: 1px solid #1f1f1f;
display: grid; color: #d0d0d0;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); font-size: 13px;
gap: 15px; }
}
tr:hover {
.stat-card { background-color: #141414;
background: rgba(108, 99, 255, 0.2); }
border: 1px solid #6c63ff;
border-radius: 8px; .empty-state {
padding: 15px; text-align: center;
text-align: center; color: #666666;
} padding: 40px;
font-style: italic;
.stat-label { font-size: 13px;
color: #a0a0a0; }
font-size: 0.8em;
text-transform: uppercase; .last-update {
margin-bottom: 8px; text-align: right;
} color: #666666;
font-size: 11px;
.stat-value { margin-top: 20px;
font-size: 1.8em; padding-top: 20px;
font-weight: bold; border-top: 1px solid #2a2a2a;
color: #00c853; }
} </style>
.stat-value.loss {
color: #ff3d00;
}
.update-time {
text-align: right;
color: #666;
font-size: 0.8em;
margin-top: 20px;
padding-top: 20px;
border-top: 1px solid #333;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
.fade-in {
animation: fadeIn 0.3s ease-in;
}
</style>
</head> </head>
<body> <body>
<div class="container"> <div class="container">
@ -518,26 +495,26 @@ html_content = """
} }
function updateDashboard(data) { function updateDashboard(data) {
// Update key metrics - CHF PRIMARY, USD secondary // Update key metrics - PRIMARY, USD secondary
const usdt = data.balance.USDT || 0; const usdt = data.balance.USDT || 0;
const usdt_chf = usdt * 0.84; const usdt_chf = usdt * 0.84;
document.getElementById('usdt').textContent = `$${usdt.toFixed(2)} / CHF ${usdt_chf.toFixed(2)}`; document.getElementById('usdt').textContent = `$${usdt.toFixed(2)}${usdt_chf.toFixed(2)}`;
const portfolio_usd = data.portfolio_value_usd || 0; const portfolio_usd = data.portfolio_value_usd || 0;
const portfolio_chf = data.portfolio_value_chf || (portfolio_usd * 0.84); const portfolio_chf = data.portfolio_value_chf || (portfolio_usd * 0.84);
document.getElementById('portfolio').textContent = `$${portfolio_usd.toFixed(2)} / CHF ${portfolio_chf.toFixed(2)}`; document.getElementById('portfolio').textContent = `$${portfolio_usd.toFixed(2)}${portfolio_chf.toFixed(2)}`;
// Update P&L with color - CHF primary // Update P&L with color - primary
const dailyPnl = data.daily_pnl || 0; const dailyPnl = data.daily_pnl || 0;
const dailyPnl_chf = dailyPnl * 0.84; const dailyPnl_chf = dailyPnl * 0.84;
const dailyPnlEl = document.getElementById('daily-pnl'); const dailyPnlEl = document.getElementById('daily-pnl');
dailyPnlEl.textContent = `$${dailyPnl >= 0 ? '+' : ''}${dailyPnl.toFixed(2)} / CHF ${dailyPnl_chf >= 0 ? '+' : ''}${dailyPnl_chf.toFixed(2)}`; dailyPnlEl.textContent = `$${dailyPnl >= 0 ? '+' : ''}${dailyPnl.toFixed(2)}${dailyPnl_chf >= 0 ? '+' : ''}${dailyPnl_chf.toFixed(2)}`;
dailyPnlEl.className = 'card-value ' + (dailyPnl >= 0 ? 'positive' : 'negative'); dailyPnlEl.className = 'card-value ' + (dailyPnl >= 0 ? 'positive' : 'negative');
const totalPnl = data.total_pnl || 0; const totalPnl = data.total_pnl || 0;
const totalPnl_chf = totalPnl * 0.84; const totalPnl_chf = totalPnl * 0.84;
const totalPnlEl = document.getElementById('total-pnl'); const totalPnlEl = document.getElementById('total-pnl');
totalPnlEl.textContent = `$${totalPnl >= 0 ? '+' : ''}${totalPnl.toFixed(2)} / CHF ${totalPnl_chf >= 0 ? '+' : ''}${totalPnl_chf.toFixed(2)}`; totalPnlEl.textContent = `$${totalPnl >= 0 ? '+' : ''}${totalPnl.toFixed(2)}${totalPnl_chf >= 0 ? '+' : ''}${totalPnl_chf.toFixed(2)}`;
totalPnlEl.className = 'card-value ' + (totalPnl >= 0 ? 'positive' : 'negative'); totalPnlEl.className = 'card-value ' + (totalPnl >= 0 ? 'positive' : 'negative');
// Update performance // Update performance