Пример #1
0
 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);
 }
Пример #2
0
 /// <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);
 }