/// <summary>
        /// Initializes a new instance of the <see cref="LiveCharts_co_uk_PriceReceiver"/> class.
        /// </summary>
        /// <param name="scraper">The scraper.</param>
        /// <param name="stockMarket">The stock market.</param>
        /// <param name="filter">The filter.</param>
        /// <param name="timePeriodLengthSecs">The time period length secs.</param>
        public LiveCharts_co_uk_PriceReceiver(IScraper scraper, IStockMarket stockMarket, IPipelineFilter filter, int timePeriodLengthSecs)
            : this()
        {
            Condition.Requires(scraper).IsNotNull();
            Condition.Requires(stockMarket).IsNotNull();
            Condition.Requires(timePeriodLengthSecs).IsGreaterThan(0);

            this._scraper     = scraper;
            this._stockMarket = stockMarket;
            this._filter      = filter;

            this._timePeriodLengthSecs = timePeriodLengthSecs;
        }
Пример #2
0
        public Game()
        {
            // Initialize the stock market
            var stocks = new Dictionary <StockId, IStock>();

            stocks = new Dictionary <StockId, IStock>();
            stocks[StockId.GOLD]     = new Stock(StockId.GOLD);
            stocks[StockId.SILVER]   = new Stock(StockId.SILVER);
            stocks[StockId.OIL]      = new Stock(StockId.OIL);
            stocks[StockId.BONDS]    = new Stock(StockId.BONDS);
            stocks[StockId.INDUSTRY] = new Stock(StockId.INDUSTRY);
            stocks[StockId.GRAIN]    = new Stock(StockId.GRAIN);
            _stockMarket             = StockMarket.GetStockMarket(stocks);

            _players          = new List <Player>();
            _isGameInProgress = false;
        }
Пример #3
0
 public void Invest(IStockMarket <Stock> stockMarket)
 {
     unsubscriber = stockMarket.Subscribe(this);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="LiveCharts_co_uk_PriceReceiver"/> class.
 /// </summary>
 /// <param name="scraper">The scraper.</param>
 /// <param name="stockMarket">The stock market.</param>
 /// <param name="timePeriodLengthSecs">The time period length secs.</param>
 public LiveCharts_co_uk_PriceReceiver(IScraper scraper, IStockMarket stockMarket, int timePeriodLengthSecs)
     : this(scraper, stockMarket, null, timePeriodLengthSecs)
 {
 }