public async Task InsertOrReplaceAsync(TimersSettings timersSettings) { var entity = new TimersSettingsEntity(GetPartitionKey(), GetRowKey()); Mapper.Map(timersSettings, entity); await _storage.InsertOrReplaceAsync(entity); }
protected override async Task <TimeSpan> GetDelayAsync() { TimersSettings timersSettings = await _timersSettingsService.GetAsync(); return(timersSettings.Settlements == TimeSpan.Zero ? TimeSpan.FromMinutes(5) : timersSettings.Settlements); }
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); }
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); }
public async Task <TimersSettingsModel> GetTimersSettingsAsync() { TimersSettings timersSettings = await _timersSettingsService.GetAsync(); return(Mapper.Map <TimersSettingsModel>(timersSettings)); }
protected override async Task <TimeSpan> GetDelayAsync() { TimersSettings timersSettings = await _timersSettingsService.GetAsync(); return(timersSettings.ExternalBalances); }
protected override async Task <TimeSpan> GetDelayAsync() { TimersSettings timersSettings = await _timersSettingsService.GetAsync(); return(timersSettings.InternalTrader); }
public async Task SaveAsync(TimersSettings timersSettings) { await _timersSettingsRepository.InsertOrReplaceAsync(timersSettings); _cache.Set(timersSettings); }
protected override async Task <TimeSpan> GetDelayAsync() { TimersSettings timersSettings = await _timersSettingsService.GetAsync(); return(timersSettings.MarketMaker); }
protected override async Task <TimeSpan> GetDelayAsync() { TimersSettings timersSettings = await _timersSettingsService.GetAsync(); return(timersSettings.Settlements); }
public async Task UpdateAsync(TimersSettings timersSettings, string userId) { await _timersSettingsRepository.InsertOrReplaceAsync(timersSettings); _cache.Set(timersSettings); }