From e16034585e2b1963707262773041c7de59f4990a Mon Sep 17 00:00:00 2001 From: Sean Date: Sat, 31 May 2025 12:09:43 -0400 Subject: [PATCH] Fix the monthly runs when running the month end process on the weekend... was picking the TradeDate as a weekend date. Now if we run the model over the weekend the TradeDate and AnalysisDate will the the prior business day. --- MarketDataLib/Generator/CMMomentum/CMBacktest.cs | 3 ++- MarketDataLib/Generator/Momentum/Backtest.cs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/MarketDataLib/Generator/CMMomentum/CMBacktest.cs b/MarketDataLib/Generator/CMMomentum/CMBacktest.cs index efb874d..a1d0413 100644 --- a/MarketDataLib/Generator/CMMomentum/CMBacktest.cs +++ b/MarketDataLib/Generator/CMMomentum/CMBacktest.cs @@ -334,8 +334,9 @@ namespace MarketData.Generator.CMMomentum CMSessionParams sessionParams = null; Cycle = 0; + if (Utility.IsEpoch(AnalysisDate)) AnalysisDate = dateGenerator.GetPrevBusinessDay(Today()); + else AnalysisDate = dateGenerator.GetPrevBusinessDay(AnalysisDate); if (AnalysisDate.Date > Today().Date) return backTestResult; - if (Utility.IsEpoch(AnalysisDate)) AnalysisDate = Today(); TradeDate = dateGenerator.GetCurrentMonthEnd(StartDate); if (TradeDate > AnalysisDate) { diff --git a/MarketDataLib/Generator/Momentum/Backtest.cs b/MarketDataLib/Generator/Momentum/Backtest.cs index 938e1a1..7907d73 100644 --- a/MarketDataLib/Generator/Momentum/Backtest.cs +++ b/MarketDataLib/Generator/Momentum/Backtest.cs @@ -336,7 +336,7 @@ namespace MarketData.Generator.Momentum Cycle=0; if(AnalysisDate.Date>Today().Date)return backTestResult; - if(Utility.IsEpoch(AnalysisDate))AnalysisDate=Today(); + if(Utility.IsEpoch(AnalysisDate))AnalysisDate=dateGenerator.GetPrevBusinessDay(Today()); TradeDate=dateGenerator.GetCurrentMonthEnd(StartDate); if(TradeDate>AnalysisDate) {