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.
stocks
exchange_traded_funds
equity_funds
corporate_bonds
bond_partial_calls
bond_funds
fixed_income_etfs
treasuries
money_market_funds
cash_holding
options
allocation
sector_allocation
assets_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_returns
risk_measures_report
standard_deviation
annualized_standard_deviation
variance
sharpe_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