#!/usr/bin/env python3
"""
Show summary of tradeable signals.
"""

import json
from pathlib import Path

signals_file = Path("/home/ubuntu/.hermes/workspace/projects/ORDER_FLOW_GRAPH/data/signals_tradeable.json")
with open(signals_file, 'r') as f:
    data = json.load(f)

signals = data['signals']
metadata = data['metadata']

print("="*80)
print("✅ FILTERED TRADEABLE SIGNALS")
print("="*80)

print(f"\n📊 Current Market Price: ${metadata['current_price']:.2f}")
print(f"📌 Price Tolerance: ±${metadata['price_tolerance']}")
print(f"✅ Tradeable signals: {metadata['signal_count']}")
print(f"❌ Filtered out: {metadata['filtered_stale']} stale signals")

# Show absorption signal
absorption = [s for s in signals if s['type'] == 'ABSORPTION']
if absorption:
    print(f"\n💎 ABSORPTION SIGNAL (Highest Quality):")
    for sig in absorption:
        print(f"\n   {sig['direction'].upper()} ABSORPTION")
        print(f"   Entry: ${sig['entry_price']}, Target: ${sig['target_price']}, Stop: ${sig['stop_price']}")
        print(f"   Confidence: {sig['confidence']}, R:R: {sig['risk_reward']}")
        print(f"   {sig['reason']}")

# Show best squeezes
squeezes = [s for s in signals if s['type'] == 'SQUEEZE' and s['confidence'] > 0.8]
squeezes.sort(key=lambda x: x['risk_reward'], reverse=True)

print(f"\n🎯 TOP 5 SQUEEZE SIGNALS:")
for i, sig in enumerate(squeezes[:5], 1):
    print(f"\n   {i}. {sig['direction'].upper()} SQUEEZE")
    print(f"   Entry: ${sig['entry_price']}, Target: ${sig['target_price']}, Stop: ${sig['stop_price']}")
    print(f"   Confidence: {sig['confidence']}, R:R: {sig['risk_reward']}")

print("\n" + "="*80)
print("🌐 UI UPDATED: http://localhost:8080/order_flow_explorer.html")
print("   - All signals now within ±$20 of current price")
print("   - Stale signals ($3830, $5400) removed")
print("   - Refresh browser to see filtered results")
print("="*80)
