public MatchAggregate(string tickerSymbol, decimal initialPrice = 0.0m, double initialVolume = 0.0d, int sampleSize = DefaultSampleSize) { TickerSymbol = tickerSymbol; AvgPrice = EMWAm.Init(sampleSize, initialPrice); AvgVolume = EMWA.Init(sampleSize, initialVolume); }
/// <summary> /// Feed the most recent match for <see cref="TickerSymbol"/> to update moving price averages. /// </summary> /// <param name="latestTrade">The most recent matched trade for this symbol.</param> public bool WithMatch(Match latestTrade) { if (!latestTrade.StockId.Equals(TickerSymbol)) { return(false); // Someone fed a match for a stock other than TickerSymbol } // Update EMWA quantity and volume AvgVolume += latestTrade.Quantity; AvgPrice += latestTrade.SettlementPrice; return(true); }