stock lab 기능 구현

- 주가지수 API 연결 (KOSPI/KOSDAQ/NASDAQ 등)
 - 뉴스 카드에 키워드 하이라이트/태그 자동 추출
 - 아침 8시 스크랩” 기준 타이머/카운트다운 표시
This commit is contained in:
2026-01-26 03:05:50 +09:00
parent 9d8af6b03b
commit 07b43c48c1
4 changed files with 615 additions and 0 deletions

View File

@@ -17,6 +17,22 @@ export async function apiDelete(path) {
return res.json();
}
export async function apiPost(path, body) {
const res = await fetch(path, {
method: "POST",
headers: {
"Accept": "application/json",
...(body ? { "Content-Type": "application/json" } : {}),
},
body: body ? JSON.stringify(body) : undefined,
});
if (!res.ok) {
const text = await res.text().catch(() => "");
throw new Error(`HTTP ${res.status} ${res.statusText}: ${text}`);
}
return res.json();
}
export function getLatest() {
return apiGet("/api/lotto/latest");
}
@@ -41,3 +57,15 @@ export function getHistory(limit = 30, offset = 0) {
export function deleteHistory(id) {
return apiDelete(`/api/history/${id}`);
}
export function getStockNews(limit = 20) {
return apiGet(`/api/stock/news?limit=${limit}`);
}
export function triggerStockScrap() {
return apiPost("/api/admin/stock/scrap");
}
export function getStockHealth() {
return apiGet("/api/stock/health");
}