Merge workers into API
This commit is contained in:
@@ -87,7 +87,6 @@ public static class ApiBootstrap
|
||||
runOrleansGrains = runOrleansGrainsFromEnv;
|
||||
}
|
||||
|
||||
|
||||
var postgreSqlConnectionString = configuration.GetSection("PostgreSql")["Orleans"];
|
||||
|
||||
return hostBuilder.UseOrleans(siloBuilder =>
|
||||
@@ -215,6 +214,7 @@ public static class ApiBootstrap
|
||||
services.AddScoped<IWorkerService, WorkerService>();
|
||||
services.AddScoped<ISynthPredictionService, SynthPredictionService>();
|
||||
services.AddScoped<ISynthApiClient, SynthApiClient>();
|
||||
services.AddScoped<IPricesService, PricesService>();
|
||||
services.AddTransient<ICommandHandler<OpenPositionRequest, Position>, OpenPositionCommandHandler>();
|
||||
services.AddTransient<ICommandHandler<ClosePositionCommand, Position>, ClosePositionCommandHandler>();
|
||||
|
||||
@@ -292,6 +292,7 @@ public static class ApiBootstrap
|
||||
|
||||
private static IServiceCollection AddWorkers(this IServiceCollection services, IConfiguration configuration)
|
||||
{
|
||||
// Balance Workers
|
||||
if (configuration.GetValue<bool>("WorkerBalancesTracking", false))
|
||||
{
|
||||
services.AddHostedService<BalanceTrackingWorker>();
|
||||
@@ -302,6 +303,63 @@ public static class ApiBootstrap
|
||||
services.AddHostedService<NotifyBundleBacktestWorker>();
|
||||
}
|
||||
|
||||
// Price Workers
|
||||
if (configuration.GetValue<bool>("WorkerPricesFifteenMinutes", false))
|
||||
{
|
||||
services.AddHostedService<PricesFifteenMinutesWorker>();
|
||||
}
|
||||
|
||||
if (configuration.GetValue<bool>("WorkerPricesOneHour", false))
|
||||
{
|
||||
services.AddHostedService<PricesOneHourWorker>();
|
||||
}
|
||||
|
||||
if (configuration.GetValue<bool>("WorkerPricesFourHours", false))
|
||||
{
|
||||
services.AddHostedService<PricesFourHoursWorker>();
|
||||
}
|
||||
|
||||
if (configuration.GetValue<bool>("WorkerPricesOneDay", false))
|
||||
{
|
||||
services.AddHostedService<PricesOneDayWorker>();
|
||||
}
|
||||
|
||||
if (configuration.GetValue<bool>("WorkerPricesFiveMinutes", false))
|
||||
{
|
||||
services.AddHostedService<PricesFiveMinutesWorker>();
|
||||
}
|
||||
|
||||
// Other Workers
|
||||
if (configuration.GetValue<bool>("WorkerSpotlight", false))
|
||||
{
|
||||
services.AddHostedService<SpotlightWorker>();
|
||||
}
|
||||
|
||||
if (configuration.GetValue<bool>("WorkerTraderWatcher", false))
|
||||
{
|
||||
services.AddHostedService<TraderWatcher>();
|
||||
}
|
||||
|
||||
if (configuration.GetValue<bool>("WorkerLeaderboard", false))
|
||||
{
|
||||
services.AddHostedService<LeaderboardWorker>();
|
||||
}
|
||||
|
||||
if (configuration.GetValue<bool>("WorkerFundingRatesWatcher", false))
|
||||
{
|
||||
services.AddHostedService<FundingRatesWatcher>();
|
||||
}
|
||||
|
||||
if (configuration.GetValue<bool>("WorkerGeneticAlgorithm", false))
|
||||
{
|
||||
services.AddHostedService<GeneticAlgorithmWorker>();
|
||||
}
|
||||
|
||||
if (configuration.GetValue<bool>("WorkerBundleBacktest", false))
|
||||
{
|
||||
services.AddHostedService<BundleBacktestWorker>();
|
||||
}
|
||||
|
||||
return services;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user