docs: known-issues 4건 추가 + devlog 2026-03-11 세션 기록
This commit is contained in:
@@ -1,44 +1,34 @@
|
||||
"""DART finstate test — stock code vs corp_code"""
|
||||
import OpenDartReader
|
||||
import time
|
||||
"""DB stats and sample data"""
|
||||
import sqlite3
|
||||
|
||||
dart = OpenDartReader("ef6deb100be436aed88051fd4914dbdb58ff2e94")
|
||||
conn = sqlite3.connect("data/edf.db")
|
||||
|
||||
# Test: finstate with stock code directly
|
||||
print("=== DART finstate with stock code directly ===")
|
||||
for code, name in [("005930", "삼성전자"), ("000660", "SK하이닉스"), ("036720", "한볼트")]:
|
||||
try:
|
||||
fs = dart.finstate(code, 2024)
|
||||
time.sleep(0.5)
|
||||
n = len(fs) if fs is not None else 0
|
||||
print(f" {code} {name}: {n} rows")
|
||||
except Exception as e:
|
||||
print(f" {code} {name}: ERROR {e}")
|
||||
print("=== DB Stats ===")
|
||||
for t in ["companies", "market_data", "financial_data", "volatility", "merton_results"]:
|
||||
c = conn.execute(f"SELECT COUNT(*) FROM {t}").fetchone()[0]
|
||||
print(f" {t}: {c:,}")
|
||||
|
||||
# Test: finstate_all — bulk download per corp_code
|
||||
print("\n=== DART finstate_all (삼성전자 00126380) ===")
|
||||
try:
|
||||
fs = dart.finstate_all("00126380", 2024)
|
||||
time.sleep(0.5)
|
||||
n = len(fs) if fs is not None else 0
|
||||
print(f" 삼성전자 finstate_all: {n} rows")
|
||||
except Exception as e:
|
||||
print(f" ERROR: {e}")
|
||||
print("\n=== Volatility sample ===")
|
||||
rows = conn.execute("SELECT ticker, sigma_E FROM volatility ORDER BY ticker LIMIT 5").fetchall()
|
||||
for r in rows:
|
||||
print(f" {r[0]}: sigma_E={r[1]:.4f}")
|
||||
|
||||
# Test: KOSPI major — find their corp_codes and try finstate
|
||||
print("\n=== DART finstate loop with known-good corp_codes ===")
|
||||
corp_codes = dart.corp_codes
|
||||
for ticker in ["005930", "000660", "005380", "036720", "040130"]:
|
||||
match = corp_codes[corp_codes["stock_code"] == ticker]
|
||||
if len(match) > 0:
|
||||
cc = match.iloc[0]["corp_code"]
|
||||
cn = match.iloc[0]["corp_name"]
|
||||
try:
|
||||
fs = dart.finstate(cc, 2024)
|
||||
time.sleep(0.5)
|
||||
n = len(fs) if fs is not None else 0
|
||||
print(f" {ticker} {cn} (corp={cc}): {n} rows")
|
||||
except Exception as e:
|
||||
print(f" {ticker} {cn}: ERROR {e}")
|
||||
else:
|
||||
print(f" {ticker}: Not found in corp_codes")
|
||||
print("\n=== Financial sample ===")
|
||||
rows = conn.execute("""
|
||||
SELECT ticker, total_assets, default_point, leverage_ratio
|
||||
FROM financial_data WHERE total_assets IS NOT NULL
|
||||
ORDER BY total_assets DESC LIMIT 5
|
||||
""").fetchall()
|
||||
for r in rows:
|
||||
dp = f"{r[2]:,.0f}" if r[2] else "N/A"
|
||||
lev = f"{r[3]:.3f}" if r[3] else "N/A"
|
||||
print(f" {r[0]}: TA={r[1]:,.0f} DP={dp} LEV={lev}")
|
||||
|
||||
# Overlap: tickers with BOTH volatility AND financial_data
|
||||
both = conn.execute("""
|
||||
SELECT COUNT(DISTINCT v.ticker)
|
||||
FROM volatility v JOIN financial_data f ON v.ticker = f.ticker
|
||||
""").fetchone()[0]
|
||||
print(f"\n=== Merton 산출 가능 종목 (KRX+DART 모두 있는 종목): {both} ===")
|
||||
|
||||
conn.close()
|
||||
|
||||
Reference in New Issue
Block a user