Ejemplo n.º 1
0
 public CrossRateCalcInfosService(ISettingsRootService settingsRootService,
                                  IDependentCrossRatesService dependentCrossRatesService)
 {
     _settingsRootService        = settingsRootService;
     _dependentCrossRatesService = dependentCrossRatesService;
     _dependentAssetPairs        = DependentAssetPairsCache();
 }
Ejemplo n.º 2
0
 public AssetPairsInfoService(ISystem system, IAssetsService assetsService, IConvertService convertService)
 {
     _system         = system;
     _assetsService  = assetsService;
     _convertService = convertService;
     _assetPairs     = GetAssetPairsCache();
 }
Ejemplo n.º 3
0
        public void Remove(string assetPairId)
        {
            _readerWriterLockSlim.EnterWriteLock();

            try
            {
                if (_assetPairs.ContainsKey(assetPairId))
                {
                    _assetPairs.Remove(assetPairId);
                    _assetPairsByAssets = GetAssetPairsByAssetsCache();
                    _assetPairsIds      = Calculate.Cached(() => _assetPairs, CacheChangedCondition, p => p.Keys.ToImmutableHashSet());
                }
            }
            finally
            {
                _readerWriterLockSlim.ExitWriteLock();
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Adds new item item if does not exist, otherwise updates
        /// </summary>
        /// <param name="assetPair"></param>
        /// <returns>true if added, false if updated</returns>
        public bool AddOrUpdate(IAssetPair assetPair)
        {
            _readerWriterLockSlim.EnterWriteLock();
            var itemExists = _assetPairs.ContainsKey(assetPair.Id);

            try
            {
                if (itemExists)
                {
                    _assetPairs.Remove(assetPair.Id);
                }

                _assetPairs.Add(assetPair.Id, assetPair);

                _assetPairsByAssets = GetAssetPairsByAssetsCache();
                _assetPairsIds      = Calculate.Cached(() => _assetPairs, CacheChangedCondition, p => p.Keys.ToImmutableHashSet());

                return(!itemExists);
            }
            finally
            {
                _readerWriterLockSlim.ExitWriteLock();
            }
        }
Ejemplo n.º 5
0
 public AssetPairsCache()
 {
     _assetPairsByAssets = GetAssetPairsByAssetsCache();
     _assetPairsIds      = Calculate.Cached(() => _assetPairs, ReferenceEquals, p => p.Keys.ToImmutableHashSet());
 }
Ejemplo n.º 6
0
 public AssetPairsCache()
 {
     _assetPairsByAssets = GetAssetPairsByAssetsCache();
     _assetPairsIds      = Calculate.Cached(() => _assetPairs, CacheChangedCondition, p => p.Keys.ToImmutableHashSet());
 }
Ejemplo n.º 7
0
 public DayOffSettingsService(IDayOffSettingsRepository dayOffSettingsRepository, IAssetPairsCache assetPairsCache)
 {
     _dayOffSettingsRepository = dayOffSettingsRepository;
     _assetPairsCache          = assetPairsCache;
     _exclusionsByAssetPairId  = GetExclusionsByAssetPairIdCache();
 }