Compare commits

..

2 Commits

Author SHA1 Message Date
Marc Blatter eafbb4a25d Bot auto-update: src/__pycache__/web_dashboard.cpython-310.pyc 2026-07-04 13:00:01 +02:00
Marc Blatter 5a80f5b5ba Rollback Dashboard: Restored functional USD-only design (v b41d00b) 2026-07-04 12:59:23 +02:00
2 changed files with 208 additions and 199 deletions

View File

@ -118,11 +118,9 @@ async def record_buy(pair: str, qty: float, price: float):
"""Record a buy trade""" """Record a buy trade"""
trading_state['current_trades'][pair] = { trading_state['current_trades'][pair] = {
'qty': qty, 'qty': qty,
'buy_price': price, 'entry_price': price,
'buy_time': datetime.now().isoformat(), 'entry_time': datetime.now().isoformat(),
'peak_profit': 0, 'type': 'BUY'
'trailing_stop': None,
'order_id': None
} }
trading_state['trades_today'] += 1 trading_state['trades_today'] += 1
await broadcast_update() await broadcast_update()
@ -210,196 +208,207 @@ 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 {
background-color: #0a0a0a; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
color: #e0e0e0; background: linear-gradient(135deg, #0f0c29 0%, #302b63 100%);
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Inter', sans-serif; color: #e0e0e0;
line-height: 1.8; padding: 20px;
letter-spacing: 0.3px; min-height: 100vh;
} }
.header { .container {
background-color: #121212; max-width: 1400px;
border-bottom: 1px solid #1f1f1f; margin: 0 auto;
padding: 40px 60px; }
}
.header h1 { .header {
color: #ffffff; text-align: center;
font-size: 32px; margin-bottom: 30px;
font-weight: 700; border-bottom: 2px solid #6c63ff;
letter-spacing: -0.5px; padding-bottom: 20px;
} }
.container { .header h1 {
max-width: 1800px; font-size: 2.5em;
margin: 0 auto; color: #6c63ff;
padding: 60px 60px; margin-bottom: 10px;
} }
.grid-auto { .status {
display: grid; display: inline-block;
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); padding: 8px 16px;
gap: 24px; background: #00c853;
margin-bottom: 60px; color: white;
} border-radius: 20px;
font-weight: bold;
font-size: 0.9em;
}
.card { .grid {
background-color: #1a1a1a; display: grid;
border: 1px solid #2a2a2a; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
border-radius: 16px; gap: 20px;
padding: 28px; margin-bottom: 30px;
backdrop-filter: blur(10px); }
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.card:hover { .card {
background-color: #1f1f1f; background: rgba(255, 255, 255, 0.1);
border-color: #3a3a3a; border: 1px solid #6c63ff;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.20); border-radius: 10px;
} padding: 20px;
backdrop-filter: blur(10px);
transition: all 0.3s ease;
}
.card-label { .card:hover {
color: #888888; background: rgba(255, 255, 255, 0.15);
font-size: 12px; border-color: #00c853;
text-transform: uppercase; transform: translateY(-5px);
letter-spacing: 1.2px; }
margin-bottom: 12px;
font-weight: 600;
}
.card-value { .card-title {
color: #ffffff; color: #6c63ff;
font-size: 36px; font-size: 0.9em;
font-weight: 700; text-transform: uppercase;
line-height: 1.2; letter-spacing: 1px;
margin-bottom: 8px; margin-bottom: 10px;
} }
.card-subtitle { .card-value {
color: #666666; font-size: 2em;
font-size: 13px; font-weight: bold;
font-weight: 500; color: #e0e0e0;
} margin-bottom: 5px;
}
.card-positive { .card-sub {
color: #2ecc71; color: #a0a0a0;
} font-size: 0.85em;
}
.card-negative { .positive {
color: #e74c3c; color: #00c853;
} }
.section-title { .negative {
color: #ffffff; color: #ff3d00;
font-size: 24px; }
font-weight: 700;
margin: 60px 0 32px 0;
letter-spacing: -0.3px;
}
.content-block { .section {
background-color: #1a1a1a; margin-bottom: 30px;
border: 1px solid #2a2a2a; }
border-radius: 16px;
padding: 32px;
margin-bottom: 40px;
}
table { .section-title {
width: 100%; color: #6c63ff;
border-collapse: collapse; font-size: 1.5em;
} margin-bottom: 15px;
border-bottom: 1px solid #6c63ff;
padding-bottom: 10px;
}
th { .trades-list {
background-color: #121212; display: grid;
color: #b0b0b0; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
padding: 16px 20px; gap: 15px;
text-align: left; }
font-size: 12px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 1px;
border-bottom: 1px solid #2a2a2a;
}
td { .trade-card {
padding: 16px 20px; background: rgba(255, 255, 255, 0.08);
border-bottom: 1px solid #1f1f1f; border-left: 4px solid #6c63ff;
color: #d0d0d0; border-radius: 5px;
font-size: 14px; padding: 15px;
} font-size: 0.9em;
}
tr:last-child td { .trade-card.open {
border-bottom: none; border-left-color: #6c63ff;
} }
tbody tr:hover { .trade-card.closed {
background-color: #0f0f0f; border-left-color: #00c853;
} }
.status-badge { .trade-pair {
display: inline-block; font-weight: bold;
padding: 6px 12px; color: #6c63ff;
border-radius: 8px; margin-bottom: 8px;
font-size: 11px; }
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.5px;
}
.badge-live { .trade-info {
background-color: #1a1a1a; display: grid;
color: #888888; grid-template-columns: 1fr 1fr;
border: 1px solid #2a2a2a; gap: 10px;
} font-size: 0.85em;
color: #a0a0a0;
}
.badge-profit { .trade-info strong {
background-color: rgba(46, 204, 113, 0.15); color: #e0e0e0;
color: #2ecc71; }
}
.badge-loss { .swap-item {
background-color: rgba(231, 76, 60, 0.15); background: rgba(255, 255, 255, 0.05);
color: #e74c3c; padding: 10px;
} border-radius: 5px;
margin-bottom: 8px;
font-size: 0.85em;
}
.metric-row { .performance-grid {
display: grid; display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 20px; gap: 15px;
margin-bottom: 40px; }
}
.spacer { .stat-card {
height: 1px; background: rgba(108, 99, 255, 0.2);
background-color: #1f1f1f; border: 1px solid #6c63ff;
margin: 40px 0; border-radius: 8px;
} padding: 15px;
text-align: center;
}
.footer-text { .stat-label {
color: #666666; color: #a0a0a0;
font-size: 12px; font-size: 0.8em;
text-align: right; text-transform: uppercase;
margin-top: 40px; margin-bottom: 8px;
padding-top: 20px; }
border-top: 1px solid #1f1f1f;
}
.empty-state { .stat-value {
text-align: center; font-size: 1.8em;
color: #555555; font-weight: bold;
padding: 60px 20px; color: #00c853;
font-size: 14px; }
}
</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">
@ -510,23 +519,23 @@ html_content = """
// Update key metrics - CHF PRIMARY, USD secondary // Update key metrics - CHF 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)}`; document.getElementById('usdt').textContent = `$${usdt.toFixed(2)} / CHF ${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)}`; document.getElementById('portfolio').textContent = `$${portfolio_usd.toFixed(2)} / CHF ${portfolio_chf.toFixed(2)}`;
// Update P&L with color - CHF primary // Update P&L with color - CHF 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)}`; dailyPnlEl.textContent = `$${dailyPnl >= 0 ? '+' : ''}${dailyPnl.toFixed(2)} / CHF ${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)}`; totalPnlEl.textContent = `$${totalPnl >= 0 ? '+' : ''}${totalPnl.toFixed(2)} / CHF ${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