public MovingAverageViewModel(WpfStrategy strategy, IHelperFactoryContainer iHelperFactoryContainer,
                                      Dispatcher UiDispatcher, ILoggerFacade logger)
            : base(strategy, iHelperFactoryContainer, UiDispatcher, logger)
        {
            var chartHelper = ServiceLocator.Current.GetInstance <IChartHelper>();

            TimeFormatter  = chartHelper.TimeFormatter;
            PriceFormatter = chartHelper.PriceFormatter;

            IsActive           = false;
            IsLoadingTrades    = true;
            IsLoadingOrderBook = true;

            cancellationTokenSource = new CancellationTokenSource();

            tradeHelperFactory = HelperFactoryContainer.GetFactory <ITradeHelperFactory>();

            orderBookHelperFactory = HelperFactoryContainer.GetFactory <IOrderBookHelperFactory>();

            ShowCandlesticks = Strategy.StrategySubscriptions.Any(s => s.SubscribeCandlesticks);

            Trades             = new List <Trade>();
            TradesChart        = new ChartValues <Trade>();
            SmaTradesChart     = new ChartValues <Trade>();
            BuyIndicatorChart  = new ChartValues <Trade>();
            SellIndicatorChart = new ChartValues <Trade>();
            CandlesticksChart  = new ChartValues <Candlestick>();
            CandlestickLabels  = new ObservableCollection <string>();
        }
Beispiel #2
0
        public MovingAverageViewModel(WpfStrategy strategy, IHelperFactoryContainer iHelperFactoryContainer,
                                      Dispatcher UiDispatcher, ILoggerFacade logger)
            : base(strategy, iHelperFactoryContainer, UiDispatcher, logger)
        {
            var chartHelper = ServiceLocator.Current.GetInstance <IChartHelper>();

            TimeFormatter  = chartHelper.TimeFormatter;
            PriceFormatter = chartHelper.PriceFormatter;

            IsActive           = false;
            IsLoadingTrades    = true;
            IsLoadingOrderBook = true;

            cancellationTokenSource = new CancellationTokenSource();

            var tradeHelperFactory = HelperFactoryContainer.GetFactory <ITradeHelperFactory>();

            tradeHelper = tradeHelperFactory.GetTradeHelper();

            orderBookHelperFactory = HelperFactoryContainer.GetFactory <IOrderBookHelperFactory>();

            ShowCandlesticks = Strategy.StrategySubscriptions.Any(s => s.SubscribeCandlesticks);
        }