Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -15,8 +15,7 @@ import streamlit as st
|
|
| 15 |
from src.csv_enrichment import (
|
| 16 |
TARGET_COLUMNS,
|
| 17 |
EnrichmentConfig,
|
| 18 |
-
enrich_csv,
|
| 19 |
-
lookup_fund_metric_value,
|
| 20 |
)
|
| 21 |
from src.data_engine import run_data_engine
|
| 22 |
|
|
@@ -222,7 +221,7 @@ def main() -> None:
|
|
| 222 |
<p class="mf-helper">
|
| 223 |
Upload your standard fund universe CSV
|
| 224 |
(<code>Fund</code>, <code>Benchmark Type</code>, CAGR columns, etc.).<br>
|
| 225 |
-
<strong>
|
| 226 |
all risk metrics (Alpha, Sharpe, Sortino, etc.) are computed directly from NAV history.
|
| 227 |
</p>
|
| 228 |
""",
|
|
@@ -245,8 +244,8 @@ def main() -> None:
|
|
| 245 |
)
|
| 246 |
|
| 247 |
st.info(
|
| 248 |
-
"Pipeline: **Scheme code resolution β NAV engine (parallel
|
| 249 |
-
"β PE/PB
|
| 250 |
)
|
| 251 |
|
| 252 |
st.markdown(
|
|
@@ -334,10 +333,8 @@ def main() -> None:
|
|
| 334 |
config=EnrichmentConfig(
|
| 335 |
enabled=True,
|
| 336 |
max_cells=None,
|
| 337 |
-
|
| 338 |
-
|
| 339 |
-
enable_nav_engine=True, # β parallel NAV engine (12 workers)
|
| 340 |
-
web_search_pe_pb_only=True, # β only PE/PB uses API credits
|
| 341 |
impute_unresolved=True,
|
| 342 |
),
|
| 343 |
live_callback=_live_sink,
|
|
@@ -351,7 +348,6 @@ def main() -> None:
|
|
| 351 |
f"enrichment_done "
|
| 352 |
f"checked={enrichment.examined_cells} "
|
| 353 |
f"nav={enrichment.nav_cells} "
|
| 354 |
-
f"web={enrichment.web_cells} "
|
| 355 |
f"imputed={enrichment.imputed_cells} "
|
| 356 |
f"skipped={enrichment.skipped_cells} "
|
| 357 |
f"codes={enrichment.resolved_codes} "
|
|
@@ -362,7 +358,6 @@ def main() -> None:
|
|
| 362 |
f" β
Enrichment done in **{enrich_secs:.0f}s** β "
|
| 363 |
f"checked {enrichment.examined_cells} cells, "
|
| 364 |
f"NAV filled {enrichment.nav_cells}, "
|
| 365 |
-
f"web filled {enrichment.web_cells}, "
|
| 366 |
f"imputed {enrichment.imputed_cells}"
|
| 367 |
)
|
| 368 |
|
|
@@ -418,7 +413,6 @@ def main() -> None:
|
|
| 418 |
enrichment_summary = (
|
| 419 |
f"Enrichment: {enrichment.examined_cells} cells checked β "
|
| 420 |
f"NAV filled {enrichment.nav_cells}, "
|
| 421 |
-
f"web filled {enrichment.web_cells}, "
|
| 422 |
f"imputed {enrichment.imputed_cells}, "
|
| 423 |
f"skipped {enrichment.skipped_cells}."
|
| 424 |
)
|
|
@@ -491,8 +485,8 @@ def main() -> None:
|
|
| 491 |
|---|---|
|
| 492 |
| **0 β Scheme resolution** | Parallel fuzzy-match of missing AMFI scheme codes (8 threads) |
|
| 493 |
| **1 β NAV engine** | Trailing 3Y risk metrics computed from mfapi NAV history (12 threads) |
|
| 494 |
-
| **2 β PE/PB
|
| 495 |
-
| **3 β Median impute** | Category median fills remaining gaps for
|
| 496 |
| **4 β Scoring** | Top/Bottom 10 per category, 10-point weighted model |
|
| 497 |
| **5 β Excel export** | Conditional formatting, quartile bands, benchmark rows |
|
| 498 |
|
|
|
|
| 15 |
from src.csv_enrichment import (
|
| 16 |
TARGET_COLUMNS,
|
| 17 |
EnrichmentConfig,
|
| 18 |
+
enrich_csv,
|
|
|
|
| 19 |
)
|
| 20 |
from src.data_engine import run_data_engine
|
| 21 |
|
|
|
|
| 221 |
<p class="mf-helper">
|
| 222 |
Upload your standard fund universe CSV
|
| 223 |
(<code>Fund</code>, <code>Benchmark Type</code>, CAGR columns, etc.).<br>
|
| 224 |
+
<strong>P/E and P/B are computed from AMFI monthly holdings (active funds) or NSE index API (index funds)</strong> β
|
| 225 |
all risk metrics (Alpha, Sharpe, Sortino, etc.) are computed directly from NAV history.
|
| 226 |
</p>
|
| 227 |
""",
|
|
|
|
| 244 |
)
|
| 245 |
|
| 246 |
st.info(
|
| 247 |
+
"Pipeline: **Scheme code resolution β NAV engine (parallel) "
|
| 248 |
+
"β PE/PB via AMFI holdings + NSE API β category median fallback β scoring engine**"
|
| 249 |
)
|
| 250 |
|
| 251 |
st.markdown(
|
|
|
|
| 333 |
config=EnrichmentConfig(
|
| 334 |
enabled=True,
|
| 335 |
max_cells=None,
|
| 336 |
+
resolve_scheme_codes=True,
|
| 337 |
+
enable_nav_engine=True,
|
|
|
|
|
|
|
| 338 |
impute_unresolved=True,
|
| 339 |
),
|
| 340 |
live_callback=_live_sink,
|
|
|
|
| 348 |
f"enrichment_done "
|
| 349 |
f"checked={enrichment.examined_cells} "
|
| 350 |
f"nav={enrichment.nav_cells} "
|
|
|
|
| 351 |
f"imputed={enrichment.imputed_cells} "
|
| 352 |
f"skipped={enrichment.skipped_cells} "
|
| 353 |
f"codes={enrichment.resolved_codes} "
|
|
|
|
| 358 |
f" β
Enrichment done in **{enrich_secs:.0f}s** β "
|
| 359 |
f"checked {enrichment.examined_cells} cells, "
|
| 360 |
f"NAV filled {enrichment.nav_cells}, "
|
|
|
|
| 361 |
f"imputed {enrichment.imputed_cells}"
|
| 362 |
)
|
| 363 |
|
|
|
|
| 413 |
enrichment_summary = (
|
| 414 |
f"Enrichment: {enrichment.examined_cells} cells checked β "
|
| 415 |
f"NAV filled {enrichment.nav_cells}, "
|
|
|
|
| 416 |
f"imputed {enrichment.imputed_cells}, "
|
| 417 |
f"skipped {enrichment.skipped_cells}."
|
| 418 |
)
|
|
|
|
| 485 |
|---|---|
|
| 486 |
| **0 β Scheme resolution** | Parallel fuzzy-match of missing AMFI scheme codes (8 threads) |
|
| 487 |
| **1 β NAV engine** | Trailing 3Y risk metrics computed from mfapi NAV history (12 threads) |
|
| 488 |
+
| **2 β PE/PB engine** | Active funds: AMFI monthly holdings weighted PE/PB (same as Groww). Index funds: NSE index API |
|
| 489 |
+
| **3 β Median impute** | Category median fills remaining gaps for β₯3Y funds. Young funds (<3Y) marked NA |
|
| 490 |
| **4 β Scoring** | Top/Bottom 10 per category, 10-point weighted model |
|
| 491 |
| **5 β Excel export** | Conditional formatting, quartile bands, benchmark rows |
|
| 492 |
|