예제 #1
0
        public void BasicTest()
        {
            FeederFactory factory = new FeederFactory();
            ManualFeeder  manual  = factory.CreateManualFeeder();

            manual.Feed(DateTime.Now, 1, 2, 3, 4);
        }
예제 #2
0
        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]);
                }
            }
        }
예제 #4
0
        public MockFeedProvider()
        {
            _priceBars = new PriceBars(100);

            FeederFactory factory = new FeederFactory();
        }
예제 #5
0
 static void Main(string[] args)
 {
     //Read the values from calling program
     //If already running
     IFeeder feeder = FeederFactory.GetFeeder(StockModel.Master.FeedSourceSystem.FakeMarket);
 }