fix: db migration tab char corrupted, restore historical trades
This commit is contained in:
@@ -373,6 +373,11 @@ func (d *Dashboard) broadcastLoop() {
|
||||
"duration": time.Since(pos.StartedAt).Round(time.Second).String(),
|
||||
"started_at": pos.StartedAt.Format("15:04:05"),
|
||||
"started_ts": pos.StartedAt.UnixMilli(),
|
||||
"long_exchange": pos.LongLeg.Exchange,
|
||||
"short_exchange": pos.ShortLeg.Exchange,
|
||||
"long_entry": pos.LongLeg.EntryPrice,
|
||||
"short_entry": pos.ShortLeg.EntryPrice,
|
||||
"db_trade_id": pos.DBTradeID,
|
||||
}
|
||||
|
||||
// Calculate live PnL from current prices — use weighted average for scale-ins
|
||||
@@ -474,6 +479,18 @@ func (d *Dashboard) broadcastLoop() {
|
||||
d.connMu.RUnlock()
|
||||
stats["connections"] = connInfo
|
||||
|
||||
// Per-exchange fund tracking
|
||||
exFunds := d.trader.GetExchangeFunds()
|
||||
exFundsMap := make(map[string]map[string]float64, len(exFunds))
|
||||
for ex, ef := range exFunds {
|
||||
exFundsMap[ex] = map[string]float64{
|
||||
"balance": math.Round(ef.Balance*100) / 100,
|
||||
"total_fee": math.Round(ef.TotalFee*100) / 100,
|
||||
"total_pnl": math.Round(ef.TotalPnl*100) / 100,
|
||||
}
|
||||
}
|
||||
stats["exchange_funds"] = exFundsMap
|
||||
|
||||
// Blacklist — stale spread coins
|
||||
bl := d.trader.GetBlacklist()
|
||||
blList := make([]map[string]interface{}, 0, len(bl))
|
||||
|
||||
Reference in New Issue
Block a user