Add tracking for analyzed traders and add crawling configuration to appsettings.json

This commit is contained in:
Richard
2026-07-07 09:45:51 +02:00
parent 2c7c643fdb
commit 910d25159a
8 changed files with 47 additions and 2 deletions
@@ -5,6 +5,7 @@ using Predictalytics.Infrastructure.Logging;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Configuration;
namespace Predictalytics.Worker.Services;
@@ -96,6 +97,15 @@ public class TradeHistoryWorker : BackgroundService
var provider = providers.FirstOrDefault(p => p.Platform == trader.Platform && p.IsImplemented);
if (provider == null) return;
var config = scope.ServiceProvider.GetRequiredService<Microsoft.Extensions.Configuration.IConfiguration>();
bool isEnabled = config.GetValue<bool>($"PlatformSettings:{provider.PlatformName}:EnableCrawling", provider.Platform == PlatformType.Polymarket);
if (!isEnabled)
{
trader.LastPolledAt = DateTime.UtcNow;
await traderRepo.UpdateAsync(trader, ct);
return;
}
using var platformCtx = PlatformLogContext.Push(provider.PlatformName);
await rateLimiter.WaitAsync(trader.Platform, ct);