aureon-os / scripts /python /show_portfolio.py
GaryLeckey's picture
Deploy Aureon OS (deploy/selfhost stack: nginx edge + fusion API x2 + console + HNC organ + redis + postgres; paper mode) (part 19)
da0ce7b verified
Raw History Blame Contribute Delete
7.66 kB
#!/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()