BondDetail.cs 960 B

123456789101112131415161718192021222324252627
  1. using Application.Abstractions.Messaging;
  2. using Web.Api.Common;
  3. using Web.Api.Extensions;
  4. namespace Web.Api.Endpoints.Stocks;
  5. /// <summary>채권 상세 — ISIN 기준 BondMaster(만기·표면이자율·신용등급 4사·옵션·보증) + 이자지급 + KRX 일별시세(종가·YTM) join (익명 열람). SEIBro 채권 마스터.</summary>
  6. internal sealed class BondDetail : IEndpoint
  7. {
  8. public void MapEndpoint(IEndpointRouteBuilder app)
  9. {
  10. app.MapGet("api/stocks/bonds/{isin:regex(^[A-Za-z0-9]{{12}}$)}", async (
  11. string isin,
  12. ISender sender,
  13. CancellationToken ct
  14. ) => {
  15. var result = await sender.Send(new Application.Features.Api.Stocks.GetBondDetail.Query(isin), ct);
  16. return result.Match(
  17. () => ApiResponse.Ok(result.Value),
  18. CustomResults.Problem
  19. );
  20. })
  21. .WithTags("Stocks")
  22. .AllowAnonymous();
  23. }
  24. }