Spaces:
Running
Running
Deploy Aureon OS (deploy/selfhost stack: nginx edge + fusion API x2 + console + HNC organ + redis + postgres; paper mode) (part 19)
da0ce7b verified Download scripts/python/show_portfolio.py from GaryLeckey/aureon-os: direct link, hf CLI and curl.
- Browser
- Download file 7.66 kB
-
https://huggingface.co/spaces/GaryLeckey/aureon-os/resolve/main/scripts/python/show_portfolio.py
- Command line
-
hf download hf://spaces/GaryLeckey/aureon-os/scripts/python/show_portfolio.py
-
curl -L -o show_portfolio.py https://huggingface.co/spaces/GaryLeckey/aureon-os/resolve/main/scripts/python/show_portfolio.py
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() | |