public void TestGetLastNClosingPrices() { //List<string> allLines = Reader.GetAllLinesFromPath("COTAHIST_A2016.TXT"); Dictionary <string, MarketData> mData = Reader.GetMarketDataFromPaper("PETR3", allLines); MarketHistory mh = new MarketHistory(mData); var last15 = mh.GetLastNClosingPrices(15, mh[225].dateStr); }
public Dictionary <string, decimal> CalculateIndicator(MarketHistory mHistory) { Dictionary <string, decimal> temp = new Dictionary <string, decimal>(); foreach (MarketData m in mHistory) { var lastCloses = mHistory.GetLastNClosingPrices(period, m.dateStr); decimal avg = lastCloses.Average(); temp.Add(m.dateStr, avg); } return(temp); }