Example #1
0
        public void Start()
        {
            if (_isRunning)
            {
                return;
            }

            var positions = _positionSvc.GetAllPositions();

            foreach (var position in positions)
            {
                _htStocks[position.Symbol] = new Stock(position.Symbol, position.Qty, 0.0);
            }

            var prices = _pricingSvc.GetAllPrices();

            foreach (var price in prices)
            {
                var stock = _htStocks[price.Symbol];
                stock.Price = price.Price;
            }

            _positionSvc.PositionChanged += (s, p) => UpdatePositionChange(p);
            _pricingSvc.PriceChanged     += (s, p) => UpdatePriceChange(p);

            _isRunning = true;
        }