public async Task <TimersSettings> GetAsync()
        {
            TimersSettings timersSettings = _cache.Get(CacheKey);

            if (timersSettings == null)
            {
                timersSettings = await _timersSettingsRepository.GetAsync() ?? new TimersSettings();

                if (timersSettings.MarketMaker == TimeSpan.Zero)
                {
                    timersSettings.MarketMaker = TimeSpan.FromSeconds(5);
                }

                if (timersSettings.Hedging == TimeSpan.Zero)
                {
                    timersSettings.Hedging = TimeSpan.FromSeconds(1);
                }

                if (timersSettings.LykkeBalances == TimeSpan.Zero)
                {
                    timersSettings.LykkeBalances = TimeSpan.FromSeconds(1);
                }

                if (timersSettings.ExternalBalances == TimeSpan.Zero)
                {
                    timersSettings.ExternalBalances = TimeSpan.FromSeconds(1);
                }

                if (timersSettings.Settlements == TimeSpan.Zero)
                {
                    timersSettings.Settlements = TimeSpan.FromSeconds(5);
                }

                if (timersSettings.InternalTrader == TimeSpan.Zero)
                {
                    timersSettings.InternalTrader = TimeSpan.FromSeconds(5);
                }

                if (timersSettings.PnLStopLoss == TimeSpan.Zero)
                {
                    timersSettings.PnLStopLoss = TimeSpan.FromSeconds(1);
                }

                _cache.Initialize(new[] { timersSettings });
            }

            return(timersSettings);
        }
        public async Task <TimersSettings> GetAsync()
        {
            TimersSettings timersSettings = _cache.Get(CacheKey);

            if (timersSettings == null)
            {
                timersSettings = await _timersSettingsRepository.GetAsync();

                if (timersSettings == null)
                {
                    timersSettings = new TimersSettings
                    {
                        MarketMaker = TimeSpan.FromSeconds(5),
                        Balances    = TimeSpan.FromSeconds(1)
                    };
                }

                _cache.Initialize(new[] { timersSettings });
            }

            return(timersSettings);
        }
Exemplo n.º 3
0
        public async Task <TimersSettings> GetAsync()
        {
            TimersSettings timersSettings = _cache.Get(CacheKey);

            if (timersSettings == null)
            {
                timersSettings = await _timersSettingsRepository.GetAsync();

                if (timersSettings == null)
                {
                    timersSettings = new TimersSettings
                    {
                        LykkeBalances    = TimeSpan.FromSeconds(10),
                        ExternalBalances = TimeSpan.FromSeconds(10),
                        Settlements      = TimeSpan.FromMinutes(5)
                    };
                }

                _cache.Initialize(new[] { timersSettings });
            }

            return(timersSettings);
        }