Beispiel #1
0
        public async Task <IVolatilitySettings> AddAsync(IVolatilitySettings src)
        {
            try
            {
                IVolatilitySettings newSettings = await _repository.AddAsync(src);

                _log.Info("Merchant volatility settings added", newSettings.ToDetails());

                return(newSettings);
            }
            catch (DuplicateKeyException e)
            {
                _log.Error(e, context: src.ToDetails());

                throw new VolatilitySettingsAlreadyExistException(src.MerchantId);
            }
        }
Beispiel #2
0
        public async Task <IVolatilitySettings> UpdateAsync(IVolatilitySettings src)
        {
            try
            {
                if (string.IsNullOrEmpty(src.ZeroCoverageAssetPairs))
                {
                    throw new VolatilitySettingsEmptyException(src.MerchantId);
                }

                IVolatilitySettings updatedSettings = await _repository.UpdateAsync(src);

                _log.Info("Merchant volatility settings have been updated", updatedSettings.ToDetails());

                return(updatedSettings);
            }
            catch (KeyNotFoundException e)
            {
                _log.Warning("Merchant volatility settings not found", e);

                return(null);
            }
        }