예제 #1
0
        internal void UpdateEstimatedProfit(Dictionary <AlgorithmType, double> profits)
        {
            _updateEstimatedProfitCalled = true;
            if (profits == null)
            {
                return;
            }
            var containedIDs = profits.Keys.Where(key => IDs.Contains(key)).ToArray();

            EstimatedProfitAllSMAPresent        = IDs.Length == containedIDs.Length;
            EstimatedProfitAllSMAPositiveOrZero = EstimatedProfitAllSMAPresent && IDs.All(id => profits[id] >= 0);

            // clear old values
            _lastEstimatedProfitSMA.Clear();
            foreach (var id in containedIDs)
            {
                _lastEstimatedProfitSMA[id] = profits[id];
            }

            // notify changed
            OnPropertyChanged(nameof(CurrentEstimatedProfit));
            OnPropertyChanged(nameof(CurrentEstimatedProfitStr));
            OnPropertyChanged(nameof(Status));
        }