예제 #1
0
        private async Task GetSymbols()
        {
            try
            {
                if (symbolsCache == null)
                {
                    symbolsCache = symbolsCacheFactory.GetSymbolsCache(AccountPreferences.Exchange);
                    symbolsCache.OnSymbolsCacheException += SymbolsCacheException;
                }

                var results = await symbolsCache.GetSymbols(AccountPreferences.Preferences.FavouriteSymbols);

                Symbols = new List <Symbol>(results);

                SetPreferences();
            }
            catch (Exception ex)
            {
                OnException("SymbolsViewModel.GetSymbols", ex);
            }
            finally
            {
                IsLoadingSymbols = false;
            }
        }
예제 #2
0
        public async Task GetSymbols(Strategy arg)
        {
            IsLoadingSymbols = true;

            try
            {
                Strategy = arg;

                if (symbolsCache == null)
                {
                    symbolsCache = symbolsCacheFactory.GetSymbolsCache(Strategy.StrategySubscriptions.First().Exchange);

                    symbolsCache.OnSymbolsCacheException += SymbolsCacheException;
                }

                var strategySymbols = Strategy.StrategySubscriptions.Select(s => s.Symbol);

                var results = await symbolsCache.GetSymbols(strategySymbols);

                Symbols = new List <Symbol>(results.Where(r => strategySymbols.Contains($"{r.ExchangeSymbol}")));

                SymbolsNotification();
            }
            catch (Exception ex)
            {
                OnException($"SymbolsViewModel.GetSymbols {ex.Message}", ex);
            }

            IsLoadingSymbols = false;
        }
예제 #3
0
        private async Task GetSymbols()
        {
            try
            {
                if (symbolsCache == null)
                {
                    symbolsCache = symbolsCacheFactory.GetSymbolsCache(AccountPreferences.Exchange);
                    symbolsCache.OnSymbolsCacheException += SymbolsCacheException;
                }

                var results = await symbolsCache.GetSymbols(AccountPreferences.Preferences.FavouriteSymbols).ConfigureAwait(true);

                results.ForEach(Symbols.Add);

                OnLoadedSymbols(Symbols.ToList());

                SetPreferences();
            }
            catch (Exception ex)
            {
                OnException($"{nameof(SymbolsViewModel)} - {ex.Message}", ex);
            }
            finally
            {
                IsLoadingSymbols = false;
            }
        }
예제 #4
0
        private async Task GetSymbols()
        {
            IsLoadingSymbols = true;

            try
            {
                symbolsCache.OnSymbolsCacheException += SymbolsCacheException;

                var results = await symbolsCache.GetSymbols();

                Symbols = new List <Symbol>(results);

                SetPreferences();
            }
            catch (Exception ex)
            {
                OnException("SymbolsViewModel.GetSymbols", ex);
            }

            IsLoadingSymbols = false;
        }