public WatchListViewModel(IApplicationCore core)
        {
            Core             = core;
            _historyRequests = new List <Tuple <string, string, string> >();

            DataFeeds          = new ObservableCollection <string>(Core.DataManager.DatafeedList);
            _subscribedSymbols = new List <Security>();
            Items = new ObservableCollection <IWatchItem>();
            Items.CollectionChanged += ItemsCollectionChanged;

            PlaceOrderCommand     = new RelayCommand(PlaceOrderCommandExecute, () => IsItemSelected && Core.DataManager.Broker.IsActive);
            AddToDepthViewCommand = new RelayCommand(AddToDepthViewCommandExecute, IsItemSelected);
            RemoveSelectedCommand = new RelayCommand(RemoveSelectedCommandExecute, IsItemSelected);
            RemoveCurrentCommand  = new RelayCommand <IWatchItem>(RemoveCurrentCommandExecute);
            ExportCommand         = new RelayCommand(ExportCommandExecute);
            ImportCommand         = new RelayCommand(ImportCommandExecute);

            core.DataManager.OnNewTick          += OnNewQuote;
            core.DataManager.OnHistoryDataReady += OnHistoricalData;
            EnsureAddEmptyItem();

            DateCol    = true;
            BidCol     = true;
            AskCol     = true;
            BidSizeCol = false;
            AskSizeCol = false;
            PriceCol   = true;
            OpenCol    = false;
            HighCol    = false;
            LowCol     = false;
        }
Beispiel #2
0
        public LauncherForm(IApplicationCore AppCore)
        {
            this.AppCore = AppCore;

            PageStack = new Stack<Uri>();

            InitializeComponent();

            if (!WebCore.IsInitialized)
            {
                WebCore.Initialize(new WebConfig() {
                    HomeURL = new Uri(@"asset://bzlauncher/home"),
                    LogLevel = LogLevel.None,
                    RemoteDebuggingHost = @"127.0.0.1",
                    RemoteDebuggingPort = 8001
                }, true);
            }
            session = WebCore.CreateWebSession(@".\SessionDataPath", WebPreferences.Default);

            DataSource = new LauncherDataSource();
            ResourceInterceptor = new LauncherResourceInterceptor();

            session.AddDataSource("bzlauncher", DataSource);
            WebCore.ResourceInterceptor = ResourceInterceptor;
        }
Beispiel #3
0
        public LogViewModel(IApplicationCore core)
        {
            Core  = core;
            Items = new ObservableCollection <ILogItem>(LogManager.Items.ToList());

            LogManager.OnNew += LogManager_OnNew;
            ClearLogsCommand  = new RelayCommand(() => Items.Clear(), () => Items.Count > 0);
        }
        public ReconnectViewModel(IApplicationCore core, string reason, bool allowReconnect = true)
        {
            Core           = core;
            Message        = reason;
            AllowReconnect = allowReconnect;

            OkCommand     = new RelayCommand(OkCommandExecution, () => AllowReconnect);
            CancelCommand = new RelayCommand(() => DialogResult = false);
        }
 public LoginViewModel(IApplicationCore core)
 {
     Core          = core;
     Host          = core.Settings.HostAddress;
     Port          = core.Settings.Port;
     UserName      = core.Settings.UserName;
     LoginCommand  = new RelayCommand(CancelCommandExecute, () => !_isWait);
     CancelCommand = new RelayCommand(() => DialogResult = false);
 }
        public ScriptingLogViewModel(IApplicationCore core)
        {
            Core = core;
            Core.ScriptingLogManager.OnNewLogMessage += ScriptiongLogManagerOnLogMessage;

            LogItems = new ObservableCollection <ScriptingLogItem>();

            ClearCommand = new RelayCommand(() => LogItems.Clear(), () => LogItems.Count > 0);
        }
Beispiel #7
0
        public CreateSimulatedAccountViewModel(IApplicationCore core, AvailableBrokerInfo brokerInfo)
        {
            Core        = core;
            _brokerInfo = brokerInfo;
            Account     = new CreateSimulatedBrokerAccountInfoItem(brokerInfo.BrokerName)
            {
                Currencies = new ObservableCollection <string>(Core.DataManager.Broker.AvailableCurrencies)
            };

            CreateCommand = new RelayCommand(CreateCommandExecute);
            CancelCommand = new RelayCommand(CancelCommandExecute);
        }
        public AlertBaseViewModel(IApplicationCore c, string scriptingId)
        {
            Core      = c;
            _scriptId = scriptingId;
            Items     = GetCollections();
            if (Items.Count > 0)
            {
                SelectedItem = Items.First();
            }

            CopyAllCommand  = new RelayCommand(() => CopyAll(), () => Items.Count > 0);
            ClearAllCommand = new RelayCommand(() => Core.ViewFactory.BeginInvoke(() => ClearAll()), () => Items.Count > 0);
            CloseCommand    = new RelayCommand(() => DialogResult = false);
        }
