A comprehensive financial portfolio analysis system that processes stock prices, bookings, and generates detailed financial reports. The system integrates with Yahoo Finance for price data and produces 30+ different Excel reports for portfolio analysis.
- Multi-bank portfolio tracking with position and value calculations
- Automated price data updates using Yahoo Finance API
- Transaction processing from Excel booking files
- Comprehensive reporting with 30+ configurable Excel exports
- Time series analysis with daily, monthly, and yearly aggregations
- Intelligent yield calculations with accurate handling of large transactions
- Production deployment via Windows Task Scheduler
- Fixed bug in
prices_update()where a single globallast_datewas used for all instruments - A transient yfinance failure for one WKN could cause a permanent gap in price data
- Each WKN now independently tracks its own last known date and catches up from there
- Prevents silent data gaps even when other instruments are fully up to date
- New profitability analysis table showing annual yields with holding period transparency
- Displays days held and annual yield percentage for each instrument per year
- Cash excluded from profitability calculations to maintain data quality
- Custom Excel export with dynamic formatting (scales automatically with portfolio growth)
- Time-Weighted Return (TWR) formula for accurate multi-period performance measurement
- Implemented intelligent denominator selection for yield calculations
- Prevents extreme yield percentages (100%+) on first trading days and depot transfers
- Handles large transactions (>50% of portfolio) with transaction-based denominators
- Improved accuracy of total return analysis with proper component breakdown
Install required packages:
pip install -r requirements.txt
pip install ahlibdepot.py- Main application with 8-step data processing pipelinedepot.ini- Configuration file controlling all input/output settingsprices.parquet- Local price data cachestart_depot.bat- Production batch file for scheduled executionrequirements.txt- Python dependenciesCLAUDE.md- Technical documentation for developers
python depot.pystart_depot.batThe application follows an 8-step data processing pipeline:
- Configuration loading
- Financial instruments import
- Price data processing
- Transaction bookings processing
- Share position calculations
- Portfolio value calculations
- Provisions and fees processing
- Excel report generation
Data is processed using pandas MultiIndex DataFrames with time series operations for financial analysis.
For accurate yield calculations, ensure:
transaction_value_at_priceis filled for all buy/sell transactions- Formula:
transaction_value_at_price = -(delta × price) - Depot transfers have balanced bookings (sum to zero)
- Interest/dividends use
interest_dividendscolumn, not transaction_value