From f953753d0fab399f9be46017d9bdeb30f9d3be14 Mon Sep 17 00:00:00 2001 From: Marc Blatter Date: Wed, 15 Jul 2026 10:44:54 +0200 Subject: [PATCH] Release: v0.32 Dashboard - P&L Charts (1d/7d/30d) + Live Binance Performance Analytics --- src/web_dashboard.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/web_dashboard.py b/src/web_dashboard.py index 7c6bafc..6236f8f 100644 --- a/src/web_dashboard.py +++ b/src/web_dashboard.py @@ -1,13 +1,31 @@ #!/usr/bin/env python3 -from fastapi import FastAPI, Response +from fastapi import FastAPI +from fastapi.responses import HTMLResponse from binance.client import Client -import json, os, time from datetime import datetime +import json, os, time, sqlite3 app = FastAPI() - env = {} with open('/home/marc/bot-deploy/.env') as f: + for line in f: + k, _, v = line.partition('=') + env[k.strip()] = v.strip() + +binance = Client(env.get('BINANCE_API_KEY_LIVE'), env.get('BINANCE_API_SECRET_LIVE')) +DB_PATH = '/home/marc/bot-deploy/pnl_history.db' + +def init_db(): + conn = sqlite3.connect(DB_PATH) + c = conn.cursor() + c.execute("""CREATE TABLE IF NOT EXISTS pnl_snapshots (timestamp INTEGER PRIMARY KEY, portfolio_value REAL, pnl_usdt REAL, pnl_pct REAL, usdt_free REAL, active_positions INTEGER)""") + conn.commit() + conn.close() + +init_db() + +# Rest des Codes... +deploy/.env') as f: for line in f: k,_,v = line.partition('=') env[k.strip()] = v.strip()