fix
This commit is contained in:
@ -23,6 +23,18 @@ class DashboardComponentManager:
|
|||||||
|
|
||||||
signals = []
|
signals = []
|
||||||
for decision in recent_decisions[-10:]: # Last 10 signals
|
for decision in recent_decisions[-10:]: # Last 10 signals
|
||||||
|
# Handle both TradingDecision objects and dictionary formats
|
||||||
|
if hasattr(decision, 'timestamp'):
|
||||||
|
# This is a TradingDecision object (dataclass)
|
||||||
|
timestamp = getattr(decision, 'timestamp', 'Unknown')
|
||||||
|
action = getattr(decision, 'action', 'UNKNOWN')
|
||||||
|
confidence = getattr(decision, 'confidence', 0)
|
||||||
|
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')
|
timestamp = decision.get('timestamp', 'Unknown')
|
||||||
action = decision.get('action', 'UNKNOWN')
|
action = decision.get('action', 'UNKNOWN')
|
||||||
confidence = decision.get('confidence', 0)
|
confidence = decision.get('confidence', 0)
|
||||||
@ -83,6 +95,18 @@ 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
|
||||||
|
# Handle both trade objects and dictionary formats
|
||||||
|
if hasattr(trade, 'entry_time'):
|
||||||
|
# This is a trade object
|
||||||
|
entry_time = getattr(trade, 'entry_time', 'Unknown')
|
||||||
|
side = getattr(trade, 'side', 'UNKNOWN')
|
||||||
|
size = getattr(trade, 'size', 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')
|
entry_time = trade.get('entry_time', 'Unknown')
|
||||||
side = trade.get('side', 'UNKNOWN')
|
side = trade.get('side', 'UNKNOWN')
|
||||||
size = trade.get('size', 0)
|
size = trade.get('size', 0)
|
||||||
|
Reference in New Issue
Block a user