static void Main(string[] args) { var priceService = new RandomWalkPriceService(); priceService.NewPricesArrived += PriceUpdateHandler; priceService.Start(); while (true) { ConsoleKeyInfo key = Console.ReadKey(); if (key.Key == ConsoleKey.D) { Console.WriteLine("Done"); break; } } priceService.Stop(); }
/// <summary> /// This method will subsccribe to NewPriceArrived event, this even will be raised 20 times in a second /// and hence the handler will also be invoked that many times /// </summary> void InitializeTradeService() { InitializeDummyInstruments(); priceService = new RandomWalkPriceService(); priceService.NewPricesArrived += PriceUpdateHandler; }