ForeignCustody.cs 1.0 KB

123456789101112131415161718192021222324252627282930
  1. using Application.Abstractions.Messaging;
  2. using Web.Api.Common;
  3. using Web.Api.Extensions;
  4. namespace Web.Api.Endpoints.Market;
  5. /// <summary>외화증권 국가별 보관금액 추이 — 서학개미 위젯용. 국가·종목구분·기간 필터 (익명 열람). SEIBro getNationFrsecCusInfo 수집.</summary>
  6. internal sealed class ForeignCustody : IEndpoint
  7. {
  8. public void MapEndpoint(IEndpointRouteBuilder app)
  9. {
  10. app.MapGet("api/market/foreign-custody", async (
  11. ISender sender,
  12. string? nation = null,
  13. string? secnTpcd = null,
  14. DateOnly? from = null,
  15. DateOnly? to = null,
  16. CancellationToken ct = default
  17. ) => {
  18. var result = await sender.Send(new Application.Features.Api.Stocks.GetForeignCustody.Query(nation, secnTpcd, from, to), ct);
  19. return result.Match(
  20. () => ApiResponse.Ok(result.Value),
  21. CustomResults.Problem
  22. );
  23. })
  24. .WithTags("Market")
  25. .AllowAnonymous();
  26. }
  27. }