mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-01-18 21:32:27 +01:00
58d9a48787
The CoinGecko rate provider is similar to the bitcoin average one, in that you can ask it for a rate from its aggregated sourcing or you can get rates from specific exchanges. I've added support for both. I haven't integrated it or replaced coinaverage just to see if we should use it as the default and switch everyone to it or what other action to take.
31 lines
963 B
C#
31 lines
963 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using BTCPayServer.Rating;
|
|
using BTCPayServer.Services.Rates;
|
|
|
|
namespace BTCPayServer.Tests.Mocks
|
|
{
|
|
public class MockRateProvider : CoinGeckoRateProvider
|
|
{
|
|
public ExchangeRates ExchangeRates { get; set; } = new ExchangeRates();
|
|
public List<AvailableRateProvider> AvailableRateProviders { get; set; } = new List<AvailableRateProvider>();
|
|
|
|
public MockRateProvider():base(null)
|
|
{
|
|
|
|
}
|
|
public override Task<ExchangeRates> GetRatesAsync(CancellationToken cancellationToken)
|
|
{
|
|
return Task.FromResult(ExchangeRates);
|
|
}
|
|
|
|
public override Task<IEnumerable<AvailableRateProvider>> GetAvailableExchanges(bool reload = false)
|
|
{
|
|
return Task.FromResult((IEnumerable<AvailableRateProvider>)AvailableRateProviders);
|
|
}
|
|
}
|
|
}
|