feat(phase9): add real corporate bond pipeline and fix rate mapping
This commit is contained in:
@@ -16,3 +16,47 @@
|
||||
**Phase 4. 한국 벤치마크 테스트**
|
||||
- [ ] 가상 한국 시나리오 세트 가동
|
||||
- [ ] ISDA 기준 시장 리스크 충격 플로저빌리티(Plausibility) 대조 및 수치 결과 평가 분석
|
||||
|
||||
### Phase 5: Web UI Dashboard for Market Parameter Viewer
|
||||
|
||||
**Goal:** [To be planned]
|
||||
**Requirements**:
|
||||
- NGFS 원천 데이터 시각화 화면
|
||||
- 한국형 프록시 및 KSIC 맵핑 데이터 가시화
|
||||
- 시나리오 데이터가 실제 모델(Merton, Pivot)과 결합되어 최종 쇼크를 만드는 추적(Tracing) 인터페이스 구축
|
||||
**Depends on:** Phase 4
|
||||
**Plans:** 0 plans
|
||||
|
||||
Plans:
|
||||
- [x] TBD (run /gsd-plan-phase 5 to break down)
|
||||
|
||||
### Phase 6: Pro-Max UI/UX Analytics Dashboard & Trace Rebuild
|
||||
|
||||
**Goal:** Report-style analytic dashboard with complete ISDA tracking logic, OLED Dark Mode, and expanded dynamic asset scaling.
|
||||
**Requirements**:
|
||||
- 좌우 분할식 (NGFS 원천 vs 한국 대응 Proxy) Data Lineage 설계
|
||||
- 모델 수식(Math Breakdown) 투명화: 스칼라값 대입 과정 표출
|
||||
- 모의 자산 500+개 강제 주입으로 엔진 스케일링 데모 표출
|
||||
- 기술스택: Fira Code + OLED Dark (ui-ux-pro-max 가이드라인 채택)
|
||||
**Depends on:** Phase 5
|
||||
**Plans:** 0 plans
|
||||
|
||||
Plans:
|
||||
- [ ] TBD (run /gsd-plan-phase 6 to break down)
|
||||
|
||||
### Phase 7: ISDA Quantitative Engine Mathematical & Data Overhaul
|
||||
|
||||
**Goal:** Transform the risk engine into a mathematically rigorous, ISDA-compliant valuation framework with True Data Governance.
|
||||
**Requirements**:
|
||||
- Design explicit Security Master Data Acquisition (External CSV/SQLite integration) mapping Ticker -> KSIC, GICS, Rating.
|
||||
- Extract Deriva Baseline `eval_datasets` JSON to inject accurate real market spots and vols.
|
||||
- Replace Merton variable $\sigma_V$ scalar with true capital structural organic spread amplification.
|
||||
- Rebuild Hull-White Short-Rate curve shocks via rigorous Analytical Affine Zero Bond dynamics.
|
||||
**Depends on:** Phase 6
|
||||
**Plans:** 4 plans
|
||||
|
||||
Plans:
|
||||
- [ ] 1. Build and Inject `firm_reference_data` (Security Master) into DB and adapt loader.
|
||||
- [ ] 2. Sync `base_market_data_loader.py` with true `eval_datasets` baseline parsing.
|
||||
- [ ] 3. Refactor `market_risk_engine.py` using proper Merton invariants and HW1F affine mathematics.
|
||||
- [ ] 4. Update UI Dashboard & API responses to accurately expose Tenor and Mathematical breakdown.
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
phase: 9-real-bond-data
|
||||
task: 5
|
||||
total_tasks: 6
|
||||
status: paused
|
||||
last_updated: 2026-04-03T13:43:26.520Z
|
||||
---
|
||||
|
||||
<current_state>
|
||||
We have successfully implemented the "Real Corporate Bond Data Fetching Pipeline" (Phase 9) using an open-source Naver Finance scraper, substituted fake benchmark mappings with actual realistic ISINs (e.g. KR600538012C Hyundai Motor), and excluded `Rate` (SOFR/CD91D) from default simulations. We also fixed a fatal bug where empty Equity shock frames crashed the sqlite generation which 500'd the API. We are pausing to consolidate progress.
|
||||
</current_state>
|
||||
|
||||
<completed_work>
|
||||
|
||||
- Task 1: Built `bond_data_fetcher.py` and decoupled `Rate` classification. - Done
|
||||
- Task 2: Adjusted `create_security_master.py` to employ realistic ISINs (Samsung, Hyundai, KB, KTB). - Done
|
||||
- Task 3: Modified `market_risk_engine.py` to execute accurately over mixed asset types. - Done
|
||||
- Task 4: Solved API Internal Server Error caused by sqlite missing dataset. - Done
|
||||
</completed_work>
|
||||
|
||||
<remaining_work>
|
||||
|
||||
- Task 5: Push documentation to Gitea Wiki (currently blocked by git remote auth, drafted locally instead).
|
||||
</remaining_work>
|
||||
|
||||
<decisions_made>
|
||||
|
||||
- Decided to use hardcoded real ISINs linked to Naver Finance proxy representations because `pykrx` bond endpoints were broken, and generating/scraping raw issuance reports from DART/Seibro needs API Keys and is heavily captcha-gated.
|
||||
</decisions_made>
|
||||
|
||||
<blockers>
|
||||
- Gitea Wiki Clone: Failed due to network remote reading error. Workaround: Formatted the progress summary into `docs/Wiki_Summary_Phase9.md` so the user can manually transfer or push it.
|
||||
</blockers>
|
||||
|
||||
<context>
|
||||
The DB is fresh and valid. The FastAPI works locally at `:8000/api/matrix/baseline`. Data maps successfully.
|
||||
</context>
|
||||
|
||||
<next_action>
|
||||
Start with: Reviewing the UI to ensure the user is completely satisfied with the ISIN bond rendering, then proceed to any remaining UI polishing or back-testing tasks.
|
||||
</next_action>
|
||||
@@ -0,0 +1,27 @@
|
||||
# Title: ISDA Quantitative Engine Mathematical & Data Overhaul
|
||||
|
||||
## Goal
|
||||
Transform the climate risk engine from a heuristic-based approximation model into a mathematically rigorous, ISDA-compliant valuation framework. Eliminate theoretical "fudging", correct NGFS data scaling errors, and ensure that all market scenarios accurately map to formal reference data and baseline dataset snapshots instead of arbitrary values.
|
||||
|
||||
## Proposed Steps
|
||||
|
||||
### 1. Data Governance & Entity Relational Mapping
|
||||
- **Create `firm_reference_data` table:** Implement a Security Master mechanism (SQLite or CSV) mapping `asset_code` to specific ISDA Firmographics (`gics_sector`, `credit_rating`, `ksic_code`).
|
||||
- **Load Firmographic Reference Data**: Implement logic in `base_market_data_loader.py` to join against this robust catalog, replacing all previous Python `lambda` arbitrary sector mapping.
|
||||
|
||||
### 2. Market Data Integration (ISDA Baseline)
|
||||
- **JSONB Parsing**: Extract the pre-evaluated market dataset snapshot (`spots` & `vols`) from the `eval_datasets` Postgres table.
|
||||
- **Bind True Starting State ($V_0$ & $\sigma_0$)**: Substitute all uniformly hardcoded constants ($V_{base} = 100.0, \sigma_V = 0.20$) with actual market prices and observed implied volatilities for precise baseline setting (e.g., Samsung Electronics `56300`).
|
||||
|
||||
### 3. Quantitative Formulation Overhaul
|
||||
- **Merton Model Rectification**: Halt arbitrary scalar amplifications of Firm Asset Volatility ($\sigma_V$). Restore $\sigma_V$ as an invariant across normal & stressed environments so equity spread amplification triggers organically via capital structural leverage ($V/E \cdot N(d_1)$).
|
||||
- **Hull-White 1-Factor Correct Pricing Formula**: Replace simplistic Beta curve increments. Implement the precise Affine Term Structure $B(0, T)$ Zero Rate formulation factoring mean reversion (`hw_kappa`).
|
||||
- **NGFS Percentage Recalibration**: Divide structural NGFS policy inputs by 100 to map them into formal decimal yield configurations (`0.0525` instead of `5.25`), aligning seamlessly with HW mathematical bounds.
|
||||
|
||||
### 4. UI & Presentation Integration
|
||||
- Extend existing frontend (`App.jsx`) and API serialization (`main.py`) to expose accurate curve `Tenor` fields explicitly.
|
||||
- Render accurate HW mathematical formulas on the guidance panels corresponding to the reformed backend physics.
|
||||
|
||||
## Testing & Verification
|
||||
- Manually review `engine_results` and JSON API outputs to verify newly produced PVs and Deltas align with expected Quant characteristics.
|
||||
- Ensure the UI adequately parses `Tenor` without exceptions.
|
||||
Reference in New Issue
Block a user