Initial commit: Predictalytics solution
Clean Architecture .NET 8 solution (Domain/Application/Infrastructure/Api/Worker/WinFormsHost) for analyzing Polymarket traders for copytrading/strategy-replication candidates. Includes EF Core InitialBaseline migration and DB secrets removed from source/config in preparation for version control.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
using Predictalytics.Application.Interfaces;
|
||||
|
||||
namespace Predictalytics.Api.Endpoints;
|
||||
|
||||
public static class TraderEndpoints
|
||||
{
|
||||
public static void MapTraderEndpoints(this WebApplication app)
|
||||
{
|
||||
var group = app.MapGroup("/api/traders").WithTags("Traders");
|
||||
|
||||
group.MapGet("/", async (IAnalyticsService svc, int? skip, int? take, string? platform, CancellationToken ct) =>
|
||||
Results.Ok(await svc.GetTradersAsync(skip ?? 0, take ?? 50, platform, ct)));
|
||||
|
||||
group.MapGet("/{id:int}", async (int id, IAnalyticsService svc, CancellationToken ct) =>
|
||||
{
|
||||
var detail = await svc.GetTraderDetailAsync(id, ct);
|
||||
return detail is not null ? Results.Ok(detail) : Results.NotFound();
|
||||
});
|
||||
|
||||
group.MapGet("/{id:int}/deep-dive", async (int id, IAnalyticsService svc, CancellationToken ct) =>
|
||||
{
|
||||
var dd = await svc.GetTraderDeepDiveAsync(id, ct);
|
||||
return dd is not null ? Results.Ok(dd) : Results.NotFound();
|
||||
});
|
||||
|
||||
group.MapPost("/{id:int}/priority", async (int id, int? score, IScoringService svc, CancellationToken ct) =>
|
||||
{
|
||||
await svc.SetManualOverrideAsync(id, score, ct);
|
||||
return Results.Ok();
|
||||
});
|
||||
|
||||
group.MapPost("/{id:int}/refresh", async (int id, IAnalyticsService svc, CancellationToken ct) =>
|
||||
{
|
||||
await svc.TriggerTradeSyncAsync(id, ct);
|
||||
return Results.Ok();
|
||||
});
|
||||
|
||||
group.MapPost("/", async (string platform, string wallet, IAnalyticsService svc, CancellationToken ct) =>
|
||||
{
|
||||
var id = await svc.AddTraderAsync(platform, wallet, ct);
|
||||
return Results.Ok(new { id });
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user