Development History
2026-01-07: Fix Backup/Restore for Foreign Stocks & RSU Sell-to-Cover (NFR7)
Task: Fix multiple issues with backup and restore functionality for foreign stocks and RSU transactions.
AI Assistant: Antigravity Role: Full-Stack Developer
Summary
Fixed critical backup/restore issues that caused data loss and display errors:
- BACKUP_VERSION: Upgraded from 1.1 → 1.2
- Details Field: Added details field serialization/restore (contains fx_rate for foreign stocks)
- RSU Sell-to-Cover: Skip restoring SELL transactions with related_rsu_vest_id to prevent double-counting
- Asset Lookup: Fixed duplicate key error when looking up existing foreign assets
- Diversification: Fixed case-insensitive asset_type check for foreign stock enrichment
File Changes
Backend:
* Modified: backend/app/services/backup_service.py - Added details serialization, skip sell-to-cover SELLs, version bump
* Modified: backend/app/api/v1/endpoints/assets.py - Check existing asset before external create
* Modified: backend/app/crud/crud_holding.py - Case-insensitive asset_type check for enrichment
* Modified: backend/app/schemas/__init__.py - Export missing schemas
Verification
- Backend Tests: All tests pass
- Manual Testing: Foreign stock backup/restore verified with GOOG/CSCO
Outcome
Success. Users can now backup and restore foreign stock transactions with preserved FX rates and correct holdings.
Task: Implement system tray integration for the desktop app, allowing users to minimize to tray instead of closing.
AI Assistant: Antigravity Role: Full-Stack Developer
Summary
Implemented system tray functionality using Electron's Tray API: - Tray Icon: App icon appears in system tray when running - Minimize to Tray: Closing window hides to tray instead of quitting - Context Menu: Right-click tray for "Show ArthSaarthi" and "Quit" - Double-click: Restores window from tray
File Changes
Backend:
* New: docs/features/FR-Desktop-3_system_tray.md - Feature plan
Frontend (Electron):
* Modified: frontend/electron/main.cjs - Added Tray, nativeImage imports, createTray function, window close handler override, before-quit handler
Verification
- Frontend Tests: 175 tests pass
- Linting: main.cjs lint errors are false positives (Node.js globals not recognized)
Outcome
Success. Desktop users can now minimize the app to the system tray and restore it via the tray icon.
-
Task Description: Implemented admin-only manual asset sync endpoint allowing administrators to trigger asset master data updates from the UI without restarting the server.
-
Key Prompts & Interactions:
- Backend Implementation: Created
admin_assets.pywithPOST /api/v1/admin/assets/syncendpoint. Includes 5-minute rate limiting via CacheService (Redis/DiskCache), full download logic for 8 data sources (NSDL, BSE, NSE, ICICI), and returns sync summary with counts. - Frontend Implementation: Created
AssetSyncCard.tsxcomponent with loading states and toast notifications,SystemMaintenancePage.tsx, and added navigation link to admin sidebar. - Bug Fixes: Fixed
react-hot-toastimport issue by using existinguseToasthook from ToastContext. Fixed ruff lint errors (unused imports, line lengths, trailing whitespace).
- Backend Implementation: Created
-
File Changes:
backend/app/api/v1/endpoints/admin_assets.py: New admin endpoint for asset sync.backend/app/api/v1/api.py: Updated to register admin_assets router.frontend/src/components/Admin/AssetSyncCard.tsx: New sync button component.frontend/src/pages/Admin/SystemMaintenancePage.tsx: New admin maintenance page.frontend/src/components/NavBar.tsx: Updated to add System Maintenance link.frontend/src/services/adminApi.ts: Updated with syncAssets API function.frontend/src/App.tsx: Updated with /admin/maintenance route.
-
Verification:
- Backend tests: 167 passed
- Frontend tests: 175 passed
- E2E tests: 32 passed
- Ruff lint: 0 errors
-
Outcome:
- Admins can now trigger asset master updates via UI at
/admin/maintenance. - 5-minute rate limit prevents hitting external API limits.
- Sync returns summary: newly added, updated, and total processed counts.
- Admins can now trigger asset master updates via UI at
2025-11-20: Implement User Data Backup & Restore (NFR7)
-
Task Description: Implement the full-stack "Backup & Restore" feature (NFR7), allowing users to export their entire financial data to a JSON file and restore it. This included creating a new backend service for data serialization/deserialization, a new UI in the Profile page, and a robust verification strategy.
-
Key Prompts & Interactions:
- Backend Implementation: A new
backup_service.pywas created to handle the complex logic of serializing all user data (Portfolios, Transactions, FDs, RDs, Goals, Watchlists) into a versioned JSON format. The restore logic was implemented to perform a transactional "wipe and recreate" of user data while preserving sharedAssetrecords. - Test Generation: A comprehensive backend test
test_backup_restore.pywas created to verify the full cycle of data creation, backup, wipe, restore, and verification. - Frontend Implementation: A new
BackupRestoreCardcomponent was created and integrated into theProfilePage. It features a download button and a restore file input with a high-friction "DELETE" confirmation modal. - Systematic Debugging:
- Backend Test Fixes: Addressed initial
AttributeErrordue to missing imports inmodels/__init__.py. - Environment Configuration: Resolved issues with
docker-composeenvironment variables and database connectivity during local verification. - Playwright Verification: Created a temporary Playwright script to verify the frontend UI and take a screenshot. Debugged timeouts caused by
HashRouterURL handling (/#/login) and missing environment variables for the Vite proxy. - Manual E2E Fix: Addressed a critical bug in
backup_service.pywherecreate_with_ownerwas called with incorrect arguments (user_idvsowner_id) for FDs/RDs. Added regression test for this. - Test Failure Fix: Fixed E2E test expecting old heading text and backend tests running in desktop mode failing due to missing user management endpoints. Moved backup endpoints to
me.pyto resolve this.
- Backend Test Fixes: Addressed initial
- Backend Implementation: A new
-
File Changes:
backend/app/services/backup_service.py: New service for backup/restore logic.backend/app/api/v1/endpoints/me.py: Updated to add/backupand/restoreendpoints.backend/app/models/__init__.py: Updated to expose all models properly.backend/app/tests/api/v1/test_backup_restore.py: New backend test suite.frontend/src/components/Profile/BackupRestoreCard.tsx: New UI component.frontend/src/pages/ProfilePage.tsx: Updated to include the new card.frontend/src/services/userApi.ts: Updated with backup/restore API calls.e2e/tests/profile-management.spec.ts: Updated to match UI changes.
-
Verification:
- Ran the new backend test suite (
test_backup_restore.py), which passed. - Ran the full backend test suite (
./run_local_tests.sh backend), which passed. - Performed frontend verification using a custom Playwright script (
verification/verify_backup.py) and manual inspection of the screenshot.
- Ran the new backend test suite (
-
Outcome:
- The "Backup & Restore" feature is fully implemented, tested, and verified.
- Users can now safely backup their data and restore it, with safeguards against accidental data loss.
2025-11-23: Implement Asset Seeder Classification V2 (FR4.3.6)
-
Task Description: Implemented a new multi-phase asset seeding strategy to accurately classify assets (Bonds, Stocks, ETFs) using authoritative data sources (NSDL, BSE, NSE). This addresses misclassification issues where corporate bonds were flagged as stocks.
-
Key Prompts & Interactions:
- Requirement Clarification: Clarified the "Download Once" strategy and obtained specific URLs for authoritative data sources (NSDL, BSE Equity/Debt Bhavcopies, etc.) from the user.
- Implementation: Refactored the monolithic
seed-assetscommand into a modularAssetSeederservice (backend/app/services/asset_seeder.py). - Heuristics: Implemented advanced regex-based heuristics to classify assets that fall back to the generic master list (Phase 5), correctly identifying Finance company bonds based on coupon patterns (e.g.,
9.75,28AG20). - Verification: Validated the fix against known problematic cases (e.g.,
KOSAMATTAM,MUTHOOTTU) which are now correctly classified asBOND.
-
File Changes:
backend/app/services/asset_seeder.py: New service implementing the 5-phase seeding logic.backend/app/cli.py: Updated to useAssetSeederand support--local-dir.backend/requirements.in/.txt: Updated to includeopenpyxlandxlrd.backend/app/tests/cli/test_cli.py: Updated tests to match the new seeding logic and file patterns.
-
Verification:
- Ran
seed-assetswith downloaded sample files. Verified creation of ~39k assets. - Verified specific assets (
KOSAMATTAM,MUTHOOTTU) areBOND. - Ran backend tests (
./run_local_tests.sh backend), all passed.
- Ran
-
Outcome:
- The asset seeding process is now authoritative-source first, significantly reducing misclassification.
- The system supports multiple input formats (TSV, CSV, XLS, XLSX, ZIP).
2025-12-05: ESPP/RSU Implementation & Stability Fixes
Task: Implement ESPP/RSU tracking (FR4.3.7, formerly FR8.1.1) and resolve all outstanding bugs and linter warnings to achieve a stable, fully-passing test suite.
AI Assistant: Gemini Code Assist Role: Full-Stack Developer
Summary of AI's Output & Key Decisions
The AI assistant successfully implemented the ESPP/RSU tracking feature and addressed a series of critical bugs and code quality issues across the stack.
-
ESPP/RSU Feature:
- A new
AddAwardModal.tsxwas created to provide a dedicated UI for logging RSU Vests and ESPP Purchases. - The modal includes logic to fetch FX rates on the fly and supports 'Sell to Cover' transactions, which are created atomically on the backend.
- The backend
crud_holding.pywas updated to correctly calculate the cost basis for these new acquisition types (using FMV for RSUs) and handle foreign currency conversions.
- A new
-
Bug Fixes:
- Currency Formatting: Fixed a critical bug in
TransactionHistoryTable.tsxandEquityHoldingRow.tsxwhere the total value of foreign assets was displayed with the wrong currency symbol (e.g.,$50instead of₹4150). The fix ensures all portfolio values are consistently converted to and displayed in INR. - Backend Validation: Resolved a
ValidationErrorincrud_holding.pyby correctly adding thecurrencyfield during the creation ofHoldingobjects for Fixed and Recurring Deposits. - Dashboard FX Conversion: Fixed a bug in the "Top Movers" card where the daily price change for foreign assets was shown with an INR symbol but used the asset's native currency value (e.g., showing
₹2.00instead of the correct₹167.00). The logic incrud_dashboard.pywas updated to convert all monetary values to INR before sending them to the frontend. - Backend Validation: Resolved a
ValidationErrorincrud_holding.pyby correctly adding thecurrencyfield during the creation ofHoldingobjects for non-market-traded assets. - Test Suite Failures: Corrected multiple failing tests, including a logic error in
test_dashboard.py's top mover calculation and several frontend tests that were missing thePrivacyProvidercontext.
- Currency Formatting: Fixed a critical bug in
-
Code Quality & Linting:
- Systematically resolved all
E501 (Line too long)errors in the backend Python code reported byruff. - Fixed all
eslintwarnings in the frontend, including an unused variable and critical violations of the "Rules of Hooks" inTransactionList.tsxandTransactionHistoryTable.tsx.
- Systematically resolved all
File Changes
- Modified:
backend/app/crud/crud_holding.py- Added currency to non-market assets, updated cost-basis logic for RSU/ESPP. - Modified:
backend/app/crud/crud_transaction.py- Added idempotency checks and logic for 'Sell to Cover'. - Modified:
backend/app/crud/crud_dashboard.py- Corrected top-mover daily change calculation. - Modified:
backend/app/services/providers/yfinance_provider.py- Refactored for clarity and fixed line-length issues. - Modified:
backend/app/api/v1/endpoints/transactions.py- Fixed line-length issues. - Modified:
frontend/src/components/Transactions/TransactionHistoryTable.tsx- Fixed currency display bug and Rules of Hooks violation. - Modified:
frontend/src/components/Portfolio/TransactionList.tsx- Fixed Rules of Hooks violation. - Modified:
frontend/src/components/Portfolio/AddAwardModal.tsx- Implemented ESPP/RSU modal, added edit functionality, and removed unused state variable. - Modified:
frontend/src/components/Portfolio/holding_rows/EquityHoldingRow.tsx- Fixed currency display bug. - Modified:
e2e/tests/corporate-actions.spec.ts- Reverted temporary test fix after the underlying bug was resolved. - Modified:
frontend/src/__tests__/components/Portfolio/TransactionList.test.tsx- AddedPrivacyProviderwrapper. - Modified:
frontend/src/__tests__/components/Portfolio/holding_rows/EquityHoldingRow.test.tsx- AddedPrivacyProviderwrapper. - Modified:
README.md- Updated feature list. - Modified:
task_prompt/handoff_document.md- Updated project status.
Verification Steps
- Linters: Ran
ruff check . --fixandeslint .to confirm all code quality issues were resolved. - Unit Tests: Executed backend (
pytest) and frontend (jest) tests to ensure all component-level logic passed. - E2E Tests: Ran the full Playwright E2E test suite against both PostgreSQL and SQLite backends (
docker-compose -f docker-compose.e2e.yml upanddocker-compose -f docker-compose.e2e.sqlite.yml up). - Manual Verification: Manually tested the "Add ESPP/RSU Award" flow, including editing and 'Sell to Cover', to confirm correct behavior. Verified that currency symbols on the portfolio and transaction pages were consistently INR.
Outcome
Success. All linters and automated tests are passing across all environments. The ESPP/RSU feature is implemented, and critical bugs have been resolved. The project is in a stable and well-documented state.
2025-12-06: Implement Foreign Stock Transactions (FR5.3.1)
Task: Implement support for foreign stock transactions (FR5.3.1, formerly FR8.2), ensuring portfolio values and analytics (XIRR) are correctly converted to INR using daily FX rates.
AI Assistant: Jules Role: Senior Software Engineer
Summary
The "Foreign Stock Transactions" feature has been implemented to allow users to track assets in foreign currencies (e.g., USD) while viewing their portfolio consolidated in INR.
-
Backend Implementation:
- FX Rate Integration: Updated
crud_dashboard.pyto fetch historical FX rates (e.g.,USDINR=X) viayfinanceand convert daily asset values to INR for the portfolio history chart. - Analytics: Updated
crud_analytics.pyto apply the specific FX rate from transaction details to cash flows (BUY, SELL, DIVIDEND) and RSU vests when calculating XIRR. - Data Model: Added
ESPP_PURCHASEandRSU_VESTtoTRANSACTION_BEHAVIORSas outflows infinancial_definitions.py. - Testing: Added a new test suite
app/tests/crud/test_foreign_assets.pycovering portfolio history conversion and XIRR accuracy for foreign assets.
- FX Rate Integration: Updated
-
Frontend Implementation:
- Transaction Form: Updated
TransactionFormModal.tsxto automatically detect foreign assets and fetch the live FX rate for the transaction date. It displays an "INR Conversion" summary and saves the rate in thedetailsJSON field. - Details Modal: Created a new
TransactionDetailsModal.tsxto view the metadata (FX Rate, FMV) stored in thedetailsfield. - History Table: Updated
TransactionHistoryTable.tsxto calculate the "Total Value" using the storedfx_rateand added a button to view the full details.
- Transaction Form: Updated
File Changes
- Modified:
backend/app/crud/crud_dashboard.py - Modified:
backend/app/crud/crud_analytics.py - Modified:
backend/app/core/financial_definitions.py - Modified:
backend/app/services/providers/yfinance_provider.py - New:
backend/app/tests/crud/test_foreign_assets.py - Modified:
frontend/src/components/Portfolio/TransactionFormModal.tsx - Modified:
frontend/src/components/Transactions/TransactionHistoryTable.tsx - New:
frontend/src/components/Transactions/TransactionDetailsModal.tsx
Verification
- Unit Tests: Ran
app/tests/crud/test_foreign_assets.pysuccessfully. - Manual/E2E Verification: Verified the "INR Conversion" UI section appears for foreign assets and that transaction details are correctly saved and displayed. (Note: E2E test file was used for development but removed due to environment flakiness, relying on robust unit tests and manual verification logic).
Outcome
Success. Users can now seamlessly add foreign stock transactions, view their consolidated value in INR, and see accurate XIRR calculations that account for currency fluctuations.
2025-12-11: Final Stabilization and Test Coverage
Task: Resolve remaining test failures, ensure full test suite stability across all environments, and prepare for release backup.
AI Assistant: Gemini Code Assist Role: Senior Software Engineer
Summary
This phase focused on achieving a "green" build across all testing layers.
- Frontend Testing: Fixed unit tests in
TransactionFormModal.test.tsxby aligning mock data and making the component's FX rate handling more robust. - E2E Testing: Enabled the previously skipped XIRR test in
analytics.spec.tsby implementing a robust mocking strategy for the holdings API response. - Backend Cleanup: Removed a duplicated code block from
assets.py. - Linting: Cleared residual linter warnings in
AddAwardModal.tsx. - Documentation: Updated
README.md,project_handoff_summary.md, and this log with the latest test coverage statistics and work summary.
File Changes
- Modified:
frontend/src/components/Portfolio/TransactionFormModal.tsx,frontend/src/__tests__/components/Portfolio/TransactionFormModal.test.tsx,frontend/src/components/Portfolio/AddAwardModal.tsx,e2e/tests/analytics.spec.ts,backend/app/api/v1/endpoints/assets.py,README.md,docs/project_handoff_summary.md,docs/workflow_history.md
Outcome
Success. The project has achieved a completely clean state with 100% passing tests (Backend: 165, Frontend: 174, E2E: 31) and no linter errors. The application is ready for backup and deployment.
2025-12-11: Final Stabilization and Test Coverage
Task: Resolve remaining test failures, ensure full test suite stability across all environments, and prepare for release backup.
AI Assistant: Gemini Code Assist Role: Senior Software Engineer
Summary
This phase focused on achieving a "green" build across all testing layers.
- Frontend Testing: Fixed unit tests in
TransactionFormModal.test.tsxby aligning the mock return values forgetFxRatewith the component's logic. UpdatedTransactionFormModal.tsxto robustly handle both object and primitive return types for FX rates. - E2E Testing: Verified and stabilized the E2E suite, ensuring the
corporate-actions.spec.tsandanalytics.spec.tstests pass consistently. - Backend Testing: Confirmed 165 backend tests pass on PostgreSQL and 155 on SQLite.
- Linting: Cleared residual linter warnings in
AddAwardModal.tsx. - Documentation: Updated
README.mdwith the latest test coverage statistics.
File Changes
- Modified:
frontend/src/components/Portfolio/TransactionFormModal.tsx - Modified:
frontend/src/__tests__/components/Portfolio/TransactionFormModal.test.tsx - Modified:
frontend/src/components/Portfolio/AddAwardModal.tsx - Modified:
README.md
Outcome
Success. The project has achieved a completely clean state with 100% passing tests (Backend: 165, Frontend: 174, E2E: 31) and no linter errors. The application is ready for backup and deployment.
2025-12-14: Implement Tax Lot Accounting (FR4.4.3)
Task: Implement "Specific Lot Identification" for sales, allowing users to optimize tax liability (e.g., specific lot selling vs average cost).
AI Assistant: Antigravity Role: Senior Software Engineer
Summary
Implemented the complete backend and frontend infrastructure for Specific Lot Accounting, moving away from a pure Average Cost Basis model while maintaining backward compatibility.
-
Backend Implementation:
- Data Model: Introduced
TransactionLinktable to link SELL transactions to specific BUY lots. - Logic: Implemented
get_available_lotswith FIFO fallback for unlinked transactions. Updatedcrud_holding.pyto calculate Realized P&L using specific linked costs. - Regression Fixes: Refactored Corporate Action handling (Splits/Bonuses) to use event-sourcing instead of history mutation, resolving a double-counting bug.
- Data Model: Introduced
-
Frontend Implementation:
- UI: Updated
TransactionFormModal.tsxto include a "Specify Lots" section for SELL transactions of Stocks/MFs. - UX: Added helper buttons for "FIFO", "LIFO", and "Highest Cost" to auto-fill lot selections.
- UI: Updated
-
Verification:
- New Tests: Created
e2e/tests/tax-lot-selection.spec.ts(UI Flow) andapp/tests/api/v1/test_tax_lot_pnl.py(Backend P&L Logic). - Regression: Full suite passed (Backend: 166 tests, Frontend: 174 tests, E2E: 31 tests).
- New Tests: Created
File Changes
- New:
backend/app/models/transaction_link.py,backend/app/tests/api/v1/test_tax_lot_pnl.py,e2e/tests/tax-lot-selection.spec.ts - Modified:
backend/app/crud/crud_holding.py,backend/app/crud/crud_transaction.py,backend/app/crud/crud_corporate_action.py,frontend/src/components/Portfolio/TransactionFormModal.tsx
Outcome
Success. The system now supports sophisticated tax planning with specific lot identification. Logic is verified by robust integration and E2E tests, and historical data integrity is preserved.
2025-12-23: Implement Dark Theme Support (PR #172)
Task: Implement comprehensive dark mode styling across the ArthSaarthi application, including modals, forms, and all major pages.
AI Assistant: Antigravity Role: Full-Stack Developer
Summary
Implemented class-based dark mode using Tailwind CSS with user preference persistence and system preference detection.
-
Core Infrastructure:
- Enabled
darkMode: 'class'intailwind.config.js. - Created
ThemeContext.tsxwithThemeProvideranduseThemehook. - Added dark mode variants to
index.cssfor buttons, modals, forms, tables, and scrollbars. - Added theme toggle button to
NavBar.tsxwith Sun/Moon icons.
- Enabled
-
Component Styling:
- Modals: BondDetailModal, HoldingDetailModal, FixedDepositDetailModal, RecurringDepositDetailModal, PpfHoldingDetailModal, SessionTimeoutModal, DeleteConfirmationModal.
- Forms: TransactionFormModal (PPF section, INR Conversion, FD selects).
- Goals: GoalList, GoalDetailView.
- Auth: AuthPage, LoginForm.
-
Bug Fixes:
- Fixed FD Compounding/Interest Payout dropdown values (uppercase:
QUARTERLY,CUMULATIVE). - Fixed select element text visibility in dark mode with explicit CSS.
- Updated test expectations in
TransactionFormModal.test.tsx.
- Fixed FD Compounding/Interest Payout dropdown values (uppercase:
File Changes
- New:
frontend/src/context/ThemeContext.tsx - Modified:
tailwind.config.js,frontend/src/index.css,frontend/src/App.tsx,frontend/src/components/NavBar.tsx - Modified: 6 detail modals, 2 auth pages, 2 goal components,
TransactionFormModal.tsx,DeleteConfirmationModal.tsx,SessionTimeoutModal.tsx - Modified:
frontend/src/__tests__/components/Portfolio/TransactionFormModal.test.tsx(test fix)
Verification
- Tests: Frontend tests pass (175/175), including updated FD test expectations.
- Lint: All linters pass (eslint-disable added for ThemeContext).
Outcome
Success. Dark mode is fully functional with user-persisted preferences and system preference fallback.
2025-12-23: Implement MFCentral CAS Excel Parser (FR7.1.4, Issue #154)
Task: Implement a parser for MFCentral Consolidated Account Statement (CAS) Excel files to import Mutual Fund transactions.
AI Assistant: Antigravity Role: Full-Stack Developer
Summary
Implemented MfCentralParser to parse MFCentral CAS Excel files, supporting:
- Purchases: Regular, SIP, BSE, Online
- Redemptions: All types
- Dividends: IDCW Paid (amount stored as quantity×1), IDCW Reinvestment
- Switches: Switch In/Out (non-merger)
- Skipped: Merger transactions (for future corporate action feature), admin updates
File Changes
Backend:
* New: backend/app/services/import_parsers/mfcentral_parser.py - Main parser class
* New: backend/app/tests/services/test_mfcentral_parser.py - Unit tests
* New: backend/app/tests/assets/sample_mfcentral.xlsx - Anonymized sample file
* New: backend/app/tests/services/__init__.py - Package init
* Modified: backend/app/services/import_parsers/parser_factory.py - Register parser
* Modified: backend/app/api/v1/endpoints/import_sessions.py - Excel file detection
* Modified: backend/app/crud/crud_holding.py - Add 'MUTUAL_FUND' to group_map
Frontend:
* Modified: frontend/src/pages/Import/DataImportPage.tsx - Add MFCentral dropdown & .xlsx accept
* Modified: frontend/src/pages/Import/ImportPreviewPage.tsx - Fix ticker text wrapping
* Modified: frontend/src/components/modals/AssetAliasMappingModal.tsx - MF search via AMFI API
* Modified: frontend/src/hooks/useImport.ts - Add holdings/summary cache invalidation
* Modified: frontend/src/hooks/usePortfolio.ts - Add assetType param to search hook
* Modified: frontend/src/services/portfolioApi.ts - Add 'Mutual Fund' type
Verification
- Unit Tests: 11 tests covering transaction classification, date parsing, dividend handling
- Manual Testing: Successfully imported MFCentral CAS file with 59+ transactions
- MF Asset Creation: Assets created with 'Mutual Fund' type for NAV fetching
- Holdings Display: Imported MFs appear in "Equities & Mutual Funds" section
Outcome
Success. Users can now import MF transactions from MFCentral CAS Excel files via the Import page. MF assets are created via AMFI search with proper asset type for price data integration.
2025-12-23: Implement CAMS Excel Parser (FR7.1.5, Issue #155)
Task: Implement a parser for CAMS Excel files to import Mutual Fund transactions.
AI Assistant: Antigravity Role: Full-Stack Developer
Summary
Implemented CamsParser to parse CAMS Excel files with special handling:
- IDCW Reinvestment: Creates 2 transactions (DIVIDEND + BUY)
- Ticker Symbol: Merges MF_NAME + SCHEME_NAME for full fund name
- Transaction Types: Purchase, SIP, Redemption, IDCW Paid/Reinvest
- Skipped: Merger transactions, admin updates
File Changes
Backend:
* New: backend/app/services/import_parsers/cams_parser.py - Parser class
* New: backend/app/tests/services/test_cams_parser.py - 11 unit tests
* New: backend/app/tests/assets/sample_cams.xlsx - Anonymized sample
* Modified: backend/app/services/import_parsers/parser_factory.py - Register parser
* Modified: backend/app/api/v1/endpoints/import_sessions.py - CAMS handling
Frontend:
* Modified: frontend/src/pages/Import/DataImportPage.tsx - Add dropdown option
Verification
- Unit Tests: 11 tests pass covering all transaction types
- IDCW Reinvestment: Verified dual-transaction creation
Outcome
Success. Users can now import MF transactions from CAMS Excel files. IDCW Reinvestment correctly recorded as both dividend income and reinvestment purchase.
2025-12-24: Implement Zerodha Coin MF Parser (FR7.1.7, Issue #158)
Task: Implement a parser for Zerodha Coin MF tradebook exports.
AI Assistant: Antigravity Role: Full-Stack Developer
Summary
Implemented ZerodhaCoinParser for Zerodha Coin MF exports (CSV/XLSX):
- Simple Format: symbol, trade_date, trade_type (buy/sell), quantity, price
- Transaction Types: BUY and SELL only (no dividends in Coin exports)
- Asset Mapping: Uses AMFI MF search for scheme name matching
File Changes
Backend:
* New: backend/app/services/import_parsers/zerodha_coin_parser.py
* New: backend/app/tests/services/test_zerodha_coin_parser.py - 8 tests
* New: backend/app/tests/assets/sample_zerodha_coin.csv
* Modified: backend/app/services/import_parsers/parser_factory.py
Frontend:
* Modified: frontend/src/pages/Import/DataImportPage.tsx
* Modified: frontend/src/components/modals/AssetAliasMappingModal.tsx
Verification
- Unit Tests: 8 tests pass
- Manual Testing: Import verified from both CSV and XLSX
Outcome
Success. Users can now import MF transactions from Zerodha Coin exports.
2025-12-24: Implement KFintech PDF Parser (FR7.1.6, Issue #156)
Task: Implement a parser for KFintech (formerly Karvy) PDF statements.
AI Assistant: Antigravity Role: Full-Stack Developer
Summary
Implemented KFintechParser for password-protected PDF statements:
- Password Handling: Returns PASSWORD_REQUIRED error for encrypted PDFs
- Transaction Types: Purchase, SIP Purchase, IDCW Reinvestment, Redemption
- IDCW Reinvestment: Creates DIVIDEND + BUY (like CAMS)
- Skipped: Stamp Duty, TDS, Merger transactions, admin updates
- pdfplumber: Added to requirements.txt
File Changes
Backend:
* New: backend/app/services/import_parsers/kfintech_parser.py
* New: backend/app/tests/services/test_kfintech_parser.py - 12 tests
* Modified: backend/app/services/import_parsers/parser_factory.py
* Modified: backend/app/api/v1/endpoints/import_sessions.py - PDF handling
* Modified: backend/requirements.txt - pdfplumber
Frontend:
* Modified: frontend/src/pages/Import/DataImportPage.tsx
* Modified: frontend/src/components/modals/AssetAliasMappingModal.tsx
Verification
- Unit Tests: 12 tests pass (208 backend tests total)
Outcome
Success. Users can now import MF transactions from KFintech PDF statements.
2026-01-04: Implement Benchmark Comparison (FR6.3)
Task: Implement benchmark comparison feature (FR6.3), allowing users to compare their portfolio's XIRR against a hypothetical investment in Nifty 50 or Sensex.
AI Assistant: Antigravity Role: Full-Stack Developer
Summary
Implemented a "Benchmark Comparison" feature that answers the question: "What if I had invested in Nifty 50 instead?"
- XIRR Comparison: Calculates the XIRR of a hypothetical benchmark portfolio with identical cash flows (dates and amounts).
- Visual Comparison: Chart showing "Invested Amount" vs "Hypothetical Benchmark Value" over time.
- Indices: Supports Nifty 50 (^NSEI) and Sensex (^BSESN).
- Caching: Historical index data is cached in Redis (24h TTL) to minimize external API calls.
File Changes
Backend:
* Modified: backend/app/services/benchmark_service.py - Added calculate_benchmark_performance method using pyxirr.
* Modified: backend/app/services/providers/yfinance_provider.py - Added get_index_history with caching.
* Modified: backend/app/api/v1/endpoints/portfolios.py - Added GET /:id/benchmark endpoint.
* Modified: backend/app/models/transaction.py - Updated docstrings.
Frontend:
* New: frontend/src/components/Portfolio/BenchmarkComparison.tsx - ChartJS visualization of benchmark performance.
* Modified: frontend/src/pages/Portfolio/PortfolioDetailPage.tsx - Integrated comparison chart.
* Modified: frontend/src/hooks/usePortfolios.ts - Added useBenchmarkComparison hook.
Verification
- Unit Tests: Added
test_benchmark_service.pycovering XIRR calculation, zero-value handling, and caching scenarios. All passed. - Linting: Resolved all E501 (line length) and TypeScript
anyerrors. - Manual Verification: Verified chart rendering and XIRR values against manual calculations for known cash flows.
Outcome
Success. Users can now verify if they are beating the market index (Alpha) directly from the portfolio dashboard.
2026-01-05: Dark Theme UI Polish (Fixes)
Task: Resolve specific dark mode visibility issues reported by the user in the Restore modal and Portfolio History chart.
AI Assistant: Antigravity Role: Frontend Developer
Summary
Addressed visibility regressions where text was unreadable in dark mode: - Restore Modal: The "DELETE" confirmation input now has proper dark background and light text. - Portfolio History: Inactive retention range buttons (1D, 7D etc.) now have dark mode variants.
File Changes
Frontend:
* Modified: frontend/src/components/Profile/BackupRestoreCard.tsx - Added dark:text-white etc. to input.
* Modified: frontend/src/components/Dashboard/PortfolioHistoryChart.tsx - Added dark variants to range buttons.
Outcome
Success. Restored usability for critical actions and charts in dark mode.