Exemplo n.º 1
0
        protected async override void OnDisposing()
        {
            if (disposed)
            {
                return;
            }

            await DisconnectSocketAsync(false).ConfigureAwait(true);

            symbolsSubscription.Dispose();
            accountSubscription.Dispose();
            parametersSubscription.Dispose();

            AccountViewModel.Dispose();
            SymbolsViewModel.Dispose();
            StrategyParametersViewModel.Dispose();
            serverMonitorCacheSubscription.Dispose();

            if (StrategyDisplayViewModel != null)
            {
                strategySubscription.Dispose();
                StrategyDisplayViewModel.Dispose();
            }

            strategyAssemblyManager.Dispose();

            commandVisibilitySemaphoreSlim.Dispose();

            disposed = true;
        }
Exemplo n.º 2
0
        protected async override void OnDisposing()
        {
            if (disposed)
            {
                return;
            }

            await DisconnectSocketAsync(false);

            symbolsSubscription.Dispose();
            accountSubscription.Dispose();
            ordersSubscription.Dispose();
            parametersSubscription.Dispose();

            AccountViewModel.Dispose();
            SymbolsViewModel.Dispose();
            OrdersViewModel.Dispose();
            StrategyParametersViewModel.Dispose();
            strategyAssemblyManager.Dispose();
            serverMonitorCacheSubscription.Dispose();

            if (StrategyDisplayViewModel != null)
            {
                strategySubscription.Dispose();
                StrategyDisplayViewModel.Dispose();
            }

            disposed = true;
        }
Exemplo n.º 3
0
        public StrategyRunnerViewModel(
            ViewModelContext viewModelContext,
            AccountViewModel accountViewModel,
            SymbolsViewModel symbolsViewModel,
            OrdersViewModel ordersViewModel,
            StrategyParametersViewModel strategyParametersViewModel,
            IStrategyService strategyService,
            IServerMonitorCache serverMonitorCache,
            IStrategyAssemblyManager strategyAssemblyManager)
            : base(viewModelContext)
        {
            this.strategyService         = strategyService;
            this.serverMonitorCache      = serverMonitorCache;
            this.strategyAssemblyManager = strategyAssemblyManager;

            AccountViewModel            = accountViewModel;
            SymbolsViewModel            = symbolsViewModel;
            OrdersViewModel             = ordersViewModel;
            StrategyParametersViewModel = strategyParametersViewModel;

            CanRun       = false;
            CanMonitor   = false;
            IsConnected  = false;
            IsConnecting = false;

            Notifications = new ObservableCollection <Message>();

            RunCommand                = new ViewModelCommand(RunStrategy);
            MonitorCommand            = new ViewModelCommand(MonitorStrategy);
            DisconnectCommand         = new ViewModelCommand(Disconnect);
            StopCommand               = new ViewModelCommand(StopStrategy);
            ClearNotificationsCommand = new ViewModelCommand(ClearNotifications);

            ObserveOrders();
            ObserveSymbols();
            ObserveAccount();
            ObserveParameters();
            ObserveServerMonitorCache();
        }