예제 #1
0
        public override async Task ExecuteAsync(object parameter)
        {
            try
            {
                SecuritiesDIM security = _priceService.GetSecurityInfo(_sysSecurityPricesVM.SelectedSecurity.Symbol, _sysSecurityPricesVM.SelectedSecurity.AssetClass.Name);
                var           results  = await _priceService.AddDailyPrices(security);

                if (results > 0)
                {
                    MessageBox.Show($"{results} prices have been saved for {_sysSecurityPricesVM.SelectedSecurity.SecurityName}", "Information");
                    await _sysSecurityPricesVM.Load();
                }
                else
                {
                    MessageBox.Show($"No new prices found for {_sysSecurityPricesVM.SelectedSecurity.SecurityName}", "Information");
                }
            }
            catch (ArgumentOutOfRangeException)
            {
                MessageBox.Show("Your API Key might not be valid. Please investigate", "Error");
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }