コード例 #1
0
 /// <summary>
 /// Checks that the factor file exists on disk, and if it does, loads it into memory
 /// </summary>
 private FactorFile GetFactorFile(Symbol symbol, string permtick, string market)
 {
     if (FactorFile.HasScalingFactors(permtick, market))
     {
         var factorFile = FactorFile.Read(permtick, market);
         _cache.AddOrUpdate(symbol, factorFile, (s, c) => factorFile);
         return(factorFile);
     }
     // return null if not found
     return(null);
 }
コード例 #2
0
        /// <summary>
        /// Checks that the factor file exists on disk, and if it does, loads it into memory
        /// </summary>
        private FactorFile GetFactorFile(Symbol symbol, string permtick, string market)
        {
            FactorFile factorFile = null;

            if (FactorFile.HasScalingFactors(permtick, market))
            {
                factorFile = FactorFile.Read(permtick, market);
                _cache.AddOrUpdate(symbol, factorFile, (s, c) => factorFile);
            }
            else
            {
                // add null value to the cache, we don't want to check the disk multiple times
                // but keep existing value if it exists, just in case
                _cache.AddOrUpdate(symbol, factorFile, (s, oldValue) => oldValue);
            }
            return(factorFile);
        }
コード例 #3
0
        /// <summary>
        /// Checks that the factor file exists on disk, and if it does, loads it into memory
        /// </summary>
        private FactorFile GetFactorFile(Symbol symbol, string permtick, string market)
        {
            FactorFile factorFile = null;

            var path = Path.Combine(Globals.CacheDataFolder, "equity", market, "factor_files", permtick.ToLowerInvariant() + ".csv");

            var factorFileStream = _dataProvider.Fetch(path);

            if (factorFileStream != null)
            {
                factorFile = FactorFile.Read(permtick, factorFileStream);
                factorFileStream.DisposeSafely();
                _cache.AddOrUpdate(symbol, factorFile, (s, c) => factorFile);
            }
            else
            {
                // add null value to the cache, we don't want to check the disk multiple times
                // but keep existing value if it exists, just in case
                _cache.AddOrUpdate(symbol, factorFile, (s, oldValue) => oldValue);
            }
            return(factorFile);
        }