async Task UpdateMarketAsync(TradingDay tradingDay, bool close = false) { TickerViewModel.Update(tradingDay, _securityRepository, close); MiniTickerPartialViewModel.Update(tradingDay, _securityRepository); await _pusher.TriggerAsync( "stockimulate", "update-market", new { day = _dayNumber, news = tradingDay.NewsItem, effects = _securities.Select(security => tradingDay.Effects[security.Symbol]).ToArray(), close }); }
/// <summary> /// Resets the market. /// </summary> public void Reset() { _timer.Stop(); _dayNumber = 0; foreach (var security in _securities) { security.Price = 0; _securityRepository.UpdateAsync(security); } _tradeRepository.DeleteAll(); TickerViewModel.Reset(_securityRepository); MiniTickerPartialViewModel.Reset(_securityRepository); SimulationState = SimulationState.Ready; }