Add pricing fetches. Add unit test.
Some checks failed
Build .NET Project / build (push) Has been cancelled

This commit is contained in:
2026-03-19 18:07:52 -04:00
parent 22f30466bc
commit 230e2b931f
3 changed files with 136 additions and 19 deletions

View File

@@ -130,6 +130,9 @@ public class MarketDataUnitTestClass
Assert.IsTrue(price.IsValid || !double.IsNaN(price.PrevClose), "The feed is not working.");
}
/// <summary>
/// DailyPricesYahoo - This test confirms if we are able to retrieve a current (last business day) price from Yahoo.
/// </summary>
[TestMethod]
public void DailyPricesYahoo()
{
@@ -146,26 +149,29 @@ public class MarketDataUnitTestClass
Assert.IsTrue(null != prices, "No Price from DailyPricesYahoo");
}
// [TestMethod]
// public void CNNPredictionTest()
// {
// String cnnHostName = "10.0.0.240";
// CMCandidate cmCandidate = new CMCandidate();
// CMParams cmParams = new CMParams();
/// <summary>
/// HistoricalPricesYahoo - This test confirms if we are able to retrieve historical dates from Yahoo
/// </summary>
[TestMethod]
public void HistoricalPricesYahoo()
{
String symbol = "AAPL";
DateGenerator dateGenerator = new DateGenerator();
DateTime lastBusinessDate = DateTime.Now;
DateTime historicalDate = Utility.Epoch;
// cmParams.UseCNN = true;
// cmParams.UseCNNHost = "http://" + cnnHostName + ":5000";
// cmParams.UseCNNDayCount = 270;
// cmParams.UseCNNRewardPercentDecimal = 0.25;
lastBusinessDate = dateGenerator.GetPrevBusinessDay(lastBusinessDate);
List<DateTime> historicalDates = dateGenerator.GenerateHistoricalDates(lastBusinessDate,30);
DateTime minDate = historicalDates.Min();
// cmCandidate.Symbol = "MIDD";
// cmCandidate.TradeDate = DateTime.Parse("07-01-2024");
// bool result = CMMomentumGenerator.PredictCandidate(cmCandidate, cmParams);
// Assert.IsTrue(result);
// }
Prices prices = MarketDataHelper.GetDailyPrices(symbol, lastBusinessDate, minDate);
Assert.IsTrue(null != prices, "No Price from DailyPricesYahoo");
Assert.IsTrue(prices.Count>1, "No Historical Prices from DailyPricesYahoo");
}
/// <summary>
/// CNNPredictionTest - This runs the Prediction using the CMMMomentumGenerator
/// </summary>
[TestMethod]
public void CNNPredictionTest()
{