Add KSEI archive fallback import

This commit is contained in:
Rasyidan Akbar F. 2026-03-31 19:29:00 +07:00
commit 1f5c4b2798
11 changed files with 622 additions and 59 deletions

View file

@ -61,6 +61,7 @@ Unlike the `stocks` module (live-fetch), ownership is **import-then-query**:
### Data Sources
- **KSEI** — official ≥1% shareholder registry (monthly PDF from IDX)
- **KSEI archive** — monthly ZIP/TXT balance-position matrix, used as a local fallback/backstop import path
- **Bing Finance** — global institutional ownership (REST API, quarterly)
### Parser Pipeline
@ -68,6 +69,10 @@ Unlike the `stocks` module (live-fetch), ownership is **import-then-query**:
KSEI PDF → mutool stext (XML with coordinates) → quick-xml parse → KseiRawRow
→ normalize (ID locale numbers, dates, entity names) → KseiHolding
→ SQLite INSERT (within transaction)
KSEI archive ZIP/TXT → pipe-delimited balance-position rows
→ map investor-type/locality buckets into synthetic aggregate holders
→ SQLite INSERT (within transaction)
```
## Data Flow Patterns