From 7fc23ad92984a284798367945a0f6e6af669082f Mon Sep 17 00:00:00 2001 From: Sean Date: Wed, 1 Apr 2026 21:19:07 -0400 Subject: [PATCH] Daily + Incorporate check in UPDATEDAILY2 to ensure pricing availabilty for current trade date for open positions. Incorporate an extra sweep to cover open position pricing and send an email if any open positions are missing pricing for current trade date. --- MarketData/MarketData/Models/CMT20200817.TXT | 11 ++- MarketData/MarketData/Models/MGSH20250331.TXT | 21 +++--- MarketData/MarketData/Services/MainService.cs | 72 ++++++++++++++++++- .../Helper/PricingMarketDataHelper.cs | 52 +++++++++++++- 4 files changed, 135 insertions(+), 21 deletions(-) diff --git a/MarketData/MarketData/Models/CMT20200817.TXT b/MarketData/MarketData/Models/CMT20200817.TXT index 20f4436..e5206f1 100755 --- a/MarketData/MarketData/Models/CMT20200817.TXT +++ b/MarketData/MarketData/Models/CMT20200817.TXT @@ -1,11 +1,11 @@ CMTSESSIONv1.00 -LastUpdated=3/31/2026 8:09:06 PM -TradeDate=3/31/2026 +LastUpdated=4/1/2026 9:14:43 PM +TradeDate=4/1/2026 StartDate=1/1/0001 -AnalysisDate=3/31/2026 +AnalysisDate=4/1/2026 CashBalance=9449.67 NonTradeableCash=6456.42 -SuspendTrading=False|UsePriceSlopeIndicator=True|UsePriceSlopeIndicatorDays=252|AnalysisDate=3/31/2026|BetaMonths=6|TradeDate=3/31/2026|MarketCapLowerLimit=500000000|SidewaysDetection=False|SidewaysAfterDays=30|PriceTrendDays=20|CheckOutliersInReturnStream=True|DailyReturnLimit=0.25|MaxDailyPositions=3|MaxOpenPositions=3|NoTradeSymbols=CODYY,MARUY,CSTM,CS,NATI,QADA,CRTO,GTBIF,CLCT,PRSC,CMD,STAY,GBTC,YOKU,PNY,RFMD,ASAZY,USMO,VNR,STB,XIV,SYNT,DFP|OnlyTradeSymbols=|MinRSI=70|InitialCash=10000|TotalRiskPercentDecimal=0.05|PositionRiskPercentDecimal=0.12|EquityOnly=False|MinPercentReturnProximityTo52WeekHigh=30|MinPercentReturnOver52WeekLow=80|ProfitMarginCheck=True|EPSCheck=True|MinDaysBetweenReholding=30|LiquidityCheck=True|MinVolume=1000|DMA200Horizon=15|MinDaysBetweenStopAdjustments=30|MinDaysBetweenInitialStopAdjustment=5|MaxPricingExceptions=3|MACDSetup=(12,26,9)|MACDSignalDays=5|MACDRejectStrongSells=True|MACDRejectWeakSells=True|UseMarketIndicator=True|Benchmark=SPY|BenchmarkMovingAverageDays=200|BenchmarkMovingAverageHorizon=5|UseMarketIndicatorVolatility=True|UseMarketIndicatorVolatilityHorizon=60|UseMarketIndicatorVolatilityBenchmark=^VIX|UseStopLimitScaling=True|StopLimitScalingType=AverageTrueRange|StopLimitScalingVolatilityDays=30|SellOnDMABreak=True|DMABreakValues=200|DMABreakForceBreak=False|EntryType=OverExtended,MVP,PriceTrend,VolumeTrend|EntryHorizon=30|CandidateExpiryDays=180|VolumeTrendDays=10|ChannelBreakoutHorizon=40|UseOverExtendedIndicatorDays=45|UseOverExtendedIndicatorViolationThreshhold=1|UseOverExtendedIndicatorMarginPercent=1|MaxBeta=10|UseMaxBeta=False|UseProfitMaximization=True|UseProfitMaximizationExpression=R_THRESSHOLD=4;MAX_ATR=3;MULTIPLIER=MAX_ATR;IF(RMultiple>=R_THRESSHOLD){MULTIPLIER=1.2;}|UseTradeOnlySectors=False|UseTradeOnlySectorsSectors=Healthcare,Technology,Basic Materials,Consumer Defensive,Industrials|EvaluateStopOnUpTrend=False +SuspendTrading=False|UsePriceSlopeIndicator=True|UsePriceSlopeIndicatorDays=252|AnalysisDate=4/1/2026|BetaMonths=6|TradeDate=4/1/2026|MarketCapLowerLimit=500000000|SidewaysDetection=False|SidewaysAfterDays=30|PriceTrendDays=20|CheckOutliersInReturnStream=True|DailyReturnLimit=0.25|MaxDailyPositions=3|MaxOpenPositions=3|NoTradeSymbols=CODYY,MARUY,CSTM,CS,NATI,QADA,CRTO,GTBIF,CLCT,PRSC,CMD,STAY,GBTC,YOKU,PNY,RFMD,ASAZY,USMO,VNR,STB,XIV,SYNT,DFP|OnlyTradeSymbols=|MinRSI=70|InitialCash=10000|TotalRiskPercentDecimal=0.05|PositionRiskPercentDecimal=0.12|EquityOnly=False|MinPercentReturnProximityTo52WeekHigh=30|MinPercentReturnOver52WeekLow=80|ProfitMarginCheck=True|EPSCheck=True|MinDaysBetweenReholding=30|LiquidityCheck=True|MinVolume=1000|DMA200Horizon=15|MinDaysBetweenStopAdjustments=30|MinDaysBetweenInitialStopAdjustment=5|MaxPricingExceptions=3|MACDSetup=(12,26,9)|MACDSignalDays=5|MACDRejectStrongSells=True|MACDRejectWeakSells=True|UseMarketIndicator=True|Benchmark=SPY|BenchmarkMovingAverageDays=200|BenchmarkMovingAverageHorizon=5|UseMarketIndicatorVolatility=True|UseMarketIndicatorVolatilityHorizon=60|UseMarketIndicatorVolatilityBenchmark=^VIX|UseStopLimitScaling=True|StopLimitScalingType=AverageTrueRange|StopLimitScalingVolatilityDays=30|SellOnDMABreak=True|DMABreakValues=200|DMABreakForceBreak=False|EntryType=OverExtended,MVP,PriceTrend,VolumeTrend|EntryHorizon=30|CandidateExpiryDays=180|VolumeTrendDays=10|ChannelBreakoutHorizon=40|UseOverExtendedIndicatorDays=45|UseOverExtendedIndicatorViolationThreshhold=1|UseOverExtendedIndicatorMarginPercent=1|MaxBeta=10|UseMaxBeta=False|UseProfitMaximization=True|UseProfitMaximizationExpression=R_THRESSHOLD=4;MAX_ATR=3;MULTIPLIER=MAX_ATR;IF(RMultiple>=R_THRESSHOLD){MULTIPLIER=1.2;}|UseTradeOnlySectors=False|UseTradeOnlySectorsSectors=Healthcare,Technology,Basic Materials,Consumer Defensive,Industrials|EvaluateStopOnUpTrend=False PricingExceptions=0 TotalActivePositions=0 TotalPositions=135 @@ -144,8 +144,7 @@ Symbol=NFLX|PurchaseDate=10/21/2025 12:00:00 AM|SellDate=11/20/2025 12:00:00 Symbol=CX|PurchaseDate=10/20/2025 12:00:00 AM|SellDate=2/5/2026 12:00:00 AM|Shares=144|PurchasePrice=9.54|CurrentPrice=11.74|Exposure=1373.7599999999998|MarketValue=1690.56|GainLoss=316.8000000000002|GainLossPcnt=0.23060796645702322|PositionRiskDecimal=0.12|R=1.1472|C=166.14399999999998|P=144.82566248256623|InitialStopLimit=8.4|TrailingStopLimit=12.033928567171097|TotalRiskExposure=165.1968|RMultiple=1.92R|Volatility=0.16408906877040863|Volume=0|LastStopAdjustment=1/28/2026 12:00:00 AM|Comment=Manual close. Symbol=FTI|PurchaseDate=11/20/2025 12:00:00 AM|SellDate=3/6/2026 12:00:00 AM|Shares=41|PurchasePrice=43.23|CurrentPrice=62.83|Exposure=1772.4299999999998|MarketValue=2576.0299999999997|GainLoss=803.5999999999999|GainLossPcnt=0.4533888503354152|PositionRiskDecimal=0.12|R=5.2188|C=218.45950000000005|P=41.86010193914311|InitialStopLimit=38.04|TrailingStopLimit=62.83571408271789|TotalRiskExposure=213.9708|RMultiple=3.76R|Volatility=0.825829267501831|Volume=0|LastStopAdjustment=2/25/2026 12:00:00 AM|Comment=Manual close. Symbol=HWM|PurchaseDate=11/17/2025 12:00:00 AM|SellDate=3/13/2026 12:00:00 AM|Shares=11|PurchasePrice=200.81|CurrentPrice=235.12|Exposure=2208.91|MarketValue=2586.32|GainLoss=377.4100000000003|GainLossPcnt=0.1708580249987552|PositionRiskDecimal=0.12|R=24.0336|C=276.15000000000003|P=11.490163770720992|InitialStopLimit=176.71|TrailingStopLimit=235.233001537323|TotalRiskExposure=264.3696|RMultiple=1.43R|Volatility=3.682325839996338|Volume=0|LastStopAdjustment=2/25/2026 12:00:00 AM|Comment=Manual close. -TotalCandidates=115 -Symbol=FINMY|AnalysisDate=10/2/2025 12:00:00 AM|EPSSlope=0.034999996423721313|ProfitMarginSlope=2.260866165161133|PriceSlope=0.0044867993617732855|Volatility=1.0326875448226929|Volume=0|Violation=False|Slope=0.0044867993617732855|Score=2.6625531836683844|AnnualizedReturn=3.0977419385881366|SharpeRatio=0.3357187697383774|RSquared=0.8595141998438711|BetaMonths=6|Beta=0.8249354197843893 +TotalCandidates=114 Symbol=SANM|AnalysisDate=10/6/2025 12:00:00 AM|EPSSlope=0.17499995231628418|ProfitMarginSlope=0.24951171875|PriceSlope=0.0020823921870819274|Volatility=6.522579669952393|Volume=0|Violation=False|Slope=0.0020823921870819274|Score=1.2404476041886014|AnnualizedReturn=1.6900579717285966|SharpeRatio=0.13315785713170303|RSquared=0.7339674880618845|BetaMonths=6|Beta=1.1208093254003801 Symbol=FN|AnalysisDate=11/4/2025 12:00:00 AM|EPSSlope=0.09999990463256836|ProfitMarginSlope=0.06801414489746094|PriceSlope=0.002548681464617965|Volatility=18.239673614501953|Volume=0|Violation=False|Slope=0.002548681464617965|Score=1.1239501014519349|AnnualizedReturn=1.900786464256634|SharpeRatio=0.15670695179226582|RSquared=0.5913079257387773|BetaMonths=6|Beta=1.0711460119912435 Symbol=LRCX|AnalysisDate=10/6/2025 12:00:00 AM|EPSSlope=0.2849999666213989|ProfitMarginSlope=1.3532524108886719|PriceSlope=0.0018171246616002163|Volatility=9.071016311645508|Volume=0|Violation=False|Slope=0.0018171246616002163|Score=0.8978742858003759|AnnualizedReturn=1.580775287091166|SharpeRatio=-0.161869015355145|RSquared=0.5679961555146668|BetaMonths=6|Beta=2.1503821821201172 diff --git a/MarketData/MarketData/Models/MGSH20250331.TXT b/MarketData/MarketData/Models/MGSH20250331.TXT index eb477c3..430635b 100644 --- a/MarketData/MarketData/Models/MGSH20250331.TXT +++ b/MarketData/MarketData/Models/MGSH20250331.TXT @@ -1,20 +1,20 @@ MGSHSESSIONv2.00 -LastUpdated=4/1/2026 10:10:56 AM -TradeDate=4/1/2026 +LastUpdated=4/1/2026 9:13:46 PM +TradeDate=4/2/2026 StartDate=3/31/2025 -AnalysisDate=3/31/2026 +AnalysisDate=4/1/2026 Cycle=13 CashBalance=1883.4900000000005 NonTradeableCash=0 HedgeCashBalance=3000 Verbose=True|KeepSlotPositions=True|BenchmarkMode=False|BenchmarkModeSymbol=SPY|HoldingPeriod=3|MaxPositions=3|NoTradeSymbols=OSB,IBDRY,GBTC,YOKU,PNY,RFMD,ASAZY|NoTradeFinancialSymbols=U.S. Private Equity,U.S. Financials,U.S. Financial Services,U.S. Banking and Investment Services,Trading-Miscellaneous,Trading--Miscellaneous,Trading--Leveraged Equity,Trading--Leveraged Debt,Trading--Leveraged Commodities,Trading--Inverse Equity,Trading--Inverse Commodities,Tactical Allocation,Specialty Finance,Japan Financials,Savings & Cooperative Banks,Option Writing,Insurance Brokers,Insurance - Specialty,Insurance - Reinsurance,Insurance - Property & Casualty,Insurance - Life,Insurance - Diversified,Global Private Equity,Global Financials,Financial Services,Financial Exchanges,Financial,China Financials,Banks - Regional - US,Banks - Regional - Latin America,Banks - Global,Asset Management,Credit Services|Benchmark=SPY|MarketCapLowerLimit=1000000000|UsePEScreen=False|UseEBITDAScreen=True|UseRevenuePerShareScreen=True|UseLowSlopeBetaCheck=True|LowSlopeBetaDays=15|LowSlopeBetaThreshhold=1|UseMACD=True|MACDSetup=(12,26,9)|MACDSignalDays=12|MACDRejectStrongSellSignals=False|MACDRejectWeakSellSignals=True|UseStochastics=True|StochasticsSignalDays=3|StochasticsRejectStrongSells=True|StochasticsRejectWeakSells=True|UseFallbackCandidate=True|FallbackCandidate=SHV|FallbackCandidateBestOf=SHV,NEAR,BIL,GSY,AGG,ACWX,GSY,SCHF,IXUS,DBEF,IEFA,TLT|UseMaxPEScreen=True|MaxPE=40|StrictMaxPE=False|QualityIndicatorType=IDINDICATOR|IncludeTradeMasterForSymbolsHeld=True|UseStopLimits=True|StopLimitRiskPercentDecimal=0.2|StopLimitScalingVolatilityDays=30|MinDaysBetweenInitialStopAdjustment=30|MinDaysBetweenStopAdjustments=30|StopLimitPriceTrendDays=20|StopLimitATRMultiplier=3|UseHedging=True|HedgeBenchmarkSymbol=SPY|HedgeShortSymbol=SH|HedgeRiskPercentDecimal=0.12|HedgeMinDaysBetweenStopAdjustments=1|HedgeInitialCash=3000|HedgeCloseAboveSMANDays=10|HedgeBandBreakCheckDays=3|HedgeATRMultiplier=1|MaxPricingExceptions=3|UseBetaGenerator=True|UseBetaGeneratorMonths=24 TotalActivePositions=6 -Slot=1|Symbol=MDT|PurchaseDate=1/30/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=14|PurchasePrice=102.85|CurrentPrice=86.65|Volume=6046285|Return1D=0|CumReturn252=0|IDIndicator=-10.35856573705179|Score=0.518428403011861|Velocity=0.8652931854199681|PE=26.67|Beta=0.37428296833055014|InitialStopLimit=82.28|TrailingStopLimit=82.28|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=20.592|Comment=Price changed on 2/2/2026 from $102.96 to $102.85 -Slot=2|Symbol=NFG|PurchaseDate=11/28/2025 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=12|PurchasePrice=82.45|CurrentPrice=93.96|Volume=236813|Return1D=0|CumReturn252=0|IDIndicator=-9.561752988047807|Score=1.4787437525170677|Velocity=0.6585998271391531|PE=31.63|Beta=0.04430253825297578|InitialStopLimit=65.96000000000001|TrailingStopLimit=85.48514305591583|LastStopAdjustment=3/2/2026 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=16.490000000000002|Comment= -Slot=2|Symbol=NWN|PurchaseDate=2/27/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=18|PurchasePrice=53|CurrentPrice=53.22|Volume=468654|Return1D=0|CumReturn252=0|IDIndicator=-17.13147410358566|Score=0.6615960312468072|Velocity=1.0000000000000002|PE=20.04|Beta=-0.020855636842840336|InitialStopLimit=42.4|TrailingStopLimit=42.4|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=10.608|Comment=Price changed on 3/2/2026 from $53.04 to $53.00 -Slot=2|Symbol=ALLE|PurchaseDate=2/27/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=6|PurchasePrice=160.87|CurrentPrice=145.29|Volume=483322|Return1D=0|CumReturn252=0|IDIndicator=-7.5697211155378525|Score=1.0921592452357611|Velocity=0.6599496221662469|PE=24.3|Beta=0.32621889255450337|InitialStopLimit=128.7|TrailingStopLimit=128.7|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=32.230000000000004|Comment=Price changed on 3/2/2026 from $161.15 to $160.87 -Slot=0|Symbol=NYT|PurchaseDate=3/31/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=21|PurchasePrice=83.55|CurrentPrice=83.73|Volume=1771479|Return1D=0|CumReturn252=0|IDIndicator=-13.545816733067738|Score=1.1825972924224726|Velocity=0.9759277833500504|PE=37.88|Beta=0.26107650690592754|InitialStopLimit=66.84|TrailingStopLimit=66.84|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=16.746000000000002|Comment=Price changed on 4/1/2026 from $83.73 to $83.55 -Slot=0|Symbol=PTGX|PurchaseDate=3/31/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=16|PurchasePrice=105.51|CurrentPrice=105.4|Volume=781528|Return1D=0|CumReturn252=0|IDIndicator=-6.374501992031874|Score=2.1434347022647025|Velocity=0.9681908548707753|PE=128.65|Beta=0.6968595191825934|InitialStopLimit=84.41|TrailingStopLimit=84.41|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=21.080000000000002|Comment=Price changed on 4/1/2026 from $105.40 to $105.51 +Slot=1|Symbol=MDT|PurchaseDate=1/30/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=14|PurchasePrice=102.85|CurrentPrice=86.06|Volume=6046285|Return1D=0|CumReturn252=0|IDIndicator=-10.35856573705179|Score=0.518428403011861|Velocity=0.8652931854199681|PE=26.67|Beta=0.37428296833055014|InitialStopLimit=82.28|TrailingStopLimit=82.28|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=20.592|Comment=Price changed on 2/2/2026 from $102.96 to $102.85 +Slot=2|Symbol=NFG|PurchaseDate=11/28/2025 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=12|PurchasePrice=82.45|CurrentPrice=92.87|Volume=236813|Return1D=0|CumReturn252=0|IDIndicator=-9.561752988047807|Score=1.4787437525170677|Velocity=0.6585998271391531|PE=31.63|Beta=0.04430253825297578|InitialStopLimit=65.96000000000001|TrailingStopLimit=86.54649946212768|LastStopAdjustment=4/1/2026 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=16.490000000000002|Comment= +Slot=2|Symbol=NWN|PurchaseDate=2/27/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=18|PurchasePrice=53|CurrentPrice=53.7|Volume=468654|Return1D=0|CumReturn252=0|IDIndicator=-17.13147410358566|Score=0.6615960312468072|Velocity=1.0000000000000002|PE=20.04|Beta=-0.020855636842840336|InitialStopLimit=42.4|TrailingStopLimit=42.4|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=10.608|Comment=Price changed on 3/2/2026 from $53.04 to $53.00 +Slot=2|Symbol=ALLE|PurchaseDate=2/27/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=6|PurchasePrice=160.87|CurrentPrice=144.16|Volume=483322|Return1D=0|CumReturn252=0|IDIndicator=-7.5697211155378525|Score=1.0921592452357611|Velocity=0.6599496221662469|PE=24.3|Beta=0.32621889255450337|InitialStopLimit=128.7|TrailingStopLimit=128.7|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=32.230000000000004|Comment=Price changed on 3/2/2026 from $161.15 to $160.87 +Slot=0|Symbol=NYT|PurchaseDate=3/31/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=21|PurchasePrice=83.55|CurrentPrice=85.39|Volume=1771479|Return1D=0|CumReturn252=0|IDIndicator=-13.545816733067738|Score=1.1825972924224726|Velocity=0.9759277833500504|PE=37.88|Beta=0.26107650690592754|InitialStopLimit=66.84|TrailingStopLimit=66.84|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=16.746000000000002|Comment=Price changed on 4/1/2026 from $83.73 to $83.55 +Slot=0|Symbol=PTGX|PurchaseDate=3/31/2026 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=16|PurchasePrice=105.51|CurrentPrice=103.67|Volume=781528|Return1D=0|CumReturn252=0|IDIndicator=-6.374501992031874|Score=2.1434347022647025|Velocity=0.9681908548707753|PE=128.65|Beta=0.6968595191825934|InitialStopLimit=84.41|TrailingStopLimit=84.41|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=21.080000000000002|Comment=Price changed on 4/1/2026 from $105.40 to $105.51 TotalPositions=22 Symbol=MO|PurchaseDate=3/31/2025 12:00:00 AM|SellDate=5/14/2025 12:00:00 AM|Shares=18|PurchasePrice=59.91|CurrentPrice=56.15|Volume=17335180|Return1D=0|CumReturn252=0|IDIndicator=-15.9362549800797|Score=1.14749269300042|Velocity=0.967136150234742|PE=9|Beta=0.572465642401382|InitialStopLimit=47.93|TrailingStopLimit=56.15650033473968|LastStopAdjustment=5/7/2025 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=12.004|Comment=Closed due to trailing stop. Symbol=EXC|PurchaseDate=3/31/2025 12:00:00 AM|SellDate=5/14/2025 12:00:00 AM|Shares=24|PurchasePrice=45.76|CurrentPrice=42.6|Volume=14993121|Return1D=0|CumReturn252=0|IDIndicator=-8.76494023904382|Score=0.405636492837393|Velocity=1|PE=18.02|Beta=0.248374476251328|InitialStopLimit=36.61|TrailingStopLimit=42.7107857322693|LastStopAdjustment=4/30/2025 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=9.216|Comment=Closed due to trailing stop. @@ -38,7 +38,7 @@ Symbol=USFD|PurchaseDate=9/30/2025 12:00:00 AM|SellDate=3/6/2026 12:00:00 AM Symbol=ALHC|PurchaseDate=1/30/2026 12:00:00 AM|SellDate=3/9/2026 12:00:00 AM|Shares=64|PurchasePrice=22.45|CurrentPrice=17.96|Volume=2524769|Return1D=0|CumReturn252=0|IDIndicator=-8.366533864541836|Score=0.34132758522688106|Velocity=0.908249807247494|PE=0|Beta=-0.01980437364536009|InitialStopLimit=17.96|TrailingStopLimit=17.96|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=4.506|Comment=Manual close. Symbol=CAH|PurchaseDate=9/30/2025 12:00:00 AM|SellDate=3/18/2026 12:00:00 AM|Shares=5|PurchasePrice=155.81|CurrentPrice=210.5|Volume=2414935|Return1D=0|CumReturn252=0|IDIndicator=-17.928286852589643|Score=1.457053776101358|Velocity=0.7794289530806477|PE=23.64|Beta=0.6282261227850008|InitialStopLimit=124.65|TrailingStopLimit=210.48593053817748|LastStopAdjustment=3/2/2026 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=31.392000000000003|Comment=Manual close. Symbol=XEL|PurchaseDate=10/31/2025 12:00:00 AM|SellDate=3/20/2026 12:00:00 AM|Shares=5|PurchasePrice=81.17|CurrentPrice=77.53|Volume=6202750|Return1D=0|CumReturn252=0|IDIndicator=-11.553784860557762|Score=0.6026973776815487|Velocity=0.9448035803083044|PE=22.43|Beta=-0.19231796112849286|InitialStopLimit=64.936|TrailingStopLimit=77.54414251327515|LastStopAdjustment=2/23/2026 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=16.234|Comment=Manual close. -TotalStopLimits=40 +TotalStopLimits=41 Symbol=EXC|AnalysisDate=4/30/2025 12:00:00 AM|PreviousStop=36.61|NewStop=42.7107857322693|CurrentPriceLow=42.6|CurrentPriceClose=46.9|PriceTrendIndicatorSlope=0.0870828032493591|StopLimitId=EXC20250331120000AM Symbol=SXT|AnalysisDate=4/30/2025 12:00:00 AM|PreviousStop=59.18|NewStop=85.4177850723267|CurrentPriceLow=92.4|CurrentPriceClose=93.95|PriceTrendIndicatorSlope=0.931879639625549|StopLimitId=SXT20250331120000AM Symbol=MO|AnalysisDate=5/7/2025 12:00:00 AM|PreviousStop=47.93|NewStop=56.15650033473968|CurrentPriceLow=56.16|CurrentPriceClose=60.91|PriceTrendIndicatorSlope=0.21730078756809235|StopLimitId=MO20250331120000AM @@ -79,5 +79,6 @@ Symbol=USFD|AnalysisDate=2/17/2026 12:00:00 AM|PreviousStop=77.93871447563171| Symbol=XEL|AnalysisDate=2/23/2026 12:00:00 AM|PreviousStop=64.936|NewStop=77.54414251327515|CurrentPriceLow=81.78|CurrentPriceClose=83.35|PriceTrendIndicatorSlope=0.34472182393074036|StopLimitId=XEL20251031120000AM Symbol=CAH|AnalysisDate=3/2/2026 12:00:00 AM|PreviousStop=198.93721462249755|NewStop=210.48593053817748|CurrentPriceLow=228.1|CurrentPriceClose=229.88|PriceTrendIndicatorSlope=0.6618042588233948|StopLimitId=CAH20250930120000AM Symbol=NFG|AnalysisDate=3/2/2026 12:00:00 AM|PreviousStop=77.9947861814499|NewStop=85.48514305591583|CurrentPriceLow=90.74|CurrentPriceClose=92.66|PriceTrendIndicatorSlope=0.33545854687690735|StopLimitId=NFG20251128120000AM +Symbol=NFG|AnalysisDate=4/1/2026 12:00:00 AM|PreviousStop=85.48514305591583|NewStop=86.54649946212768|CurrentPriceLow=92.47|CurrentPriceClose=92.87|PriceTrendIndicatorSlope=0.09361664950847626|StopLimitId=NFG20251128120000AM TotalHedgePositions=0 TotalPricingExceptions=0 diff --git a/MarketData/MarketData/Services/MainService.cs b/MarketData/MarketData/Services/MainService.cs index 6c97d62..87d7cf5 100755 --- a/MarketData/MarketData/Services/MainService.cs +++ b/MarketData/MarketData/Services/MainService.cs @@ -726,9 +726,11 @@ namespace MarketData.Services // Here is the start of the real workers ThreadPool.QueueUserWorkItem(delegate { - UpdatePricesYahooSweep(startDate); // This was a sweep but now it is the main price feed since the BigCharts feed issue. Robinhood runs to fill the gaps anbd then BarChart - UpdatePricesRobinhoodSweep(startDate); // This the new Robinhood price feed. It will only pull current day prices for items that have not been pulled from above feed. - UpdatePricesBarChartSweep(startDate); // barchart. This sweep will pull any prices we failed to retrieve from Yahoo and Robinhood. + UpdatePricesYahooSweep(startDate); // This was a sweep but now it is the main price feed since the BigCharts feed issue. Robinhood runs to fill the gaps anbd then BarChart + UpdatePricesRobinhoodSweep(startDate); // This the new Robinhood price feed. It will only pull current day prices for items that have not been pulled from above feed. + UpdatePricesBarChartSweep(startDate); // barchart. This sweep will pull any prices we failed to retrieve from Yahoo and Robinhood. + UpdatePricesSweepOpenPositions(startDate); // This is a final pass sweep to check if any open positions remain price-less + EnsurePricingForOpenPositions(startDate, smsUserName, smsRecipients, smsSMTPAddress, smsPassword); // This will send an email if we are missing prices for tghe current trade date for any open positions resetEvents[STAGE_1].Set(); SMSClient.SendSMSEmail("UPDATEDAILY2 STAGE_1 UPDATEPRICES YAHOO/ROBINHOOD/BARCHART done.", smsUserName, smsRecipients, smsSMTPAddress, smsUserName, smsPassword); MDTrace.WriteLine(LogLevel.DEBUG,$"STAGE_1 complete."); @@ -835,6 +837,70 @@ namespace MarketData.Services pricingMarketDataHelper.UpdatePricesBarChartSweep(startDate); } + /// + /// This method will be called by UPDATEDAILY2 as a final step to ensure that we have pricing for open positions on the current date. + /// If we do not then it will attempt to get prices from BarChart. + /// + /// + public static void UpdatePricesSweepOpenPositions(DateTime startDate) + { + try + { + List fetchSymbolList = new List(); + List openSymbols = PortfolioDA.GetOpenSymbols(); + Dictionary latestDates = PricingDA.GetLatestDates(openSymbols); + foreach(String openSymbol in openSymbols) + { + if(!latestDates.ContainsKey(openSymbol) || !latestDates[openSymbol].Date.Equals(startDate.Date)) + { + fetchSymbolList.Add(openSymbol); + } + } + if(0==fetchSymbolList.Count)return; + PricingMarketDataHelper pricingMarketDataHelper = new PricingMarketDataHelper(); + pricingMarketDataHelper.UpdatePricesBarChartSweepOpenPositions(fetchSymbolList, startDate); + } + catch(Exception exception) + { + MDTrace.WriteLine(LogLevel.DEBUG,$"[UpdatePricesSweepOpenPositions] Exception: {exception.ToString()}"); + } + } + + /// + /// This method checks if we have current pricing for open positions and sends an email if we do not. + /// + /// Usuallly the current trade date since this will be called from UPDATEDAILY2 + /// + /// + /// + /// + public static void EnsurePricingForOpenPositions(DateTime startDate,String smsUserName, String[] smsRecipients, String smsSMTPAddress, String smsPassword) + { + try + { + List fetchSymbolList = new List(); + List openSymbols = PortfolioDA.GetOpenSymbols(); + Dictionary latestDates = PricingDA.GetLatestDates(openSymbols); + foreach(String openSymbol in openSymbols) + { + if(!latestDates.ContainsKey(openSymbol) || !latestDates[openSymbol].Date.Equals(startDate.Date)) + { + fetchSymbolList.Add(openSymbol); + } + } + if(0==fetchSymbolList.Count) + { + return; + } + String missingSymbols = String.Join(",", fetchSymbolList); + SMSClient.SendSMSEmail($"UPDATEDAILY2 STAGE_1 UPDATEPRICES Missing prices for {missingSymbols}.", smsUserName, smsRecipients, smsSMTPAddress, smsUserName, smsPassword); + } + catch(Exception exception) + { + MDTrace.WriteLine(LogLevel.DEBUG,$"[EnsurePricingForOpenPositions] Exception: {exception.ToString()}"); + } + } + public static void DeletePriceWatchList(String watchListName, String strDate) { try diff --git a/MarketData/MarketDataLib/Helper/PricingMarketDataHelper.cs b/MarketData/MarketDataLib/Helper/PricingMarketDataHelper.cs index 9528373..6e0eac3 100755 --- a/MarketData/MarketDataLib/Helper/PricingMarketDataHelper.cs +++ b/MarketData/MarketDataLib/Helper/PricingMarketDataHelper.cs @@ -249,8 +249,6 @@ namespace MarketData.Helper // ******************************************************************************************************************************************** // ********************************************************************** B A R C H A R T *************************************************** // ******************************************************************************************************************************************** - - /// /// UpdatePricesBarChartSweep - This feed is intended to supplement BigCharts nightly price feed in UPDATEDAILY2 by filling any gaps that may occur /// in that feed. This feed will only pull a price for which we had a price yesterday (findprevbusinessday) and for which do not have @@ -313,6 +311,56 @@ namespace MarketData.Helper MDTrace.WriteLine(LogLevel.DEBUG, String.Format("[UpdatePricesBarChartSweep]End, total took {0}(ms)", profiler.End())); } } + + /// + /// UpdatePricesBarChart - This feed is used by UPDATEDAILY2 as a final sweep for open positions. + /// If we already have the price for the given date then it will not be fetched. + /// + /// The symbols to fetch. This should be a list of symbols for which we need pricing for startDate + /// The date we are requesting + /// + public bool UpdatePricesBarChartSweepOpenPositions(List symbolsToFetch, DateTime? startDate = null) + { + Profiler profiler = new Profiler(); + try + { + MDTrace.WriteLine(LogLevel.DEBUG, "[UpdatePricesBarChartSweepOpenPositions]Enter"); + DateGenerator dateGenerator = new DateGenerator(); + if(null == symbols || 0==symbols.Count) + { + MDTrace.WriteLine(LogLevel.DEBUG, $"[UpdatePricesBarChartSweepOpenPositions] No symbols provided, nothing to do"); + return false; + } + if (null == startDate) startDate = DateTime.Now; + symbols = symbolsToFetch; + MDTrace.WriteLine(LogLevel.DEBUG, $"[UpdatePricesBarChartSweepOpenPositions] Preparing to supplement {symbolsToFetch.Count} prices for pricing date {startDate.Value.ToShortDateString()} ."); + currentIndex = 0; + while (true) + { + List queueSymbols = GetQueueSymbols(); + if (null == queueSymbols || 0 == queueSymbols.Count) break; + ManualResetEvent[] resetEvents = new ManualResetEvent[queueSymbols.Count]; + for (int eventIndex = 0; eventIndex < resetEvents.Length; eventIndex++) + { + resetEvents[eventIndex] = new ManualResetEvent(false); + } + for (int index = 0; index < queueSymbols.Count; index++) + { + PricingThreadHelper pricingThreadHelper = new PricingThreadHelper(queueSymbols[index], startDate.Value, resetEvents[index]); + ThreadPool.QueueUserWorkItem(ThreadPoolCallbackUpdatePricesBarChartSweep, pricingThreadHelper); + try { Thread.Sleep(WaitBetweenRequests); } catch (Exception) {; } + } + MDTrace.WriteLine(LogLevel.DEBUG, "UpdatePricesBarChartSweepOpenPositions, waiting for queued items to complete."); + WaitHandle.WaitAll(resetEvents); + } + return true; + } + finally + { + MDTrace.WriteLine(LogLevel.DEBUG, String.Format("[UpdatePricesBarChartSweepOpenPositions]End, total took {0}(ms)", profiler.End())); + } + } + // ******************************************************************************************************************************************** // ********************************************************************** E N D B A R C H A R T *************************************************** // ********************************************************************************************************************************************