feat: add stock indices scraping and update healthcheck
This commit is contained in:
@@ -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():
|
||||
"""수동 스크랩 트리거"""
|
||||
|
||||
Reference in New Issue
Block a user