public ModelRoot() { _allTransactions = new ObservableCollection <StockTransaction>(); // Note that all of these queries are defined against an EMPTY // source collection... _bids = from tx in _allTransactions where tx.TransactionType == TransactionType.Bid && tx.Symbol == "AAPL" orderby tx.Price ascending select tx; _asks = from tx in _allTransactions where tx.TransactionType == TransactionType.Ask && tx.Symbol == "AAPL" orderby tx.Price descending select tx; _executions = from tx in _allTransactions where tx.TransactionType == TransactionType.Execution && tx.Symbol == "AAPL" orderby tx.Price descending select tx; _graphExecutions = from tx in _executions where tx.TimeStamp >= DateTime.Now.AddMinutes(-5) select tx; _minPrice = _executions.ContinuousMin(tx => tx.Price, newPrice => this.CurrentMin = newPrice); _maxPrice = _executions.ContinuousMax(tx => tx.Price, newPrice => this.CurrentMax = newPrice); _vwap = _executions.ContinuousVwap(tx => tx.Price, tx => tx.Quantity, newVwap => this.CurrentVwap = newVwap); _simulationTimer = new Timer(1000); _simulationTimer.Elapsed += GenerateBogusData; _simulationTimer.Start(); }
public ModelRoot() { _allTransactions = new ObservableCollection<StockTransaction>(); // Note that all of these queries are defined against an EMPTY // source collection... _bids = from tx in _allTransactions where tx.TransactionType == TransactionType.Bid && tx.Symbol == "AAPL" orderby tx.Price ascending select tx; _asks = from tx in _allTransactions where tx.TransactionType == TransactionType.Ask && tx.Symbol == "AAPL" orderby tx.Price descending select tx; _executions = from tx in _allTransactions where tx.TransactionType == TransactionType.Execution && tx.Symbol == "AAPL" orderby tx.Price descending select tx; _graphExecutions = from tx in _executions where tx.TimeStamp >= DateTime.Now.AddMinutes(-5) select tx; _minPrice = _executions.ContinuousMin(tx => tx.Price, newPrice => this.CurrentMin = newPrice); _maxPrice = _executions.ContinuousMax(tx => tx.Price, newPrice => this.CurrentMax = newPrice); _vwap = _executions.ContinuousVwap(tx => tx.Price, tx => tx.Quantity, newVwap => this.CurrentVwap = newVwap); _simulationTimer = new Timer(1000); _simulationTimer.Elapsed += GenerateBogusData; _simulationTimer.Start(); }