Beispiel #9
0
        public SignalsManagerViewModel(IApplicationCore core, IMainViewModel mainView)
        {
            Core      = core;
            _mainView = mainView;

            StartCommand = new RelayCommand <Signal>(StartSignal);
            PauseCommand = new RelayCommand <Signal>(PauseSignal);
            StopCommand  = new RelayCommand <Signal>(StopSignal);
            ShowBacktestSettingsCommand = new RelayCommand <Signal>(ShowBacktestSettings);
            ShowParamSpaceCommand       = new RelayCommand <Signal>(ShowParamSpace);
            ShowBacktestResultsCommand  = new RelayCommand <Signal>(ShowBacktestResultsView);
            ShowOutputCommand           = new RelayCommand <Signal>(s => _mainView?.ShowOutputPopup(s.FullName));
            ShowAlertsCommand           = new RelayCommand <Signal>(s => _mainView?.ShowAlertsPopup(s.FullName));

            Core.DataManager.OnPortfolioChanged += (s, e) => OnPropertyChanged("Signals");
            Core.DataManager.ScriptingManager.SignalInstanceUpdated += (s, e) => RefreshSignal(e.Value);
        }
        public SelectBrokerAccountViewModel(IApplicationCore core)
        {
            Core = core;

            Accounts = new ObservableCollection <AccountInfo>(Core.DataManager.Broker.ActiveAccounts);
            if (Accounts.Count > 0)
            {
                SelectedAccount = Accounts[0];
            }

            OkCommand = new RelayCommand(() =>
            {
                DialogResult = true;
            }, () => SelectedAccount != null);

            CancelCommand = new RelayCommand(() =>
            {
                DialogResult = false;
            });
        }
Beispiel #11
0
        public MainViewModel(IApplicationCore core)
        {
            Core = core;
            Core.DataManager.Broker.OnAccountStateChanged += BrokerOnOnAccountStateChanged;

            _alertsVMs                   = new Dictionary <string, AlertViewModel>();
            _signalOutputVMs             = new Dictionary <string, SignalOutputViewModel>();
            Documents                    = new ObservableCollection <IDocumentViewModel>();
            Documents.CollectionChanged += Documents_CollectionChanged;

            Messenger.Default.Register <CloseDocumentMessage>(this, CloseDocumenntMessage);

            core.DataManager.OnConnectionStatusChanged         += DataManagerOnConnectionStatusChanged;
            core.DataManager.OnDataFeedMessage                 += DatamanagerOnDataFeedMessage;
            core.DataManager.ScriptingManager.ScriptingMessage += OnScriptingMessage;
            core.ScriptingNotificationManager.NewNotification  += OnNewNotification;
            core.ScriptingLogManager.OnNewLogMessage           += OnNewLogMessage;
            core.ViewFactory.DepthViewAdded += ViewFactoryOnDepthViewAdded;

            IsTradingAllowed = Core.DataManager.Broker.IsActive;
        }
        public ScriptingSetupViewModel(IApplicationCore c, ScriptingType type)
        {
            Core           = c;
            _scriptingType = type;

            switch (_scriptingType)
            {
            case ScriptingType.Signal:
                Settings = new SignalSettings();
                break;

            case ScriptingType.Indicator:
                Settings = new IndicatorSettings();
                break;
            }

            Title = $"{Settings.ScriptType} Setup";

            OkCommand              = new RelayCommand(OkCommandExecute);
            CancelCommand          = new RelayCommand(CancelCommandExecute);
            RemoveParameterCommand = new RelayCommand <ScriptingParameter>(RemoveParameterExecute);
            AddSeriesCommand       = new RelayCommand(AddSeriesCommandExecute);
            RemoveSeriesCommand    = new RelayCommand <SeriesSettings>(RemoveSeriesCommandExecute);
        }
Beispiel #13
0
 public SignalOutputViewModel(IApplicationCore c, string scriptingId) :
     base(c, scriptingId)
 {
 }
Beispiel #14
0
 public AppInstanceConfigurer RegisterApplicationCore(IApplicationCore service)
 {
     s_ApplicationCore = service;
     return(this);
 }
 public AlertViewModel(IApplicationCore c, string scriptingID) :
     base(c, scriptingID)
 {
 }
 public AccountsViewModel(IApplicationCore core)
 {
     Accounts = core.DataManager.Broker.ActiveAccounts;
 }