이번 세션 외 그간 쌓인 변경 일괄 저장: - bareunaapi: finance_dict 금융용어 / stock_loader 종목 로더 보강 - kis-api: 키움 토큰·수집 로직 - us-market / dart-collector: 수집 보강 - docker-compose: GEMINI_API_KEY 등 환경변수 추가 - score-engine/news-collector requirements, CLAUDE.md - 신규: PROJECT.md, news-collector/sentiment_rules.py Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -578,6 +578,8 @@ async def collect_financials_for_top_stocks(count: int = 300, years: int = 2, an
|
||||
"부채총계": ("부채총계",),
|
||||
"자본총계": ("자본총계",),
|
||||
"영업활동현금흐름": ("영업활동현금흐름", "영업활동으로 인한 현금흐름"),
|
||||
"자기주식취득": ("자기주식의 취득", "자기주식의취득",
|
||||
"자기주식 취득", "자기주식취득"),
|
||||
}
|
||||
key_items: dict = {}
|
||||
for item in items:
|
||||
@@ -628,14 +630,14 @@ async def save_financial(
|
||||
revenue, operating_profit, net_income, total_assets,
|
||||
total_liabilities, total_equity, operating_cashflow,
|
||||
roe, operating_margin, net_margin, debt_ratio, fcf_ratio, revenue_growth,
|
||||
collected_at)
|
||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20)
|
||||
treasury_acquired, collected_at)
|
||||
VALUES ($1,$2,$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16,$17,$18,$19,$20,$21)
|
||||
ON CONFLICT (stock_code, bsns_year, reprt_code) DO UPDATE SET
|
||||
revenue=$7, operating_profit=$8, net_income=$9,
|
||||
total_assets=$10, total_liabilities=$11, total_equity=$12,
|
||||
operating_cashflow=$13, roe=$14, operating_margin=$15,
|
||||
net_margin=$16, debt_ratio=$17, fcf_ratio=$18, revenue_growth=$19,
|
||||
collected_at=$20
|
||||
treasury_acquired=$20, collected_at=$21
|
||||
""",
|
||||
stock_code, corp_code, corp_name, bsns_year, reprt_code, reprt_name,
|
||||
key_items.get("매출액", 0),
|
||||
@@ -651,6 +653,7 @@ async def save_financial(
|
||||
ratios.get("debt_ratio", 0.0),
|
||||
ratios.get("fcf_ratio", 0.0),
|
||||
ratios.get("revenue_growth", 0.0),
|
||||
abs(key_items.get("자기주식취득", 0)),
|
||||
datetime.now(),
|
||||
)
|
||||
except Exception as e:
|
||||
@@ -1033,6 +1036,7 @@ async def init_db():
|
||||
""")
|
||||
await conn.execute("CREATE INDEX IF NOT EXISTS idx_fin_stock ON dart_financials(stock_code)")
|
||||
await conn.execute("CREATE INDEX IF NOT EXISTS idx_fin_year ON dart_financials(bsns_year DESC)")
|
||||
await conn.execute("ALTER TABLE dart_financials ADD COLUMN IF NOT EXISTS treasury_acquired BIGINT DEFAULT 0")
|
||||
|
||||
await conn.execute("""
|
||||
CREATE TABLE IF NOT EXISTS dart_dividends (
|
||||
|
||||
Reference in New Issue
Block a user