fix
This commit is contained in:
@ -23,13 +23,25 @@ class DashboardComponentManager:
|
|||||||
|
|
||||||
signals = []
|
signals = []
|
||||||
for decision in recent_decisions[-10:]: # Last 10 signals
|
for decision in recent_decisions[-10:]: # Last 10 signals
|
||||||
timestamp = decision.get('timestamp', 'Unknown')
|
# Handle both TradingDecision objects and dictionary formats
|
||||||
action = decision.get('action', 'UNKNOWN')
|
if hasattr(decision, 'timestamp'):
|
||||||
confidence = decision.get('confidence', 0)
|
# This is a TradingDecision object (dataclass)
|
||||||
price = decision.get('price', 0)
|
timestamp = getattr(decision, 'timestamp', 'Unknown')
|
||||||
executed = decision.get('executed', False)
|
action = getattr(decision, 'action', 'UNKNOWN')
|
||||||
blocked = decision.get('blocked', False)
|
confidence = getattr(decision, 'confidence', 0)
|
||||||
manual = decision.get('manual', False)
|
price = getattr(decision, 'price', 0)
|
||||||
|
executed = getattr(decision, 'executed', False)
|
||||||
|
blocked = getattr(decision, 'blocked', False)
|
||||||
|
manual = getattr(decision, 'manual', False)
|
||||||
|
else:
|
||||||
|
# This is a dictionary format
|
||||||
|
timestamp = decision.get('timestamp', 'Unknown')
|
||||||
|
action = decision.get('action', 'UNKNOWN')
|
||||||
|
confidence = decision.get('confidence', 0)
|
||||||
|
price = decision.get('price', 0)
|
||||||
|
executed = decision.get('executed', False)
|
||||||
|
blocked = decision.get('blocked', False)
|
||||||
|
manual = decision.get('manual', False)
|
||||||
|
|
||||||
# Determine signal style
|
# Determine signal style
|
||||||
if executed:
|
if executed:
|
||||||
@ -83,13 +95,25 @@ class DashboardComponentManager:
|
|||||||
# Create table rows
|
# Create table rows
|
||||||
rows = []
|
rows = []
|
||||||
for trade in closed_trades[-20:]: # Last 20 trades
|
for trade in closed_trades[-20:]: # Last 20 trades
|
||||||
entry_time = trade.get('entry_time', 'Unknown')
|
# Handle both trade objects and dictionary formats
|
||||||
side = trade.get('side', 'UNKNOWN')
|
if hasattr(trade, 'entry_time'):
|
||||||
size = trade.get('size', 0)
|
# This is a trade object
|
||||||
entry_price = trade.get('entry_price', 0)
|
entry_time = getattr(trade, 'entry_time', 'Unknown')
|
||||||
exit_price = trade.get('exit_price', 0)
|
side = getattr(trade, 'side', 'UNKNOWN')
|
||||||
pnl = trade.get('pnl', 0)
|
size = getattr(trade, 'size', 0)
|
||||||
fees = trade.get('fees', 0)
|
entry_price = getattr(trade, 'entry_price', 0)
|
||||||
|
exit_price = getattr(trade, 'exit_price', 0)
|
||||||
|
pnl = getattr(trade, 'pnl', 0)
|
||||||
|
fees = getattr(trade, 'fees', 0)
|
||||||
|
else:
|
||||||
|
# This is a dictionary format
|
||||||
|
entry_time = trade.get('entry_time', 'Unknown')
|
||||||
|
side = trade.get('side', 'UNKNOWN')
|
||||||
|
size = trade.get('size', 0)
|
||||||
|
entry_price = trade.get('entry_price', 0)
|
||||||
|
exit_price = trade.get('exit_price', 0)
|
||||||
|
pnl = trade.get('pnl', 0)
|
||||||
|
fees = trade.get('fees', 0)
|
||||||
|
|
||||||
# Format time
|
# Format time
|
||||||
if isinstance(entry_time, datetime):
|
if isinstance(entry_time, datetime):
|
||||||
|
Reference in New Issue
Block a user