feat: add stock indices scraping and update healthcheck

This commit is contained in:
2026-01-26 03:14:46 +09:00
parent d8e4e0461c
commit 94db1da045
3 changed files with 76 additions and 5 deletions

View File

@@ -3,7 +3,7 @@ from fastapi import FastAPI
from apscheduler.schedulers.background import BackgroundScheduler
from .db import init_db, save_articles, get_latest_articles
from .scraper import fetch_market_news
from .scraper import fetch_market_news, fetch_major_indices
app = FastAPI()
scheduler = BackgroundScheduler(timezone=os.getenv("TZ", "Asia/Seoul"))
@@ -36,6 +36,11 @@ def get_news(limit: int = 20):
"""최신 주식 뉴스 조회"""
return get_latest_articles(limit)
@app.get("/api/stock/indices")
def get_indices():
"""주요 지표(KOSPI 등) 실시간 크롤링 조회"""
return fetch_major_indices()
@app.post("/api/admin/stock/scrap")
def trigger_scrap():
"""수동 스크랩 트리거"""