Fix datetime parsing in log_trade to handle ISO8601 format

This commit is contained in:
Justin Oros
2026-02-09 12:28:19 -07:00
parent 7ef9e0c648
commit 41ecc4cb4c
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -35,7 +35,7 @@
"VIX_THRESHOLD": 30, "VIX_THRESHOLD": 30,
"USE_VIX_FILTER": false, "USE_VIX_FILTER": false,
"USE_FIBONACCI": false, "USE_FIBONACCI": false,
"MAX_TRADES_PER_DAY": 3, "MAX_TRADES_PER_DAY": 100,
"SKIP_MONDAYS_FRIDAYS": false, "SKIP_MONDAYS_FRIDAYS": false,
"USE_200_SMA_FILTER": false, "USE_200_SMA_FILTER": false,
"REQUIRE_MACD_CONFIRMATION": false, "REQUIRE_MACD_CONFIRMATION": false,
@@ -60,4 +60,4 @@
"OR_FVG_RISK_REWARD_RATIO": 2.0, "OR_FVG_RISK_REWARD_RATIO": 2.0,
"OR_FVG_MAX_ENTRY_TIME": "10:30", "OR_FVG_MAX_ENTRY_TIME": "10:30",
"OR_FVG_REQUIRE_VOLUME_CONFIRM": true "OR_FVG_REQUIRE_VOLUME_CONFIRM": true
} }
+1 -1
View File
@@ -468,7 +468,7 @@ def log_trade(entry_time, exit_time, symbol, side, entry_price, exit_price, shar
existing = pd.read_csv(TRADES_PATH) existing = pd.read_csv(TRADES_PATH)
df = pd.concat([existing, df], ignore_index=True) df = pd.concat([existing, df], ignore_index=True)
cutoff_date = datetime.now(EASTERN) - timedelta(days=90) cutoff_date = datetime.now(EASTERN) - timedelta(days=90)
df['entry_time'] = pd.to_datetime(df['entry_time']) df['entry_time'] = pd.to_datetime(df['entry_time'], format='ISO8601')
df = df[df['entry_time'] > cutoff_date] df = df[df['entry_time'] > cutoff_date]
df.to_csv(TRADES_PATH, index=False) df.to_csv(TRADES_PATH, index=False)