Merge remote-tracking branch 'origin/MKDT_0004'
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -6,6 +6,7 @@ MarketData/MarketDataLib/obj/**
|
||||
MarketData/MarketData/obj/**
|
||||
MarketData/MarketDataLib/bin**
|
||||
MarketData/MarketDataLib/obj/**
|
||||
MarketData/MarketData/logs/**
|
||||
MarketData/MarketData/*.log
|
||||
MarketData/MarketData/marketdata.log
|
||||
MarketData/MarketData/logs/marketdata_echo.log
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
CMTSESSIONv1.00
|
||||
LastUpdated=5/2/2025 8:40:03 PM
|
||||
TradeDate=5/2/2025
|
||||
LastUpdated=5/5/2025 7:58:19 PM
|
||||
TradeDate=5/5/2025
|
||||
StartDate=1/1/0001
|
||||
AnalysisDate=5/2/2025
|
||||
AnalysisDate=5/5/2025
|
||||
CashBalance=9375.6
|
||||
NonTradeableCash=6456.42
|
||||
SuspendTrading=False|UsePriceSlopeIndicator=True|UsePriceSlopeIndicatorDays=252|AnalysisDate=5/2/2025|BetaMonths=6|TradeDate=5/2/2025|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=5/5/2025|BetaMonths=6|TradeDate=5/5/2025|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=124
|
||||
@@ -133,7 +133,7 @@ Symbol=AZZ|PurchaseDate=2/7/2025 12:00:00 AM|SellDate=3/4/2025 12:00:00 AM|S
|
||||
Symbol=AWI|PurchaseDate=2/14/2025 12:00:00 AM|SellDate=4/3/2025 12:00:00 AM|Shares=7|PurchasePrice=153.74|CurrentPrice=133.24|Exposure=1076.18|MarketValue=932.6800000000001|GainLoss=-143.5|GainLossPcnt=-0.13334200598412904|PositionRiskDecimal=0.12|R=18.4644|C=145.850071400525|P=7.89898785774382|InitialStopLimit=135.29|TrailingStopLimit=135.29|TotalRiskExposure=129.2508|RMultiple=-1.11R|Volatility=6.83095169067383|Volume=0|LastStopAdjustment=1/1/0001 12:00:00 AM|Comment=Manual close.
|
||||
Symbol=IDCC|PurchaseDate=2/7/2025 12:00:00 AM|SellDate=4/4/2025 12:00:00 AM|Shares=5|PurchasePrice=204.9|CurrentPrice=189.59|Exposure=1024.5|MarketValue=947.95|GainLoss=-76.54999999999995|GainLossPcnt=-0.0747193753050268|PositionRiskDecimal=0.12|R=24.5268|C=132.993071400525|P=5.422357233741254|InitialStopLimit=180.31|TrailingStopLimit=195.563070678711|TotalRiskExposure=122.63400000000001|RMultiple=-0.62R|Volatility=3.26635074615479|Volume=0|LastStopAdjustment=3/17/2025 12:00:00 AM|Comment=Manual close.
|
||||
Symbol=EXEL|PurchaseDate=3/4/2025 12:00:00 AM|SellDate=4/4/2025 12:00:00 AM|Shares=84|PurchasePrice=38.14|CurrentPrice=34.65|Exposure=3203.76|MarketValue=2910.6|GainLoss=-293.1600000000003|GainLossPcnt=-0.09150498164656537|PositionRiskDecimal=0.12|R=4.5948|C=389.4065|P=84.74939061547836|InitialStopLimit=33.56|TrailingStopLimit=34.6096426153183|TotalRiskExposure=385.96320000000003|RMultiple=-0.76R|Volatility=0.690388977527618|Volume=0|LastStopAdjustment=3/10/2025 12:00:00 AM|Comment=Manual close.
|
||||
TotalCandidates=42
|
||||
TotalCandidates=41
|
||||
Symbol=PBI|AnalysisDate=2/18/2025 12:00:00 AM|EPSSlope=0.529999971389771|ProfitMarginSlope=8.23810863494873|PriceSlope=0.00328707853229042|Volatility=0.761549234390259|Volume=0|Violation=False|Slope=0.00328707853229042|Score=1.99265117484619|AnnualizedReturn=2.28952366673464|SharpeRatio=0.235874736612309|RSquared=0.870334386055131|BetaMonths=6|Beta=1.93760551933142
|
||||
Symbol=SPOT|AnalysisDate=2/19/2025 12:00:00 AM|EPSSlope=1.14999985694885|ProfitMarginSlope=4.86549997329712|PriceSlope=0.00311891130814697|Volatility=40.1615791320801|Volume=0|Violation=False|Slope=0.00311891130814697|Score=1.98684751540544|AnnualizedReturn=2.19452506025095|SharpeRatio=0.413240671697551|RSquared=0.905365607981818|BetaMonths=6|Beta=3.11968488809277
|
||||
Symbol=HWM|AnalysisDate=2/18/2025 12:00:00 AM|EPSSlope=0.100000023841858|ProfitMarginSlope=0.146227836608887|PriceSlope=0.00289697492464429|Volatility=2.93906354904175|Volume=0|Violation=False|Slope=0.00289697492464429|Score=1.95446634946965|AnnualizedReturn=2.07515880028122|SharpeRatio=0.257254647152215|RSquared=0.941839414508801|BetaMonths=6|Beta=1.80514220525624
|
||||
@@ -154,7 +154,6 @@ Symbol=CENX|AnalysisDate=11/15/2024 12:00:00 AM|EPSSlope=0.454999923706055|Pro
|
||||
Symbol=DASH|AnalysisDate=2/19/2025 12:00:00 AM|EPSSlope=0.360000014305115|ProfitMarginSlope=1.07436752319336|PriceSlope=0.00199671707748532|Volatility=9.18694686889648|Volume=0|Violation=False|Slope=0.00199671707748532|Score=0.982941652764388|AnnualizedReturn=1.65396048132577|SharpeRatio=0.102027056926275|RSquared=0.594295730679425|BetaMonths=6|Beta=2.14568923530456
|
||||
Symbol=YMM|AnalysisDate=2/10/2025 12:00:00 AM|EPSSlope=0.0349999964237213|ProfitMarginSlope=0.229143142700195|PriceSlope=0.0018029882430729|Volatility=0.436734020709991|Volume=0|Violation=False|Slope=0.0018029882430729|Score=0.958505124860841|AnnualizedReturn=1.57515398736561|SharpeRatio=0.075391013791245|RSquared=0.608515188069902|BetaMonths=6|Beta=2.01977136967525
|
||||
Symbol=FLEX|AnalysisDate=11/22/2024 12:00:00 AM|EPSSlope=0.00999999046325684|ProfitMarginSlope=4.37839651107788|PriceSlope=0.00138026654939466|Volatility=1.70791220664978|Volume=0|Violation=False|Slope=0.00138026654939466|Score=0.943320326401415|AnnualizedReturn=1.41598750410425|SharpeRatio=-0.100475860902919|RSquared=0.666192550193553|BetaMonths=6|Beta=2.27651080171185
|
||||
Symbol=AYI|AnalysisDate=11/5/2024 12:00:00 AM|EPSSlope=0.574999809265137|ProfitMarginSlope=0.438583374023438|PriceSlope=0.00146922865286444|Volatility=4.79285192489624|Volume=0|Violation=False|Slope=0.00146922865286444|Score=0.864879215941605|AnnualizedReturn=1.44809025166895|SharpeRatio=0.132171751849736|RSquared=0.597255050190977|BetaMonths=6|Beta=1.36221064649616
|
||||
Symbol=AA|AnalysisDate=11/6/2024 12:00:00 AM|EPSSlope=0.659999966621399|ProfitMarginSlope=3.1422266960144|PriceSlope=0.00148765049151822|Volatility=1.29168581962585|Volume=0|Violation=False|Slope=0.00148765049151822|Score=0.64048408090798|AnnualizedReturn=1.45482835393824|SharpeRatio=0.0432325466564112|RSquared=0.440247180482964|BetaMonths=6|Beta=3.06107144503885
|
||||
Symbol=GDYN|AnalysisDate=1/2/2025 12:00:00 AM|EPSSlope=0.0249999985098839|ProfitMarginSlope=1.38591957092285|PriceSlope=0.00182115536676012|Volatility=1.21755516529083|Volume=0|Violation=False|Slope=0.00182115536676012|Score=0.634186508550066|AnnualizedReturn=1.58238175588329|SharpeRatio=0.0582727535453944|RSquared=0.400779714624593|BetaMonths=6|Beta=0.688236357556022
|
||||
Symbol=FINMY|AnalysisDate=2/18/2025 12:00:00 AM|EPSSlope=0.00499999523162842|ProfitMarginSlope=2.26086616516113|PriceSlope=0.000927945831124419|Volatility=0.804262280464172|Volume=0|Violation=False|Slope=0.000927945831124419|Score=0.603127428955689|AnnualizedReturn=1.26344529365249|SharpeRatio=0.116679338102526|RSquared=0.477367268678576|BetaMonths=6|Beta=1.26022875036336
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
MGSHSESSIONv2.00
|
||||
LastUpdated=5/2/2025 8:41:21 PM
|
||||
TradeDate=5/5/2025
|
||||
LastUpdated=5/5/2025 7:58:57 PM
|
||||
TradeDate=5/6/2025
|
||||
StartDate=3/31/2025
|
||||
AnalysisDate=5/2/2025
|
||||
AnalysisDate=5/5/2025
|
||||
Cycle=2
|
||||
CashBalance=3485.68
|
||||
NonTradeableCash=0
|
||||
HedgeCashBalance=3000
|
||||
Verbose=True|KeepSlotPositions=True|BenchmarkMode=False|BenchmarkModeSymbol=SPY|HoldingPeriod=3|MaxPositions=3|NoTradeSymbols=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=0|Symbol=MO|PurchaseDate=3/31/2025 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=18|PurchasePrice=59.91|CurrentPrice=59.61|Volume=17335180|Return1D=0|CumReturn252=0|IDIndicator=-15.9362549800797|Score=1.14749269300042|Velocity=0.967136150234742|PE=9|Beta=0.572465642401382|InitialStopLimit=47.93|TrailingStopLimit=47.93|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=12.004|Comment=Price changed on 4/1/2025 from $60.02 to $59.91
|
||||
Slot=0|Symbol=EXC|PurchaseDate=3/31/2025 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=24|PurchasePrice=45.76|CurrentPrice=46.48|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=Price changed on 4/1/2025 from $46.08 to $45.76
|
||||
Slot=0|Symbol=SXT|PurchaseDate=3/31/2025 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=14|PurchasePrice=73.98|CurrentPrice=93.73|Volume=362866|Return1D=0|CumReturn252=0|IDIndicator=-7.17131474103586|Score=0.447832358242973|Velocity=0.447678018575852|PE=24.93|Beta=0.640557790575348|InitialStopLimit=59.18|TrailingStopLimit=85.4177850723267|LastStopAdjustment=4/30/2025 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=14.886|Comment=Price changed on 4/1/2025 from $74.43 to $73.98
|
||||
Slot=1|Symbol=RGLD|PurchaseDate=4/30/2025 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=6|PurchasePrice=179.06|CurrentPrice=176.51|Volume=872755|Return1D=0|CumReturn252=0|IDIndicator=-12.3505976095618|Score=0.879340632979787|Velocity=0.8398891966759|PE=36.94|Beta=0.672718546494456|InitialStopLimit=143.25|TrailingStopLimit=143.25|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=36.542|Comment=Price changed on 5/1/2025 from $182.71 to $179.06
|
||||
Slot=1|Symbol=PSO|PurchaseDate=4/30/2025 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=69|PurchasePrice=15.98|CurrentPrice=16.02|Volume=894303|Return1D=0|CumReturn252=0|IDIndicator=-11.9521912350598|Score=1.15269564166514|Velocity=0.737122557726465|PE=19.2|Beta=0.0342052512015139|InitialStopLimit=12.78|TrailingStopLimit=12.78|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=3.25|Comment=Price changed on 5/1/2025 from $16.25 to $15.98
|
||||
Slot=1|Symbol=TSCDY|PurchaseDate=4/30/2025 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=75|PurchasePrice=15|CurrentPrice=14.98|Volume=78408|Return1D=0|CumReturn252=0|IDIndicator=-11.1553784860558|Score=1.03524480157762|Velocity=1|PE=12.79|Beta=0.388852470354317|InitialStopLimit=12|TrailingStopLimit=12|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=2.996|Comment=Price changed on 5/1/2025 from $14.98 to $15.00
|
||||
Slot=0|Symbol=MO|PurchaseDate=3/31/2025 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=18|PurchasePrice=59.91|CurrentPrice=59.87|Volume=17335180|Return1D=0|CumReturn252=0|IDIndicator=-15.9362549800797|Score=1.14749269300042|Velocity=0.967136150234742|PE=9|Beta=0.572465642401382|InitialStopLimit=47.93|TrailingStopLimit=47.93|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=12.004|Comment=Price changed on 4/1/2025 from $60.02 to $59.91
|
||||
Slot=0|Symbol=EXC|PurchaseDate=3/31/2025 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=24|PurchasePrice=45.76|CurrentPrice=46|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=Price changed on 4/1/2025 from $46.08 to $45.76
|
||||
Slot=0|Symbol=SXT|PurchaseDate=3/31/2025 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=14|PurchasePrice=73.98|CurrentPrice=93.61|Volume=362866|Return1D=0|CumReturn252=0|IDIndicator=-7.17131474103586|Score=0.447832358242973|Velocity=0.447678018575852|PE=24.93|Beta=0.640557790575348|InitialStopLimit=59.18|TrailingStopLimit=85.4177850723267|LastStopAdjustment=4/30/2025 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=14.886|Comment=Price changed on 4/1/2025 from $74.43 to $73.98
|
||||
Slot=1|Symbol=RGLD|PurchaseDate=4/30/2025 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=6|PurchasePrice=179.06|CurrentPrice=179.24|Volume=872755|Return1D=0|CumReturn252=0|IDIndicator=-12.3505976095618|Score=0.879340632979787|Velocity=0.8398891966759|PE=36.94|Beta=0.672718546494456|InitialStopLimit=143.25|TrailingStopLimit=143.25|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=36.542|Comment=Price changed on 5/1/2025 from $182.71 to $179.06
|
||||
Slot=1|Symbol=PSO|PurchaseDate=4/30/2025 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=69|PurchasePrice=15.98|CurrentPrice=16.1|Volume=894303|Return1D=0|CumReturn252=0|IDIndicator=-11.9521912350598|Score=1.15269564166514|Velocity=0.737122557726465|PE=19.2|Beta=0.0342052512015139|InitialStopLimit=12.78|TrailingStopLimit=12.78|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=3.25|Comment=Price changed on 5/1/2025 from $16.25 to $15.98
|
||||
Slot=1|Symbol=TSCDY|PurchaseDate=4/30/2025 12:00:00 AM|SellDate=1/1/0001 12:00:00 AM|Shares=75|PurchasePrice=15|CurrentPrice=15.02|Volume=78408|Return1D=0|CumReturn252=0|IDIndicator=-11.1553784860558|Score=1.03524480157762|Velocity=1|PE=12.79|Beta=0.388852470354317|InitialStopLimit=12|TrailingStopLimit=12|LastStopAdjustment=1/1/0001 12:00:00 AM|PositionRiskPercentDecimal=0.2|R=2.996|Comment=Price changed on 5/1/2025 from $14.98 to $15.00
|
||||
TotalPositions=0
|
||||
TotalStopLimits=2
|
||||
Symbol=EXC|AnalysisDate=4/30/2025 12:00:00 AM|PreviousStop=36.61|NewStop=42.7107857322693|CurrentPriceLow=46.11|CurrentPriceClose=46.9|PriceTrendIndicatorSlope=0.0870828032493591|StopLimitId=EXC20250331120000AM
|
||||
|
||||
@@ -10,6 +10,7 @@ using MarketData.Integration;
|
||||
using MarketData.Cache;
|
||||
using MarketData.Generator;
|
||||
using MarketData.ModelHelper;
|
||||
using MarketData.Numerical;
|
||||
|
||||
namespace MarketData.Services
|
||||
{
|
||||
@@ -51,6 +52,7 @@ namespace MarketData.Services
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,"MGSESSION /SESSIONFILE:");
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,@"MGGAINLOSS /SESSIONFILE:{PATHSESSIONFILE} (i.e.) MGGAINLOSS /SESSIONFILE:C:\boneyard\marketdata\bin\Debug\saferun\MG20180131.txt");
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,"RUNBACKTEST /STARTDATE: /MAXPOSITIONS: /INITIALCASH: /HOLDINGPERIOD: /{ENDDATE}: /{SESSIONFILE}:");
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,"CALCBETAS recalculates beta36 and bet06 for Fundamentals");
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,"ECHO {param1} {param2} {param(n)");
|
||||
}
|
||||
|
||||
@@ -91,9 +93,9 @@ namespace MarketData.Services
|
||||
tasks.Add("CMGAINLOSS",TaskCMMRunCMGainLoss);
|
||||
tasks.Add("MGSESSION",TaskMGRunMGSession);
|
||||
tasks.Add("MGGAINLOSS",TaskMGRunMGGainLoss);
|
||||
tasks.Add("RUNBACKTEST",TaskMGRunMGBacktest);
|
||||
tasks.Add("RUNBACKTEST",TaskMGRunMGBacktest);
|
||||
tasks.Add("CALCBETAS",TaskCalcBetas);
|
||||
tasks.Add("ECHO",TaskEcho);
|
||||
|
||||
GlobalConfig.Instance.Configuration = configuration; // This call sets up configuration stuff so it needs to be first.
|
||||
|
||||
if (args.Length < 1 || String.IsNullOrEmpty(args[0]))
|
||||
@@ -316,6 +318,27 @@ namespace MarketData.Services
|
||||
await Task.FromResult(true);
|
||||
}
|
||||
|
||||
public async Task TaskCalcBetas(CommandArgs commandArgs)
|
||||
{
|
||||
Profiler profiler = new Profiler();
|
||||
List<DateTime> dates = FundamentalDA.GetDistinctAsOf();
|
||||
|
||||
foreach(DateTime date in dates)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,$"Working on {date.ToShortDateString()}");
|
||||
List<String> symbols = FundamentalDA.GetSymbolsAsOf(date);
|
||||
foreach(String symbol in symbols)
|
||||
{
|
||||
double betaCalc36=BetaGenerator.Beta(symbol,date,36);
|
||||
double betaCalc06=BetaGenerator.Beta(symbol,date,6);
|
||||
if(double.IsNaN(betaCalc36) && double.IsNaN(betaCalc06))continue;
|
||||
FundamentalDA.UpdateBeta(symbol, date, betaCalc36, betaCalc06);
|
||||
}
|
||||
}
|
||||
MDTrace.WriteLine($"Total took {profiler.End()} (ms)");
|
||||
await Task.FromResult(true);
|
||||
}
|
||||
|
||||
public async Task TaskMGSHSession(CommandArgs commandArgs)
|
||||
{
|
||||
MGSHMomentumHelper.HandleMGSHSession(commandArgs);
|
||||
|
||||
@@ -10,6 +10,134 @@ namespace MarketData.DataAccess
|
||||
private FundamentalDA()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a distinct list of asof dates from the fundamentals
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<DateTime> GetDistinctAsOf()
|
||||
{
|
||||
MySqlConnection sqlConnection = null;
|
||||
MySqlDataReader sqlDataReader = null;
|
||||
MySqlCommand sqlCommand =null;
|
||||
List<DateTime> dates = new List<DateTime>();
|
||||
String strQuery = null;
|
||||
|
||||
try
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sqlConnection = SqlUtils.CreateMySqlConnection(MainDataSource.Instance.LocateDataSource("market_data"));
|
||||
sb.Append("select distinct(asof) from fundamentals order by 1 desc");
|
||||
strQuery = sb.ToString(); ;
|
||||
sqlCommand = new MySqlCommand(strQuery, sqlConnection);
|
||||
sqlCommand.CommandTimeout = SqlUtils.COMMAND_TIMEOUT;
|
||||
sqlDataReader = sqlCommand.ExecuteReader();
|
||||
while (sqlDataReader.Read())
|
||||
{
|
||||
dates.Add(sqlDataReader.GetDateTime(0));
|
||||
}
|
||||
return dates;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,exception);
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(null!=sqlCommand)sqlCommand.Dispose();
|
||||
if (null != sqlDataReader) {sqlDataReader.Close();sqlDataReader.Dispose();}
|
||||
if (null != sqlConnection) sqlConnection.Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the symbols for a particular asof date
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static List<String> GetSymbolsAsOf(DateTime asof)
|
||||
{
|
||||
MySqlConnection sqlConnection = null;
|
||||
MySqlDataReader sqlDataReader = null;
|
||||
MySqlCommand sqlCommand =null;
|
||||
List<String> symbols = new List<String>();
|
||||
String strQuery = null;
|
||||
|
||||
try
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sqlConnection = SqlUtils.CreateMySqlConnection(MainDataSource.Instance.LocateDataSource("market_data"));
|
||||
sb.Append("select symbol from fundamentals where asof =").Append(SqlUtils.ToSqlDate(asof,true)).Append(" order by 1 asc");
|
||||
strQuery = sb.ToString(); ;
|
||||
sqlCommand = new MySqlCommand(strQuery, sqlConnection);
|
||||
sqlCommand.CommandTimeout = SqlUtils.COMMAND_TIMEOUT;
|
||||
sqlDataReader = sqlCommand.ExecuteReader();
|
||||
while (sqlDataReader.Read())
|
||||
{
|
||||
symbols.Add(sqlDataReader.GetString(0));
|
||||
}
|
||||
return symbols;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,exception);
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(null!=sqlCommand)sqlCommand.Dispose();
|
||||
if (null != sqlDataReader) {sqlDataReader.Close();sqlDataReader.Dispose();}
|
||||
if (null != sqlConnection) sqlConnection.Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the beta36 and bet6 for a symbol for a specific date
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static bool UpdateBeta(String symbol,DateTime asof,double beta36, double beta06)
|
||||
{
|
||||
MySqlConnection sqlConnection = null;
|
||||
MySqlTransaction sqlTransaction = null;
|
||||
MySqlCommand sqlCommand =null;
|
||||
|
||||
List<String> symbols = new List<String>();
|
||||
String strQuery = null;
|
||||
|
||||
try
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sqlConnection = SqlUtils.CreateMySqlConnection(MainDataSource.Instance.LocateDataSource("market_data"));
|
||||
sqlTransaction = sqlConnection.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
|
||||
sb.Append("update fundamentals set ");
|
||||
sb.Append("beta_calc_36=");
|
||||
if (!Double.IsNaN(beta36)) sb.Append(beta36).Append(",");
|
||||
else sb.Append("null").Append(",");
|
||||
sb.Append("beta_calc_06=");
|
||||
if (!Double.IsNaN(beta06)) sb.Append(beta06);
|
||||
else sb.Append("null");
|
||||
sb.Append(" where ");
|
||||
sb.Append("symbol='").Append(symbol).Append("' and asof =").Append(SqlUtils.ToSqlDate(asof,true));
|
||||
strQuery = sb.ToString();
|
||||
sqlCommand = new MySqlCommand(strQuery, sqlConnection, sqlTransaction);
|
||||
sqlCommand.CommandTimeout = SqlUtils.COMMAND_TIMEOUT;
|
||||
sqlCommand.ExecuteNonQuery();
|
||||
sqlTransaction.Commit();
|
||||
return true;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,exception);
|
||||
return false;
|
||||
}
|
||||
finally
|
||||
{
|
||||
if(null != sqlTransaction)sqlTransaction.Dispose();
|
||||
if(null != sqlCommand)sqlCommand.Dispose();
|
||||
if(null != sqlConnection) sqlConnection.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CheckFundamentalModifiedOn(String symbol,DateTime modified)
|
||||
{
|
||||
MySqlConnection sqlConnection = null;
|
||||
@@ -45,7 +173,6 @@ namespace MarketData.DataAccess
|
||||
if (null != sqlConnection) sqlConnection.Close();
|
||||
}
|
||||
}
|
||||
|
||||
public static TimeSeriesCollection GetTotalCashMils(String symbol)
|
||||
{
|
||||
MySqlConnection sqlConnection = null;
|
||||
@@ -203,7 +330,7 @@ namespace MarketData.DataAccess
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sqlConnection = SqlUtils.CreateMySqlConnection(MainDataSource.Instance.LocateDataSource("market_data"));
|
||||
sb.Append("select symbol,asof,next_earnings_date,beta,low52,high52,volume,market_cap,pe,eps,peg,return_on_assets,return_on_equity,total_cash,total_debt,shares_outstanding,revenue,revenue_per_share,qtrly_revenue_growth,gross_profit,ebitda,net_income_available_to_common,book_value_per_share,operating_cashflow,leveraged_free_cashflow,book_value_per_share*shares_outstanding as equity,trailing_pe,ebit,enterprise_value,source from fundamentals where symbol=");
|
||||
sb.Append("select symbol,asof,next_earnings_date,beta,low52,high52,volume,market_cap,pe,eps,peg,return_on_assets,return_on_equity,total_cash,total_debt,shares_outstanding,revenue,revenue_per_share,qtrly_revenue_growth,gross_profit,ebitda,net_income_available_to_common,book_value_per_share,operating_cashflow,leveraged_free_cashflow,book_value_per_share*shares_outstanding as equity,trailing_pe,ebit,enterprise_value,source,beta_calc_36,beta_calc_06 from fundamentals where symbol=");
|
||||
sb.Append("'").Append(symbol).Append("'").Append(" ");
|
||||
sb.Append("and asof=(select max(asof) from fundamentals where symbol='").Append(symbol).Append("')");
|
||||
strQuery = sb.ToString(); ;
|
||||
@@ -242,6 +369,8 @@ namespace MarketData.DataAccess
|
||||
if (!sqlDataReader.IsDBNull(27)) fundamental.EBIT = sqlDataReader.GetDouble(27);
|
||||
if (!sqlDataReader.IsDBNull(28)) fundamental.EnterpriseValue = sqlDataReader.GetDouble(28);
|
||||
if (!sqlDataReader.IsDBNull(29)) fundamental.Source = sqlDataReader.GetString(29);
|
||||
if (!sqlDataReader.IsDBNull(30)) fundamental.BetaCalc36 = sqlDataReader.GetDouble(30);
|
||||
if (!sqlDataReader.IsDBNull(31)) fundamental.BetaCalc06 = sqlDataReader.GetDouble(31);
|
||||
BalanceSheet balanceSheet=BalanceSheetDA.GetBalanceSheetOnOrBefore(symbol,fundamental.AsOf,BalanceSheet.PeriodType.Annual);
|
||||
if(null!=balanceSheet&&!double.IsNaN(balanceSheet.TotalStockHolderEquity)&&!double.IsNaN(fundamental.TotalDebt)&&0!=fundamental.TotalDebt)fundamental.DebtToEquity=fundamental.TotalDebt/balanceSheet.TotalStockHolderEquity;
|
||||
return fundamental;
|
||||
@@ -269,7 +398,7 @@ namespace MarketData.DataAccess
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sqlConnection = SqlUtils.CreateMySqlConnection(MainDataSource.Instance.LocateDataSource("market_data"));
|
||||
sb.Append("select symbol,asof,next_earnings_date,beta,low52,high52,volume,market_cap,pe,eps,peg,return_on_assets,return_on_equity,total_cash,total_debt,shares_outstanding,revenue,revenue_per_share,qtrly_revenue_growth,gross_profit,ebitda,net_income_available_to_common,book_value_per_share,operating_cashflow,leveraged_free_cashflow,book_value_per_share*shares_outstanding as equity,trailing_pe,ebit,enterprise_value,source from fundamentals where symbol=");
|
||||
sb.Append("select symbol,asof,next_earnings_date,beta,low52,high52,volume,market_cap,pe,eps,peg,return_on_assets,return_on_equity,total_cash,total_debt,shares_outstanding,revenue,revenue_per_share,qtrly_revenue_growth,gross_profit,ebitda,net_income_available_to_common,book_value_per_share,operating_cashflow,leveraged_free_cashflow,book_value_per_share*shares_outstanding as equity,trailing_pe,ebit,enterprise_value,source,beta_calc_36,beta_calc_06 from fundamentals where symbol=");
|
||||
sb.Append("'").Append(symbol).Append("'").Append(" ");
|
||||
sb.Append("and asof=").Append("'").Append(Utility.DateTimeToStringYYYYHMMHDD(asof)).Append("'").Append(";");
|
||||
strQuery = sb.ToString(); ;
|
||||
@@ -309,6 +438,8 @@ namespace MarketData.DataAccess
|
||||
if (!sqlDataReader.IsDBNull(27)) fundamental.EBIT = sqlDataReader.GetDouble(27);
|
||||
if (!sqlDataReader.IsDBNull(28)) fundamental.EnterpriseValue = sqlDataReader.GetDouble(28);
|
||||
if (!sqlDataReader.IsDBNull(29)) fundamental.Source = sqlDataReader.GetString(29);
|
||||
if (!sqlDataReader.IsDBNull(30)) fundamental.BetaCalc36 = sqlDataReader.GetDouble(30);
|
||||
if (!sqlDataReader.IsDBNull(3)) fundamental.BetaCalc06 = sqlDataReader.GetDouble(31);
|
||||
if (null != balanceSheet && !double.IsNaN(balanceSheet.TotalStockHolderEquity) && !double.IsNaN(fundamental.TotalDebt) && 0 != fundamental.TotalDebt)
|
||||
{
|
||||
fundamental.DebtToEquity=fundamental.TotalDebt/balanceSheet.TotalStockHolderEquity;
|
||||
@@ -366,7 +497,6 @@ namespace MarketData.DataAccess
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve latest MarketCap, PE, EBITDA, RevenuePerShare for all symbols with aasof being no more recent than the provided date
|
||||
/// Given a tradeDate of 04/18/2025 this method might return a collection similar to below. The model returned is a subset of the fundamental
|
||||
@@ -388,7 +518,7 @@ namespace MarketData.DataAccess
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sqlConnection = SqlUtils.CreateMySqlConnection(MainDataSource.Instance.LocateDataSource("market_data"));
|
||||
sb.Append("SELECT A.asof,A.symbol, A.market_cap,A.ebitda,A.pe,A.revenue_per_share FROM fundamentals A JOIN ");
|
||||
sb.Append("SELECT A.asof,A.symbol, A.market_cap,A.ebitda,A.pe,A.revenue_per_share,A.beta,A.beta_calc_36,A.beta_calc_06 FROM fundamentals A JOIN ");
|
||||
sb.Append("(SELECT MAX(asof) asof,symbol FROM fundamentals WHERE asof<=").Append("'");
|
||||
sb.Append(Utility.DateTimeToStringYYYYHMMHDD(tradeDate.Date));
|
||||
sb.Append("'");
|
||||
@@ -407,6 +537,9 @@ namespace MarketData.DataAccess
|
||||
if(!sqlDataReader.IsDBNull(3)) fundamental.EBITDA = sqlDataReader.GetDouble(3);
|
||||
if(!sqlDataReader.IsDBNull(4)) fundamental.PE = sqlDataReader.GetDouble(4);
|
||||
if(!sqlDataReader.IsDBNull(5)) fundamental.RevenuePerShare = sqlDataReader.GetDouble(5);
|
||||
if(!sqlDataReader.IsDBNull(6)) fundamental.Beta = sqlDataReader.GetDouble(6);
|
||||
if(!sqlDataReader.IsDBNull(7)) fundamental.BetaCalc36 = sqlDataReader.GetDouble(7);
|
||||
if(!sqlDataReader.IsDBNull(8)) fundamental.BetaCalc06 = sqlDataReader.GetDouble(8);
|
||||
if(!fundamentals.ContainsKey(fundamental.Symbol))fundamentals.Add(fundamental.Symbol,fundamental);
|
||||
}
|
||||
return fundamentals;
|
||||
@@ -437,7 +570,7 @@ namespace MarketData.DataAccess
|
||||
if(null==maxDate)return null;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sqlConnection = SqlUtils.CreateMySqlConnection(MainDataSource.Instance.LocateDataSource("market_data"));
|
||||
sb.Append("select symbol,asof,next_earnings_date,beta,low52,high52,volume,market_cap,pe,eps,peg,return_on_assets,return_on_equity,total_cash,total_debt,shares_outstanding,revenue,revenue_per_share,qtrly_revenue_growth,gross_profit,ebitda,net_income_available_to_common,book_value_per_share,operating_cashflow,leveraged_free_cashflow,book_value_per_share*shares_outstanding as equity,trailing_pe,ebit,enterprise_value,source from fundamentals where symbol=");
|
||||
sb.Append("select symbol,asof,next_earnings_date,beta,low52,high52,volume,market_cap,pe,eps,peg,return_on_assets,return_on_equity,total_cash,total_debt,shares_outstanding,revenue,revenue_per_share,qtrly_revenue_growth,gross_profit,ebitda,net_income_available_to_common,book_value_per_share,operating_cashflow,leveraged_free_cashflow,book_value_per_share*shares_outstanding as equity,trailing_pe,ebit,enterprise_value,source,beta_calc_36,beta_calc_06 from fundamentals where symbol=");
|
||||
sb.Append("'").Append(symbol).Append("'").Append(" ");
|
||||
sb.Append("and asof=").Append("'").Append(Utility.DateTimeToStringYYYYHMMHDD(maxDate.Value)).Append("'");
|
||||
sb.Append(" limit 1");
|
||||
@@ -478,6 +611,8 @@ namespace MarketData.DataAccess
|
||||
if (!sqlDataReader.IsDBNull(27)) fundamental.EBIT = sqlDataReader.GetDouble(27);
|
||||
if (!sqlDataReader.IsDBNull(28)) fundamental.EnterpriseValue = sqlDataReader.GetDouble(28);
|
||||
if (!sqlDataReader.IsDBNull(29)) fundamental.Source = sqlDataReader.GetString(29);
|
||||
if (!sqlDataReader.IsDBNull(30)) fundamental.BetaCalc36 = sqlDataReader.GetDouble(30);
|
||||
if (!sqlDataReader.IsDBNull(31)) fundamental.BetaCalc06 = sqlDataReader.GetDouble(31);
|
||||
if (!double.IsNaN(totalStockHolderEquity) && !double.IsNaN(fundamental.TotalDebt))
|
||||
{
|
||||
if(0.00==totalStockHolderEquity)fundamental.TotalDebt=0.00;
|
||||
@@ -513,7 +648,7 @@ namespace MarketData.DataAccess
|
||||
{
|
||||
Fundamental fundamental = fundamentals[index];
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("insert into fundamentals (symbol,asof,next_earnings_date,beta,low52,high52,volume,market_cap,pe,eps,peg,return_on_assets,return_on_equity,total_cash,total_debt,shares_outstanding,revenue,revenue_per_share,qtrly_revenue_growth,gross_profit,ebitda,net_income_available_to_common,book_value_per_share,operating_cashflow,leveraged_free_cashflow,trailing_pe,ebit,enterprise_value,source) ");
|
||||
sb.Append("insert into fundamentals (symbol,asof,next_earnings_date,beta,beta_calc_36,beta_calc_06,low52,high52,volume,market_cap,pe,eps,peg,return_on_assets,return_on_equity,total_cash,total_debt,shares_outstanding,revenue,revenue_per_share,qtrly_revenue_growth,gross_profit,ebitda,net_income_available_to_common,book_value_per_share,operating_cashflow,leveraged_free_cashflow,trailing_pe,ebit,enterprise_value,source) ");
|
||||
sb.Append("values(");
|
||||
sb.Append("'").Append(fundamental.Symbol).Append("'").Append(",");
|
||||
sb.Append("'").Append(Utility.DateTimeToStringYYYYHMMHDD(fundamental.AsOf)).Append("'").Append(",");
|
||||
@@ -521,6 +656,10 @@ namespace MarketData.DataAccess
|
||||
else sb.Append("'").Append(Utility.DateTimeToStringYYYYHMMHDD(fundamental.NextEarningsDate)).Append("'").Append(",");
|
||||
if (!Double.IsNaN(fundamental.Beta)) sb.Append(fundamental.Beta).Append(",");
|
||||
else sb.Append("null").Append(",");
|
||||
if (!Double.IsNaN(fundamental.BetaCalc36)) sb.Append(fundamental.BetaCalc36).Append(",");
|
||||
else sb.Append("null").Append(",");
|
||||
if (!Double.IsNaN(fundamental.BetaCalc06)) sb.Append(fundamental.BetaCalc06).Append(",");
|
||||
else sb.Append("null").Append(",");
|
||||
if (!Double.IsNaN(fundamental.Low52)) sb.Append(fundamental.Low52).Append(",");
|
||||
else sb.Append("null").Append(",");
|
||||
if (!Double.IsNaN(fundamental.High52)) sb.Append(fundamental.High52).Append(",");
|
||||
@@ -605,7 +744,7 @@ namespace MarketData.DataAccess
|
||||
sqlTransaction = sqlConnection.BeginTransaction(System.Data.IsolationLevel.ReadCommitted);
|
||||
DeleteFundamental(fundamental, sqlConnection, sqlTransaction);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("insert into fundamentals (symbol,asof,next_earnings_date,beta,low52,high52,volume,market_cap,pe,eps,peg,return_on_assets,return_on_equity,total_cash,total_debt,shares_outstanding,revenue,revenue_per_share,qtrly_revenue_growth,gross_profit,ebitda,net_income_available_to_common,book_value_per_share,operating_cashflow,leveraged_free_cashflow,trailing_pe,ebit,enterprise_value,source) ");
|
||||
sb.Append("insert into fundamentals (symbol,asof,next_earnings_date,beta,beta_calc_36,beta_calc_06,low52,high52,volume,market_cap,pe,eps,peg,return_on_assets,return_on_equity,total_cash,total_debt,shares_outstanding,revenue,revenue_per_share,qtrly_revenue_growth,gross_profit,ebitda,net_income_available_to_common,book_value_per_share,operating_cashflow,leveraged_free_cashflow,trailing_pe,ebit,enterprise_value,source) ");
|
||||
sb.Append("values(");
|
||||
sb.Append("'").Append(fundamental.Symbol).Append("'").Append(",");
|
||||
sb.Append("'").Append(Utility.DateTimeToStringYYYYHMMHDD(fundamental.AsOf)).Append("'").Append(",");
|
||||
@@ -613,6 +752,10 @@ namespace MarketData.DataAccess
|
||||
else sb.Append("'").Append(Utility.DateTimeToStringYYYYHMMHDD(fundamental.NextEarningsDate)).Append("'").Append(",");
|
||||
if (!Double.IsNaN(fundamental.Beta)) sb.Append(fundamental.Beta).Append(",");
|
||||
else sb.Append("null").Append(",");
|
||||
if (!Double.IsNaN(fundamental.BetaCalc36)) sb.Append(fundamental.BetaCalc36).Append(",");
|
||||
else sb.Append("null").Append(",");
|
||||
if (!Double.IsNaN(fundamental.BetaCalc06)) sb.Append(fundamental.BetaCalc06).Append(",");
|
||||
else sb.Append("null").Append(",");
|
||||
if (!Double.IsNaN(fundamental.Low52)) sb.Append(fundamental.Low52).Append(",");
|
||||
else sb.Append("null").Append(",");
|
||||
if (!Double.IsNaN(fundamental.High52)) sb.Append(fundamental.High52).Append(",");
|
||||
|
||||
@@ -6,6 +6,7 @@ using System.Threading;
|
||||
using MarketData.MarketDataModel;
|
||||
using MarketData.DataAccess;
|
||||
using MarketData.Utils;
|
||||
using MarketData.Numerical;
|
||||
|
||||
namespace MarketData.Helper
|
||||
{
|
||||
@@ -219,6 +220,8 @@ namespace MarketData.Helper
|
||||
{
|
||||
Fundamental priorFundamental=FundamentalDA.GetFundamental(symbol);
|
||||
fundamental.MergeFrom(priorFundamental); // if any fields are missing on this run then carry forward fields from previous run
|
||||
fundamental.BetaCalc36=BetaGenerator.Beta(fundamental.Symbol,fundamental.AsOf,36);
|
||||
fundamental.BetaCalc06=BetaGenerator.Beta(fundamental.Symbol,fundamental.AsOf,6);
|
||||
FundamentalDA.InsertFundamental(fundamental);
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,Fundamental.Header);
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,fundamental.ToString());
|
||||
@@ -243,6 +246,8 @@ namespace MarketData.Helper
|
||||
if(null!=nextEarningsDate)fundamental.NextEarningsDate=nextEarningsDate.Value;
|
||||
Fundamental priorFundamental=FundamentalDA.GetFundamental(symbol);
|
||||
fundamental.MergeFrom(priorFundamental); // if any fields are missing on this run then carry forward fields from previous run
|
||||
fundamental.BetaCalc36=BetaGenerator.Beta(fundamental.Symbol,fundamental.AsOf,36);
|
||||
fundamental.BetaCalc06=BetaGenerator.Beta(fundamental.Symbol,fundamental.AsOf,6);
|
||||
FundamentalDA.InsertFundamental(fundamental);
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,Fundamental.Header);
|
||||
MDTrace.WriteLine(LogLevel.DEBUG,fundamental.ToString());
|
||||
@@ -257,4 +262,3 @@ namespace MarketData.Helper
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,10 @@ namespace MarketData.MarketDataModel
|
||||
private double marketCap;
|
||||
private double pe;
|
||||
private double ebitda;
|
||||
private double revenuePerShare;
|
||||
private double revenuePerShare;
|
||||
private double beta;
|
||||
private double betaCalc36;
|
||||
private double betaCalc06;
|
||||
|
||||
public FundamentalV2()
|
||||
{
|
||||
@@ -54,5 +57,20 @@ namespace MarketData.MarketDataModel
|
||||
get { return ebitda; }
|
||||
set { ebitda = value; }
|
||||
}
|
||||
public double Beta
|
||||
{
|
||||
get { return beta; }
|
||||
set { beta = value; }
|
||||
}
|
||||
public double BetaCalc36
|
||||
{
|
||||
get { return betaCalc36; }
|
||||
set { betaCalc36 = value; }
|
||||
}
|
||||
public double BetaCalc06
|
||||
{
|
||||
get { return betaCalc06; }
|
||||
set { betaCalc06 = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ namespace MarketData.MarketDataModel
|
||||
private DateTime asOf;
|
||||
private DateTime nextEarningsDate;
|
||||
private double beta;
|
||||
private double betaCalc36;
|
||||
private double betaCalc06;
|
||||
private double low52;
|
||||
private double high52;
|
||||
private Int64 volume;
|
||||
@@ -74,6 +76,16 @@ namespace MarketData.MarketDataModel
|
||||
get { return beta; }
|
||||
set { beta = value; }
|
||||
}
|
||||
public double BetaCalc36
|
||||
{
|
||||
get { return betaCalc36; }
|
||||
set { betaCalc36 = value; }
|
||||
}
|
||||
public double BetaCalc06
|
||||
{
|
||||
get { return betaCalc06; }
|
||||
set { betaCalc06 = value; }
|
||||
}
|
||||
public double Low52
|
||||
{
|
||||
get { return low52; }
|
||||
@@ -329,6 +341,8 @@ namespace MarketData.MarketDataModel
|
||||
sb.Append("Source,");
|
||||
sb.Append("NextEarningsDate").Append(",");
|
||||
sb.Append("Beta").Append(",");
|
||||
sb.Append("BetaCalc36").Append(",");
|
||||
sb.Append("BetaCalc06").Append(",");
|
||||
sb.Append("Low52").Append(",");
|
||||
sb.Append("High52").Append(",");
|
||||
sb.Append("Volume").Append(",");
|
||||
@@ -366,6 +380,8 @@ namespace MarketData.MarketDataModel
|
||||
sb.Append(null == Source ? "" : Source).Append(",");
|
||||
sb.Append(Utility.DateTimeToStringMMSDDSYYYY(NextEarningsDate)).Append(",");
|
||||
sb.Append(String.Format("{0:0.00}",Beta )).Append(",");
|
||||
sb.Append(String.Format("{0:0.00}",BetaCalc36 )).Append(",");
|
||||
sb.Append(String.Format("{0:0.00}",BetaCalc06 )).Append(",");
|
||||
sb.Append(String.Format("{0:0.00}",Low52)).Append(",");
|
||||
sb.Append(String.Format("{0:0.00}",High52)).Append(",");
|
||||
sb.Append(String.Format("{0:0.00}", Volume)).Append(",");
|
||||
@@ -396,3 +412,4 @@ namespace MarketData.MarketDataModel
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user