File size: 3,504 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
#!/usr/bin/env python3
"""

πŸ” LIVE TRADE MONITOR - Watch Micro Profit Labyrinth

"""
from aureon_baton_link import link_system as _baton_link; _baton_link(__name__)
import json
import time
import os
from datetime import datetime

def monitor_trades():
    """Watch trades in real-time"""
    last_count = 0
    
    while True:
        try:
            # Read pending validations
            if os.path.exists('7day_pending_validations.json'):
                with open('7day_pending_validations.json', 'r') as f:
                    trades = json.load(f)
                
                current_count = len(trades)
                
                print(f"\n{'='*70}")
                print(f"⏰ {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
                print(f"{'='*70}")
                print(f"πŸ“Š Total Trades: {current_count}")
                
                # Show last 5 trades
                if trades:
                    print(f"\nπŸ“ˆ RECENT TRADES (Last 5):")
                    print(f"{'-'*70}")
                    
                    for trade in trades[-5:]:
                        symbol = trade.get('symbol', 'UNKNOWN')
                        entry = trade.get('entry_price', 0)
                        exit_p = trade.get('exit_price', 0)
                        entry_t = trade.get('entry_time', '')[:19]
                        exit_t = trade.get('exit_time', '')[:19]
                        
                        # Calculate P&L
                        actual_edge = trade.get('actual_edge', 0)
                        status = trade.get('status', 'unknown')
                        
                        if actual_edge > 0:
                            emoji = 'βœ…'
                        elif actual_edge < 0:
                            emoji = '❌'
                        else:
                            emoji = 'βšͺ'
                        
                        print(f"{emoji} {symbol:15} | Entry: {entry:.8f} β†’ Exit: {exit_p:.8f}")
                        print(f"   PnL: ${actual_edge:+.4f} | Status: {status}")
                        print(f"   Time: {entry_t} β†’ {exit_t}")
                        print()
                    
                    # Calculate totals
                    total_pnl = sum(t.get('actual_edge', 0) for t in trades)
                    wins = sum(1 for t in trades if t.get('actual_edge', 0) > 0)
                    losses = sum(1 for t in trades if t.get('actual_edge', 0) < 0)
                    
                    print(f"{'-'*70}")
                    print(f"πŸ’° TOTALS: ${total_pnl:+.2f} | Wins: {wins} | Losses: {losses} | Win%: {wins/(wins+losses)*100 if (wins+losses) > 0 else 0:.0f}%")
                
                # Check for new trades
                if current_count > last_count:
                    new_trades = current_count - last_count
                    print(f"\nπŸ†• {new_trades} NEW TRADE(S) SINCE LAST CHECK!")
                    last_count = current_count
            
            # Wait 5 seconds before next check
            time.sleep(5)
            
        except KeyboardInterrupt:
            print("\n\nπŸ‘‹ Monitor stopped")
            break
        except Exception as e:
            print(f"⚠️ Error: {e}")
            time.sleep(5)

if __name__ == "__main__":
    print("πŸ” LIVE TRADE MONITOR - Starting...")
    print("Press Ctrl+C to stop\n")
    monitor_trades()