#!/usr/bin/env python3 import json from datetime import datetime import time def add_current_trade(): """Add a trade with current timestamp for immediate visibility""" now = datetime.now() # Create a trade that just happened current_trade = { 'trade_id': 999, 'symbol': 'ETHUSDT', 'side': 'LONG', 'entry_time': (now - timedelta(seconds=30)).isoformat(), # 30 seconds ago 'exit_time': now.isoformat(), # Just now 'entry_price': 2434.50, 'exit_price': 2434.70, 'size': 0.001, 'fees': 0.05, 'net_pnl': 0.15, # Small profit 'mexc_executed': True, 'duration_seconds': 30, 'leverage': 50.0, 'gross_pnl': 0.20, 'fee_type': 'TAKER', 'fee_rate': 0.0005 } # Load existing trades try: with open('closed_trades_history.json', 'r') as f: trades = json.load(f) except: trades = [] # Add the current trade trades.append(current_trade) # Save back with open('closed_trades_history.json', 'w') as f: json.dump(trades, f, indent=2) print(f"✅ Added current trade: LONG @ {current_trade['entry_time']} -> {current_trade['exit_time']}") print(f" Entry: ${current_trade['entry_price']} | Exit: ${current_trade['exit_price']} | P&L: ${current_trade['net_pnl']}") if __name__ == "__main__": from datetime import timedelta add_current_trade()