Пример #1
0
 /// <summary>
 /// Construct my default state.
 /// </summary>
 /// <param name="stage">This <see cref="Stage"/> of actors I create</param>
 /// <param name="exchangeName">The name of the exchange I feed</param>
 /// <param name="feederType">The type of the <see cref="IFeeder"/></param>
 /// <param name="entryReaderType">The <see cref="IEntryReader"/> used by the <see cref="IFeeder"/></param>
 internal DefaultFeed(Stage stage, string exchangeName, Type feederType, IEntryReader entryReaderType)
 {
     _exchangeName    = exchangeName;
     _feederType      = feederType;
     _entryReaderType = entryReaderType;
     _feeder          = stage.ActorFor <IFeeder>(feederType, this, entryReaderType);
 }
Пример #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 ViewModel (IFeeder feeder)
		{
			_feeder = feeder;

			ScheduleEntries = new NotifyTaskCompletion<ObservableCollection<ScheduleEntryViewModel>> (GetSchedule ());

			ScheduleEntries.PropertyChanged += (object sender, PropertyChangedEventArgs e) => 
			{
				if(e.PropertyName == "Result")
				{
					AddMealCommand = new RelayCommand (o => {
						ScheduleEntries.Result.Add (new ScheduleEntryViewModel ());
					});
	
					CommitScheduleCommand = new RelayCommand (async o => await SetSchedule (ScheduleEntries.Result));
				}
			};

			RunCommand = new RelayCommand (o => _feeder.Feed ());
		}
Пример #5
0
 static void Main(string[] args)
 {
     //Read the values from calling program
     //If already running
     IFeeder feeder = FeederFactory.GetFeeder(StockModel.Master.FeedSourceSystem.FakeMarket);
 }