示例#1
0
        public List <CompanyStatsIEX> GetCachedCompaniesIEX()
        {
            List <CompanyStatsIEX> cachedCompanies = new List <CompanyStatsIEX>();

            HashSet <string> cachedSymbols = _cache.GetCachedSymbols("iex-companies");

            foreach (string cacheKey in cachedSymbols)
            {
                CompanyStatsIEX company = (CompanyStatsIEX)_cache.Get(cacheKey);
                if (company != null)
                {
                    cachedCompanies.Add(company);
                }
            }
            return(cachedCompanies);
        }
示例#2
0
        //Investors Exchange Company Cache Entry Update Routine
        //DEPRECATED
        public void UpdateIEXCompanyCacheEntry(object key, object value, EvictionReason reason, object state = null)
        {
            try
            {
                Stopwatch sw       = new Stopwatch(); sw.Start();
                string    cacheKey = (string)key;
                string    channel  = cacheKey.Split('-')[0];
                string    symbol   = cacheKey.Split('-')[2];

                //Remove before updating and re-adding
                RemoveCachedSymbol(cacheKey);

                CompanyStatsIEX companyStats = new CompanyStatsIEX(); //IEX.GetCompanyStatsAsync(symbol).Result;

                //Save IEX Company to cache
                this.Add(companyStats, cacheKey);
                string perf = sw.ElapsedMilliseconds.ToString();
            }
            catch (Exception e)
            {
                Debug.WriteLine("ERROR UpdateIEXCompanyCacheEntry: " + e.Message);
            }
        }