Release: v0.32 Dashboard - P&L Charts (1d/7d/30d) + Live Binance Performance Analytics
This commit is contained in:
parent
baa909d85a
commit
f953753d0f
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue