mirror of
https://github.com/shawnkim1997/All-in-one-Financial-Analysis.git
synced 2026-08-18 21:08:07 +00:00
refactor: modular architecture v3.0 + SEC filing viewer fix + README
Architecture (3,909-line monolith → 28 focused modules, all < 300 lines):
- config/: constants.py (company lists, row maps, Damodaran baselines), theme.py (CSS/HTML)
- utils/: prefs, formatting, ticker, dcf, charts, ui_helpers
- data/: sec_parser, sec_fetcher, sec_downloader, financials, fundamentals,
valuation, ratios, scores, scores_ai, market
- ai/: gemini_core, gemini_sec, gemini_insights
- views/: sidebar, tab1_quant, tab1_ai, tab1_filings, tab2_dcf,
tab3_comps, tab4_news, tab5_markets, tab6_crypto, tab7_technical
- app.py: thin orchestrator (~118 lines)
- Strict unidirectional dependency graph (no circular imports)
- All @st.cache_data TTLs and st.session_state keys preserved identically
SEC filing viewer fix:
- Rebuilt EDGAR fetch chain: company_tickers.json → CIK → submissions API
→ filings.recent.primaryDocument[] (replaces deprecated directory.item)
- Filing type selectbox (10-K, 10-Q, 8-K, 20-F, 6-K) connected to backend
- Native HTML rendered via streamlit.components.v1.html() with CSS reset
- Errors surfaced explicitly with st.error()
- DART direct links restored for Korean-listed companies
.gitignore: data/ → data/*.json + data/*.html (preserve Python modules)
README: full rewrite for master's portfolio — 7-tab layout, architecture
diagram, modular structure tree, technical challenges, design rationale
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
7ce5661569
commit
d337c63976
@@ -0,0 +1,37 @@
|
||||
"""
|
||||
Ticker formatting and market inference utilities.
|
||||
"""
|
||||
from config.constants import MARKET_OPTIONS
|
||||
|
||||
|
||||
def get_global_ticker(ticker: str, market: str) -> str:
|
||||
"""Format ticker for Yahoo Finance by market. US: as-is. South Korea: .KS or .KQ. Japan: .T. UK: .L. If ticker already has suffix, return as-is."""
|
||||
if not (ticker or "").strip():
|
||||
return (ticker or "").strip()
|
||||
t = (ticker or "").strip()
|
||||
if t.upper().endswith((".KS", ".KQ", ".T", ".L")):
|
||||
return t
|
||||
m = (market or "").strip()
|
||||
if "US" in m or not m:
|
||||
return t
|
||||
if "Korea" in m or "KOSPI" in m or "KOSDAQ" in m:
|
||||
return t + ".KS"
|
||||
if "Japan" in m or "Nikkei" in m:
|
||||
return t + ".T"
|
||||
if "UK" in m or "LSE" in m:
|
||||
return t + ".L"
|
||||
return t
|
||||
|
||||
|
||||
def infer_market_from_ticker(ticker: str) -> str:
|
||||
"""Infer market label from ticker suffix (for Deep-Dive routing when no Market selector)."""
|
||||
if not (ticker or "").strip():
|
||||
return MARKET_OPTIONS[0]
|
||||
t = (ticker or "").strip().upper()
|
||||
if t.endswith(".KS") or t.endswith(".KQ"):
|
||||
return "South Korea (KOSPI/KOSDAQ)"
|
||||
if t.endswith(".T"):
|
||||
return "Japan (Nikkei)"
|
||||
if t.endswith(".L"):
|
||||
return "UK (LSE)"
|
||||
return "US (S&P/Dow/Nasdaq)"
|
||||
Reference in New Issue
Block a user