Ejemplo n.º 1
0
        public MainWindowViewModel()
        {
            PortIb           = Convert.ToInt32(Configuration.Instance["PortIb"]);
            ConnectionString = Configuration.Instance["ConnectionString"];
            LogSymbols.Add("Willkommen! Enjoy the day (-:");
            LogFundamentals.Add("Willkommen! Enjoy the day (-:");
            BackgroundLog = Brushes.White;

            InitDatesCombobok();
            InitExchangeCombobox();
            InitExchangeFmpCombobox();

            UpdateDbState();
            InventoryText = GenerateInventoryText();
            SelectTop1000 = true;
            UpdateCompaniesForFundamenatals(SelectTop1000);

            CommandConnectToIb        = new RelayCommand(async(p) => await CommandConnectToIbAsync(p));
            CommandImportContracts    = new RelayCommand(async(p) => await CommandImportContractsAsync(p));
            CommandImportFundamentals = new RelayCommand(async(p) => await CommandImportFundamentalsAsync(p));

            IbClient.Instance.NextValidId      += ResponseHandlerNextValidId;
            IbClient.Instance.ConnectionClosed += ResponseHandlerConnectionClosed;
            IbClient.Instance.SymbolSamples    += ResponseHandlerSymbolSamples;
            IbClient.Instance.FundamentalData  += ResponseHandlerFundamentalData;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// ResponseHandlerNextValidId
        /// </summary>
        /// <param name="obj"></param>
        private void ResponseHandlerNextValidId(IBSampleApp.messages.ConnectionStatusMessage obj)
        {
            BackgroundLog = Brushes.White;
            var message = string.Empty;

            if (obj.IsConnected)
            {
                ConnectedToIb = true;
                message       = "OK! Connected to IB server.";
            }
            else
            {
                ConnectedToIb = false;
                message       = "ERROR! error connecting to IB server.";
            }

            LogSymbols.Add(message);
            LogFundamentals.Add(message);
        }