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/diagnostics/diagnose_dashboard_data.py from GaryLeckey/aureon-os: direct link, hf CLI and curl.
- Browser
- Download file 10.1 kB
-
https://huggingface.co/spaces/GaryLeckey/aureon-os/resolve/main/scripts/diagnostics/diagnose_dashboard_data.py
- Command line
-
hf download hf://spaces/GaryLeckey/aureon-os/scripts/diagnostics/diagnose_dashboard_data.py
-
curl -L -o diagnose_dashboard_data.py https://huggingface.co/spaces/GaryLeckey/aureon-os/resolve/main/scripts/diagnostics/diagnose_dashboard_data.py
10.1 kB
| #!/usr/bin/env python3 | |
| """ | |
| π DASHBOARD DATA DIAGNOSTICS | |
| Checks what data sources are actually working and returning data. | |
| """ | |
| import sys | |
| import os | |
| import json | |
| import asyncio | |
| # Color codes | |
| GREEN = '\033[92m' | |
| RED = '\033[91m' | |
| YELLOW = '\033[93m' | |
| BLUE = '\033[94m' | |
| RESET = '\033[0m' | |
| async def test_prices(): | |
| """Test if we can fetch prices.""" | |
| print(f"\n{BLUE}π TESTING PRICE FETCHING{RESET}") | |
| # Try unified market cache | |
| try: | |
| from unified_market_cache import get_all_prices, get_ticker | |
| prices = await asyncio.to_thread(get_all_prices) | |
| if prices: | |
| print(f" {GREEN}β Unified Market Cache: {len(prices)} symbols{RESET}") | |
| for sym in ['BTC', 'ETH', 'SOL']: | |
| if sym in prices: | |
| print(f" {sym}: ${prices[sym].get('price', 0):,.2f}") | |
| return True | |
| else: | |
| print(f" {YELLOW}β οΈ Unified Market Cache: No data{RESET}") | |
| except Exception as e: | |
| print(f" {RED}β Unified Market Cache: {str(e)[:100]}{RESET}") | |
| # Try CoinGecko fallback | |
| try: | |
| import aiohttp | |
| async with aiohttp.ClientSession() as session: | |
| url = "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum,solana&vs_currencies=usd&include_24hr_change=true" | |
| async with session.get(url) as resp: | |
| if resp.status == 200: | |
| data = await resp.json() | |
| print(f" {GREEN}β CoinGecko API: Working{RESET}") | |
| if 'bitcoin' in data: | |
| print(f" BTC: ${data['bitcoin']['usd']:,.2f}") | |
| return True | |
| except Exception as e: | |
| print(f" {RED}β CoinGecko: {str(e)[:100]}{RESET}") | |
| return False | |
| async def test_portfolio(): | |
| """Test if we can fetch portfolio data.""" | |
| print(f"\n{BLUE}πΌ TESTING PORTFOLIO FETCHING{RESET}") | |
| # Try live_position_viewer | |
| try: | |
| from live_position_viewer import get_binance_positions, get_alpaca_positions | |
| binance_pos = await asyncio.to_thread(get_binance_positions) | |
| print(f" {GREEN}β Binance positions: {len(binance_pos)} positions{RESET}") | |
| alpaca_pos = await asyncio.to_thread(get_alpaca_positions) | |
| print(f" {GREEN}β Alpaca positions: {len(alpaca_pos)} positions{RESET}") | |
| return len(binance_pos) > 0 or len(alpaca_pos) > 0 | |
| except Exception as e: | |
| print(f" {RED}β Live Position Viewer: {str(e)[:100]}{RESET}") | |
| # Try state files | |
| try: | |
| state_files = [ | |
| 'dashboard_snapshot.json', | |
| 'cost_basis_history.json', | |
| 'tracked_positions.json' | |
| ] | |
| for filename in state_files: | |
| if os.path.exists(filename): | |
| with open(filename, 'r') as f: | |
| data = json.load(f) | |
| size = len(json.dumps(data)) | |
| print(f" {GREEN}β {filename}: {size} bytes{RESET}") | |
| else: | |
| print(f" {YELLOW}β οΈ {filename}: Not found{RESET}") | |
| except Exception as e: | |
| print(f" {RED}β State files: {str(e)[:100]}{RESET}") | |
| return False | |
| async def test_balances(): | |
| """Test if we can fetch exchange balances.""" | |
| print(f"\n{BLUE}π° TESTING EXCHANGE BALANCES{RESET}") | |
| exchanges = [ | |
| ('binance_client', 'BinanceClient'), | |
| ('kraken_client', 'KrakenClient'), | |
| ('alpaca_client', 'AlpacaClient') | |
| ] | |
| working = 0 | |
| for module_name, class_name in exchanges: | |
| try: | |
| module = __import__(module_name) | |
| client_class = getattr(module, class_name) | |
| client = client_class() | |
| balance = await asyncio.to_thread(client.get_balance) | |
| if balance: | |
| total = sum(float(v) for v in balance.values() if v) | |
| print(f" {GREEN}β {class_name}: ${total:,.2f}{RESET}") | |
| working += 1 | |
| else: | |
| print(f" {YELLOW}β οΈ {class_name}: Empty balance{RESET}") | |
| except Exception as e: | |
| error_msg = str(e) | |
| if 'API' in error_msg or 'key' in error_msg.lower(): | |
| print(f" {YELLOW}β οΈ {class_name}: No API keys{RESET}") | |
| else: | |
| print(f" {RED}β {class_name}: {error_msg[:60]}{RESET}") | |
| return working > 0 | |
| async def test_ocean_scanner(): | |
| """Test if Ocean Scanner can fetch data.""" | |
| print(f"\n{BLUE}π TESTING OCEAN SCANNER{RESET}") | |
| try: | |
| from aureon_ocean_scanner import OceanScanner | |
| # Create scanner with available exchanges | |
| exchanges = {} | |
| # Try to load exchanges | |
| for exch_name, client_name in [('kraken', 'KrakenClient'), ('binance', 'BinanceClient'), ('alpaca', 'AlpacaClient')]: | |
| try: | |
| if exch_name == 'kraken': | |
| from kraken_client import KrakenClient, get_kraken_client | |
| exchanges['kraken'] = get_kraken_client() | |
| elif exch_name == 'binance': | |
| from binance_client import BinanceClient, get_binance_client | |
| exchanges['binance'] = BinanceClient() | |
| elif exch_name == 'alpaca': | |
| from alpaca_client import AlpacaClient | |
| exchanges['alpaca'] = AlpacaClient() | |
| except: | |
| pass | |
| if exchanges: | |
| scanner = OceanScanner(exchanges) | |
| print(f" {GREEN}β Ocean Scanner initialized with {len(exchanges)} exchange(s){RESET}") | |
| # Try to discover universe | |
| await scanner.discover_universe() | |
| summary = scanner.get_ocean_summary() | |
| universe_size = summary.get('universe_size', {}).get('total', 0) | |
| print(f" {GREEN}β Universe discovered: {universe_size:,} symbols{RESET}") | |
| return True | |
| else: | |
| print(f" {YELLOW}β οΈ No exchanges available for Ocean Scanner{RESET}") | |
| except Exception as e: | |
| print(f" {RED}β Ocean Scanner: {str(e)[:100]}{RESET}") | |
| return False | |
| async def test_queen_narrator(): | |
| """Test if Queen Narrator is working.""" | |
| print(f"\n{BLUE}π TESTING QUEEN COGNITIVE NARRATOR{RESET}") | |
| try: | |
| from queen_cognitive_narrator import QueenCognitiveNarrator | |
| narrator = QueenCognitiveNarrator() | |
| print(f" {GREEN}β Queen Narrator initialized{RESET}") | |
| # Update context | |
| narrator.update_context( | |
| btc_price=78883.00, | |
| btc_change_24h=1.91, | |
| portfolio_value=0, | |
| unrealized_pnl=0, | |
| active_positions=0 | |
| ) | |
| # Get thought | |
| thought = narrator.get_latest_thought() | |
| if thought: | |
| print(f" {GREEN}β Generated thought: {thought.get('title', 'N/A')}{RESET}") | |
| return True | |
| else: | |
| print(f" {YELLOW}β οΈ No thought generated{RESET}") | |
| except Exception as e: | |
| print(f" {RED}β Queen Narrator: {str(e)[:100]}{RESET}") | |
| return False | |
| async def test_harmonic_field(): | |
| """Test if Harmonic Field is working.""" | |
| print(f"\n{BLUE}π© TESTING HARMONIC LIQUID ALUMINIUM FIELD{RESET}") | |
| try: | |
| from aureon_harmonic_liquid_aluminium import HarmonicLiquidAluminiumField | |
| field = HarmonicLiquidAluminiumField() | |
| print(f" {GREEN}β Harmonic Field initialized{RESET}") | |
| # Capture snapshot | |
| snapshot = field.capture_snapshot() | |
| print(f" {GREEN}β Snapshot captured{RESET}") | |
| print(f" Frequency: {snapshot.frequency} Hz") | |
| print(f" Amplitude: {snapshot.amplitude:.4f}") | |
| print(f" Pattern: {snapshot.pattern}") | |
| return True | |
| except Exception as e: | |
| print(f" {RED}β Harmonic Field: {str(e)[:100]}{RESET}") | |
| return False | |
| async def main(): | |
| print(f"\n{BLUE}{'='*70}{RESET}") | |
| print(f"{BLUE}π AUREON PRO DASHBOARD - DATA DIAGNOSTICS{RESET}") | |
| print(f"{BLUE}{'='*70}{RESET}") | |
| results = {} | |
| # Test each data source | |
| results['prices'] = await test_prices() | |
| results['portfolio'] = await test_portfolio() | |
| results['balances'] = await test_balances() | |
| results['ocean'] = await test_ocean_scanner() | |
| results['queen'] = await test_queen_narrator() | |
| results['harmonic'] = await test_harmonic_field() | |
| # Summary | |
| print(f"\n{BLUE}{'='*70}{RESET}") | |
| print(f"{BLUE}π SUMMARY{RESET}") | |
| print(f"{BLUE}{'='*70}{RESET}") | |
| working = sum(1 for v in results.values() if v) | |
| total = len(results) | |
| for name, status in results.items(): | |
| icon = f"{GREEN}β {RESET}" if status else f"{RED}β{RESET}" | |
| print(f" {icon} {name.title()}") | |
| print(f"\n {GREEN if working == total else YELLOW}Working: {working}/{total}{RESET}") | |
| # Recommendations | |
| print(f"\n{BLUE}π‘ RECOMMENDATIONS:{RESET}") | |
| if not results['balances']: | |
| print(f" β’ Set API keys in DigitalOcean for live balance data") | |
| if not results['portfolio']: | |
| print(f" β’ Portfolio will be empty until you have open positions") | |
| print(f" β’ Or set API keys to fetch live positions") | |
| if results['prices'] and results['queen'] and results['harmonic']: | |
| print(f" β’ {GREEN}β Dashboard core functionality is WORKING!{RESET}") | |
| print(f" β’ Prices, Queen commentary, and harmonic field are live") | |
| print(f"\n{BLUE}π The dashboard is showing exactly what it should!{RESET}") | |
| print(f" Missing data is due to no API keys (expected in demo mode)") | |
| if __name__ == '__main__': | |
| asyncio.run(main()) | |