Spaces:
Running
Running
File size: 7,657 Bytes
da0ce7b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | #!/usr/bin/env python3
"""
Production Portfolio Dashboard - Shows Realized Net Profit
"""
from aureon_baton_link import link_system as _baton_link; _baton_link(__name__)
import sys, os
if sys.platform == 'win32':
os.environ['PYTHONIOENCODING'] = 'utf-8'
import json
from datetime import datetime, timezone
from pathlib import Path
def load_json(filename):
try:
with open(filename) as f:
return json.load(f)
except:
return {}
def main():
print()
print("ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ")
print("β ποΈ AUREON TRADING SYSTEM - LIVE PORTFOLIO ποΈ β")
print("β Production-Ready Dashboard β")
print("β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£")
# Load data
baseline = load_json('pnl_baseline.json')
cost_basis = load_json('cost_basis_history.json')
active = load_json('active_position.json')
baseline_value = baseline.get('total_value_usdc', 78.51)
baseline_date = baseline.get('timestamp', 'Unknown')[:10]
print(f"β π
Baseline: {baseline_date} β π° Starting Capital: ${baseline_value:>10.2f} β")
print("β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£")
# Calculate totals from positions
total_invested = 0
total_fees = 0
trade_count = 0
positions = cost_basis.get('positions', {})
print("β π TRADE HISTORY β")
print("β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£")
significant = []
for symbol, pos in positions.items():
cost = pos.get('total_cost', 0)
fees = pos.get('total_fees', 0)
trades = pos.get('trade_count', 0)
qty = pos.get('total_quantity', 0)
total_invested += cost
total_fees += fees if fees < 100 else 0
trade_count += trades
if cost > 1:
significant.append((symbol, cost, qty, trades))
# Sort by cost descending
significant.sort(key=lambda x: -x[1])
for symbol, cost, qty, trades in significant[:15]: # Top 15
print(f"β {symbol:12} β Invested: ${cost:>8.2f} β Qty: {qty:>10.4f} β Trades: {trades:>3} β")
if len(significant) > 15:
print(f"β ... and {len(significant)-15} more positions β")
print("β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£")
print(f"β π Total Invested: ${total_invested:>10.2f} β")
print(f"β πΈ Total Fees: ${total_fees:>10.4f} β")
print(f"β π Total Trades: {trade_count:>10} β")
print("β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£")
# Active position
if active:
print("β π― CURRENT POSITION β")
print("β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£")
symbol = active.get('symbol', 'N/A')
entry = active.get('entry_price', 0)
qty = active.get('quantity', 0)
value = active.get('amount_usdc', 0)
status = active.get('status', 'unknown')
print(f"β Symbol: {symbol:10} β Entry: ${entry:.4f} β Qty: {qty:.4f} β")
print(f"β Value: ${value:.4f} β Status: {status.upper():10} β")
print("β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£")
# Simple realized PnL estimate (invested - baseline = capital deployed)
# This is a simplified view - actual PnL requires current market prices
print("β π° PORTFOLIO PERFORMANCE β")
print("β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£")
# Net capital deployed beyond baseline
net_deployed = total_invested - baseline_value
if net_deployed > 0:
print(f"β β
Capital Growth: ${net_deployed:>10.2f} (above baseline) β")
else:
print(f"β π Capital Intact: ${abs(net_deployed):>10.2f} (within baseline) β")
print(f"β π Fees Paid: ${total_fees:>10.4f} β")
print(f"β π― Trade Activity: {trade_count:>10} executions β")
print("β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£")
print("β π QUEEN'S VERDICT β")
print("β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£")
# Load Queen's decision state
queen_state = load_json('queen_autonomous_state.json')
if queen_state:
decision = queen_state.get('last_decision', {})
confidence = decision.get('confidence', 0)
action = decision.get('action', 'SCANNING')
print(f"β π Decision: {action:10} @ {confidence*100:.1f}% confidence β")
else:
print("β π Decision: OBSERVING MARKET β")
print("β β")
print("β π¬ 'I search, I learn, I evolve, I profit.' β")
print("β - Queen Tina B β")
print("ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ")
print()
if __name__ == "__main__":
main()
|