docker files fixes from liaqat
This commit is contained in:
40
src/Managing.Api.Workers/Workers/PricesBaseWorker.cs
Normal file
40
src/Managing.Api.Workers/Workers/PricesBaseWorker.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using Managing.Application.Workers.Abstractions;
|
||||
using static Managing.Common.Enums;
|
||||
|
||||
namespace Managing.Api.Workers.Workers;
|
||||
|
||||
public abstract class PricesBaseWorker<T> : BaseWorker<T> where T : class
|
||||
{
|
||||
private readonly IPricesService _pricesService;
|
||||
private readonly IStatisticService _statisticService;
|
||||
private readonly Timeframe _timeframe;
|
||||
|
||||
public PricesBaseWorker(
|
||||
ILogger<T> logger,
|
||||
IPricesService pricesService,
|
||||
IWorkerService workerService,
|
||||
IStatisticService statisticService,
|
||||
TimeSpan delay,
|
||||
WorkerType workerType,
|
||||
Timeframe timeframe) : base(
|
||||
workerType,
|
||||
logger,
|
||||
delay,
|
||||
workerService
|
||||
)
|
||||
{
|
||||
_pricesService = pricesService;
|
||||
_statisticService = statisticService;
|
||||
_timeframe = timeframe;
|
||||
}
|
||||
|
||||
protected override async Task Run(CancellationToken cancellationToken)
|
||||
{
|
||||
var tickers = _statisticService.GetTickers();
|
||||
|
||||
foreach (var ticker in tickers)
|
||||
{
|
||||
await _pricesService.UpdatePrice(TradingExchanges.Evm, ticker, _timeframe);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user