indicators / prices batch API: limit=N 단독 호출 시 historical 시작점 반환 (start_date 미지정) #69

Closed
opened 2026-04-26 21:08:09 +09:00 by xhh · 1 comment
Owner

증상

/api/indicators/{symbol}?limit=N 을 단독 호출하면 1959년 등 historical 시작점 근처 데이터가 반환됨. 최신 데이터를 받으려면 start_date 명시 필수.

배치 가격 API (/api/prices/batch/...) 도 동일 — start_date 미지정 시 매우 오래된 날짜의 가격을 반환.

발견 경위

claude-plugin macro-report 시범 전환 (#6) 의 첫 A/B 측정 (2026-04-26 liquidity) 중 발견.

  • M2SL?limit=8 → 1959년 데이터
  • /api/prices/batch/^VIX,DX-Y.NYB,BTC-USD,IBIT,GC=F → 매우 오래된 날짜의 가격 반환

scanner 가 limit 만 믿고 호출했다가 보고서에 1959년 값이 흘러들어갈 위험. 현재는 우회 (모든 호출에 start_date 명시) 로 처리했지만, 의미적으로 limit=N 단독은 "최근 N개" 가 자연스러우므로 서버 측 동작을 직관적으로 맞춰주는 게 좋음.

기대 동작

  • limit=N 단독 → 최신 N개 반환 (현재 동작과 정반대)
  • 또는 명시적 에러 — start_date / end_date 가 없으면 400 으로 거부

제안

  1. limit 만 있고 날짜 인자 없을 때 default start_date = end_date - reasonable_window (예: 1년) 자동 적용
  2. 또는 응답을 ORDER BY date DESC 후 LIMIT 으로 변경
  3. 배치 가격 API 도 동일 정책

관련

  • claude-plugin PR #3 — 첫 A/B 측정 결과
  • #6 — 시범 전환 본 작업
  • #7 — 토큰 절감 측정
## 증상 `/api/indicators/{symbol}?limit=N` 을 단독 호출하면 1959년 등 historical 시작점 근처 데이터가 반환됨. 최신 데이터를 받으려면 `start_date` 명시 필수. 배치 가격 API (`/api/prices/batch/...`) 도 동일 — `start_date` 미지정 시 매우 오래된 날짜의 가격을 반환. ## 발견 경위 claude-plugin macro-report 시범 전환 (#6) 의 첫 A/B 측정 (2026-04-26 liquidity) 중 발견. - `M2SL?limit=8` → 1959년 데이터 - `/api/prices/batch/^VIX,DX-Y.NYB,BTC-USD,IBIT,GC=F` → 매우 오래된 날짜의 가격 반환 scanner 가 limit 만 믿고 호출했다가 보고서에 1959년 값이 흘러들어갈 위험. 현재는 우회 (모든 호출에 `start_date` 명시) 로 처리했지만, 의미적으로 `limit=N` 단독은 "최근 N개" 가 자연스러우므로 서버 측 동작을 직관적으로 맞춰주는 게 좋음. ## 기대 동작 - `limit=N` 단독 → **최신 N개** 반환 (현재 동작과 정반대) - 또는 명시적 에러 — `start_date` / `end_date` 가 없으면 400 으로 거부 ## 제안 1. `limit` 만 있고 날짜 인자 없을 때 default `start_date = end_date - reasonable_window` (예: 1년) 자동 적용 2. 또는 응답을 ORDER BY date DESC 후 LIMIT 으로 변경 3. 배치 가격 API 도 동일 정책 ## 관련 - claude-plugin [PR #3](https://github.com/elhaz/claude-plugin/pull/3) — 첫 A/B 측정 결과 - #6 — 시범 전환 본 작업 - #7 — 토큰 절감 측정
Author
Owner

#68 과 동일 내용 중복 제출. #68 에서 진행.

#68 과 동일 내용 중복 제출. #68 에서 진행.
xhh closed this issue 2026-04-26 21:15:22 +09:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
xhh/financial-data-platform#69
No description provided.