using Application.Abstractions.Messaging; using Web.Api.Common; using Web.Api.Extensions; namespace Web.Api.Endpoints.Stocks; /// 종목 대차거래 시계열 — 단축코드(6자리) 대차잔고·외국인 대여비율 추이 (익명 열람). 종목 상세 대차 차트. SEIBro 수급 수집. internal sealed class LendingHistory : IEndpoint { public void MapEndpoint(IEndpointRouteBuilder app) { app.MapGet("api/stocks/{code:regex(^\\d{{6}}$)}/lending", async ( string code, ISender sender, DateOnly? from = null, DateOnly? to = null, int page = 1, ushort perPage = 90, CancellationToken ct = default ) => { var result = await sender.Send(new Application.Features.Api.Stocks.GetLendingHistory.Query(code, from, to, page, perPage), ct); return result.Match( () => ApiResponse.Ok(result.Value), CustomResults.Problem ); }) .WithTags("Stocks") .AllowAnonymous(); } }