public BXinthPricingMonitorService(IAmAnApiService apiService, Exchange exchange, IBuilderFactory builderFactory, IServiceProvider serviceProvider) { _apiService = apiService; _exchange = exchange; _builderFactory = builderFactory; _serviceProvider = serviceProvider; }
public List <WithdrawalFee> GetWithdrawalFeesForExchange(IAmAnApiService api) { if (!_pricingContext.WithdrawalFees.Any(m => m.Key == api.Name && m.CreatedDate > DateTime.Now.AddDays(-1))) { _pricingContext.WithdrawalFees.RemoveRange(_pricingContext.WithdrawalFees.Where(m => m.Key == api.Name)); _pricingContext.SaveChanges(); var fees = api.GetWithdrawalFees(); fees.ForEach(f => { f.Key = api.Name; }); _pricingContext.WithdrawalFees.AddRange(fees); _pricingContext.SaveChanges(); } return(_pricingContext.WithdrawalFees.Where(m => m.Key == api.Name).ToList()); }
public decimal GetWithdrawalFeesForExchangeAndSymbol(IAmAnApiService api, string symbol) { if (api == null) { throw new Exception("Api cannot be null."); } var withdrawalFees = GetWithdrawalFeesForExchange(api); if (withdrawalFees == null) { throw new Exception($"No withdrawal fees found for {api.Name}."); } if (withdrawalFees.Any() && withdrawalFees.All(m => m.Symbol != symbol)) { return(GetAverageFeeForCoinAcrossExchanges(symbol)); //throw new Exception($"Cannot find withdrawal fees for {symbol} on {api.Name}."); } return(withdrawalFees.First(m => m.Symbol == symbol).Fee); }
public BittrexPricingMonitorService(IAmAnApiService apiService, IBuilderFactory builderFactory, IServiceProvider serviceProvider) { _apiService = apiService; _builderFactory = builderFactory; _serviceProvider = serviceProvider; }
public YobitPricingMonitorService(IAmAnApiService apiService, Exchange exchange, IBuilderFactory builderFactory) { _apiService = apiService; _exchange = exchange; _builderFactory = builderFactory; }
public YobitPricingMonitorService(IAmAnApiService apiService, Exchange exchange) : this(apiService, exchange, new BuilderFactory()) { }