Comprehensive audit: bug fixes, CAGR formula fix, extension UI, project reorg - #3
Open
karmataklu-bot wants to merge 39 commits into
Open
Comprehensive audit: bug fixes, CAGR formula fix, extension UI, project reorg#3karmataklu-bot wants to merge 39 commits into
karmataklu-bot wants to merge 39 commits into
Conversation
Updated README to reflect new project structure and features.
- Chrome extension (popup, background, analyse UI) for NEPSE CAGR calculation - Native messaging host (nepse_host.py + wrapper shell script) bridges extension to local Python engine - nepse_cagr_server.py runs local HTTP server for CAGR calculations - com.nepse.cagr.json manifest registers native host with Chrome - CLAUDE.md and SETUP.md document project and setup steps
Updated README to clarify functionality and usage details.
Added a section for the Browser Extension, detailing its architecture, files, and setup instructions for macOS.
- index_history.py: scrapes all 18 NEPSE indices from ShareSansar - GET request with numeric index_id (not POST with text name) - 30-day chunks (server silently returns 0 rows for >= 31 days) - JSON response parsing (not HTML table) - Incremental mode: resumes from latest CSV date - Query mode: --query --index "X" --date YYYY-MM-DD - run_index_history.py: CLI entry point mirroring run_daily.py pattern - data/index/: initial historical data for all 18 sub-indices
…to fix MV3 CSP Chrome MV3 blocks inline <script> blocks and CDN scripts. - Extract all JS from analyse.html into analyse.js (external file) - Download chart.umd.js locally (was blocked from cdnjs CDN) - Light mode theme toggle now works
- Add topbar-right container to group theme and back buttons - Implement switchPage function for multi-page navigation - Back button shows on non-analyse pages, hidden on main page - Back button navigates back to analyse (main) page - Add corresponding CSS styling for back-btn
…nflict - Add asterisk note clarifying NEPSE data based on closing prices - Remove malformed JavaScript code from HTML merge conflict - Clean up CAGR page section
Remove height:0 from Estimated (1994-2000) legend item. Height override prevented dashed border from rendering. Now displays properly as dashed line.
- Add company name/ticker search input field for future filtering capability - Add "My Predictions — Next Cycle Top" section with 4 key indicators: * Buffett Indicator (market cap = GDP) reaching 100% * Daily trading volume approaching 35–40 Arab * Index crossing 5,000 * 4-year cycle milestone from Sep 2022 bottom (~Sep 2026) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
…ack nav
- Add page-buffett: full blog-style article from PDF (all 5 pages)
- Include Global & Regional Buffett Indicator comparison table (11 markets)
- Wire #buffett-link click → switchPage('buffett') via JS (CSP-safe)
- Fix back button to return to previous page (bullbear → buffett → back = bullbear)
- Add buffett-indicator.pdf to extension and web_accessible_resources in manifest
- Article width set to 749px, minimal dark aesthetic
added 9 commits
May 12, 2026 14:54
…O research Features: - nepse_bull_bear_analyser.py: interactive analysis of all 5 bulls + 4 bears * 15% price-based shaving (NEPSE index delta thresholds) * Multi-sheet Excel output (full, shaved, analysis) * Bull 4 POC: 168 stocks (full), 166 stocks (shaved), analysis metrics - nepse_cagr.py: extended with end_date parameter and get_all_symbols() helper * Enables windowed CAGR calculations for any date range * Bulk symbol enumeration from company-wise directory - nepse_cagr_server.py: updated for new bull/bear analysis support - Extension UI (analyse.html/js): enhanced for bull run tracking per ticker IPO Research: - ipo_listing.py: new script for IPO listing analysis - fetch_company_names.py: populate company_names.json - find_new_listings.py: identify recent IPO entries - IPO research data: performance tracking, 1-year returns analysis - new_listings_cagr.csv: consolidated IPO metrics Analysis: - bull3_analysis.py: legacy single-cycle analysis - daily_patch.py: utility for daily data reconciliation - Graphify knowledge graph: codebase architecture mapped Data: - company_names.json: ticker-to-name mapping (339 symbols) - Research/: organized IPO and bull/bear analysis outputs - graphify-out/: AST-based code graph with wiki Results: - Bull 4 median CAGR: 85.64% (full) vs 88.68% (shaved 15%) - Identified listing artifacts: short-window trades skew mean CAGR - Median chosen as reliable metric for cycle performance
## Bug fixes - nepse_cagr_server.py: fix CAGR formula — include right share costs in total_invested denominator (was inflating CAGR for stocks with rights) - nepse_cagr_server.py: fix _build_events — track running unit count so units_after is always a valid float; compute cash_rs correctly - nepse_cagr_server.py: add path traversal protection via _SYMBOL_RE - nepse_cagr_server.py: fix errno.EADDRINUSE (was macOS-only errno==48) - nepse_cagr_server.py: use ThreadingHTTPServer instead of HTTPServer - find_new_listings_interactive.py: fix get_stock_name to strip trailing ticker symbol in parentheses e.g. "Bank Ltd ( NABIL )" -> "Bank Ltd" - ipo_listing.py: fix data_dir path (was .parent.parent.parent, broken) - index_history.py: clarify 29-day chunk limit comment (ShareSansar bug) - nepse_host.py: fix bare except -> except (OSError, urllib.error.URLError) - find_new_listings_interactive.py: fix recursive main() -> while loop ## Code quality - nepse_cagr.py: add DAYS_PER_YEAR constant, remove unused import os, add docstring to calculate_cagr() - nepse_cagr_server.py: delete 4 duplicate functions, import from nepse_cagr.py; add Content-Length guard, silence logs - ipo_listing.py: move inline imports to top-level (PEP 8) - requirements.txt: remove unused deps (apscheduler, dotenv, pytz, lxml, opencv); add openpyxl, python-dateutil with version pins ## Extension UI - popup.js: add 'right' share badge branch (was crashing on null pct) - popup.html: add .badge-right CSS (amber dark/light mode variants) ## Project reorganization - analysis/: move nepse_bull_bear_analyser.py, find_new_listings.py, find_new_listings_interactive.py (all __file__ paths updated) - scraper/: move index_history.py, fetch_company_names.py (paths updated); remove redundant standalone ipo_listing.py - data/: move company_id_mapping.json from scraper/scraper/data/ - Delete: bull3_analysis.py (superseded by --period bull3), daily_patch.py (edits already applied), run_index_history.py (shim)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug fixes
server was returning inflated returns for any stock with rights issues
units_after was null causing TypeError crash in extension popup
for any stock with corporate actions
suffix fixed in find_new_listings_interactive.py
find_new_listings_interactive.py
Security
symbol before any filesystem access
Extension UI
'right' events, caused blank cell and crash
Code quality
single source of truth via imports from nepse_cagr.py
Project structure
find_new_listings_interactive.py