import json

STATE_FILE = "backtest_state.json"
SHADOW_FILE = "data/shadow-trades.json"

def fix():
    try:
        with open(STATE_FILE, 'r') as f:
            state = json.load(f)
            
        state["next_cursor_date"] = "2026-01-07 14:45:00"
        state["completed_through"] = "2026-01-07 04:15:00 UTC (12:15 WITA approx)"
        state["progress_notes"].append("Batch completed: Shadow trade triggered at 4479.115, current price 4465.165 (+1R running).")
        
        with open(STATE_FILE, 'w') as f:
            json.dump(state, f, indent=2)
            
    except Exception as e:
        print(f"Error: {e}")
        
    import os
    if os.path.exists("backtest.lock"):
        os.remove("backtest.lock")

if __name__ == "__main__":
    fix()
