BetaGenerator test code.
This commit is contained in:
57
Program.cs
57
Program.cs
@@ -986,6 +986,63 @@ namespace MarketData
|
||||
Trace.Listeners.Add(new TextWriterTraceListener(strLogFile));
|
||||
DateTime currentDate=DateTime.Now;
|
||||
|
||||
//List<String> candidatesList = new List<String>();
|
||||
//List<String> differenceItems = new List<String>();
|
||||
//String benchmark = "SPY";
|
||||
//int lowSlopeBetaDays = 15;
|
||||
//List<String> symbols = PricingDA.GetSymbols();
|
||||
//DateTime tradeDateA = DateTime.Parse("12-31-2024");
|
||||
//for (int index = 0; index < symbols.Count; index++)
|
||||
//{
|
||||
// if (0 == (index % 500)) MDTrace.WriteLine(LogLevel.DEBUG, $"Working...{index}");
|
||||
// String symbol = symbols[index];
|
||||
// if (symbol.StartsWith("^")) continue;
|
||||
// Price price = GBPriceCache.GetInstance().GetPrice(symbol, tradeDateA);
|
||||
// if (null == price) continue;
|
||||
// Prices prices = GBPriceCache.GetInstance().GetPrices(symbol, tradeDateA, (int)252);
|
||||
// if (null == prices || prices.Count < 252) continue;
|
||||
// Fundamental fundamental = FundamentalDA.GetFundamentalMaxDate(symbol, tradeDateA);
|
||||
// if (null == fundamental) continue;
|
||||
// if (double.IsNaN(fundamental.PE) || fundamental.PE <= 0.00) continue;
|
||||
|
||||
// double fundamentalBeta = fundamental.Beta;
|
||||
// double beta = BetaGenerator.Beta(symbol, tradeDateA, 36);
|
||||
// if (double.IsNaN(beta) || double.IsNaN(fundamental.Beta)) continue;
|
||||
|
||||
// if (0 == fundamentalBeta) fundamentalBeta = .00000000000000000001;
|
||||
|
||||
// double difference = Math.Abs(((beta - fundamentalBeta) / fundamentalBeta));
|
||||
// if (difference > .25) // greater than 5%
|
||||
// {
|
||||
// differenceItems.Add(symbol);
|
||||
// }
|
||||
|
||||
// if (beta >= 1.00)
|
||||
// {
|
||||
// double[] pricesArray = null;
|
||||
// LeastSquaresResult leastSquaresResult;
|
||||
// Prices benchmarkPrices = GBPriceCache.GetInstance().GetPrices(benchmark, tradeDateA, lowSlopeBetaDays);
|
||||
// pricesArray = Numerics.ToDouble(benchmarkPrices.GetPricesLow());
|
||||
// leastSquaresResult = Numerics.LeastSquares(pricesArray);
|
||||
// double slopeBmk = leastSquaresResult.Slope;
|
||||
// if (slopeBmk < 0)
|
||||
// {
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
// candidatesList.Add(symbol);
|
||||
// //if(double.IsNaN(beta))
|
||||
// //{
|
||||
// // MDTrace.WriteLine(LogLevel.DEBUG,$"No beta for {symbol}");
|
||||
// //}
|
||||
//}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
DateTime maxHolidayDate =HolidayDA.GetMaxHolidayDate();
|
||||
if(currentDate>maxHolidayDate)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user