The Portfolio class consists of three main components: PDF Scraper, Assets, and Performance.
The Assets component is responsible for managing and processing individual portfolio holdings. Key properties include stocks, ETFs, funds, bonds, and various allocation metrics. Users can scrape data from a Schwab PDF statement and calculate asset and sector allocations.
stocksexchange_traded_fundsequity_fundscorporate_bondsbond_partial_callsbond_fundsfixed_income_etfstreasuriesmoney_market_fundscash_holdingoptionsallocationsector_allocationassets_sorted_by_sector
stocks = portfolio.assets.stocks
corporate_bonds = portfolio.assets.corporate_bonds
asset_allocation = portfolio.assets.allocation
sector_allocation = portfolio.assets.sector_allocation
The Performance component calculates returns and risk measures for the portfolio. Properties include time-weighted returns, risk measures report, standard deviation, annualized standard deviation, variance, and Sharpe ratio. Users can calculate the time-weighted return and various risk measures.
time_weighted_returnsrisk_measures_reportstandard_deviationannualized_standard_deviationvariancesharpe_ratio
time_weighted_returns = portfolio.performance.time_weighted_returns
risk_measures = portfolio.performance.risk_measures
The Portfolio class instance integrates both the Assets and Performance components. It offers a method, return_contribution, to analyze the contribution of returns to the portfolio.
return_contribution
return_contribution = portfolio.return_contribution