private void start() { //Loading system startup data for all the exchanges List <Exchange> exchanges = new List <Exchange>(); exchanges.Add(Exchange.FAKE_NASDAQ); InMemoryObjects.LoadInMemoryObjects(exchanges); //Initiate fake data generation from fake market //Later it will also include data generation from google finance TimeSpan updateDuration = TimeSpan.FromMilliseconds(Constants.FAKE_DATA_GENERATE_PERIOD); FakeDataGenerator.StartFakeDataGeneration(300); IFeeder feeder = FeederFactory.GetFeeder(FeederSourceSystem.FAKEMARKET); ISender sender = SenderFactory.GetSender(FeederQueueSystem.REDIS_CACHE); List <StockModel.Symbol> symbols = InMemoryObjects.ExchangeSymbolList.SingleOrDefault(x => x.Exchange == Exchange.FAKE_NASDAQ).Symbols; while (true) { Parallel.ForEach(symbols, (symbol) => { feedList = feeder.GetFeedList(symbol.Id, 1, 10); // Get the list of values for a given symbolId of a market for given time-span sender.SendFeed(feedList); }); } }
public void UpdateGraph() { IFeeder feeder = FeederFactory.GetFeeder(FeederSourceSystem.FAKEMARKET); feedList = feeder.GetFeedList(1, 1, 10); // Get the list of values for a given symbolId of a market for given time-span for (int i = 0; i < feedList.Count; i++) { double[] stockData = new double[2]; stockData[0] = feedList[i].TimeStamp; stockData[1] = feedList[i].LTP; if (stockData != null && stockData.Length != 0) { //double seconds = Convert.ToDouble(stockData[0].Remove(0, 1)) * 1000; Clients.All.updatePoints(stockData[0], stockData[1]); } } }