Calculate portfolio performance metrics for a specified period.

This method calculates key performance metrics, such as returns, for the portfolio over a specified period. The available periods are ‘yearly’, ‘quarterly’, ‘monthly’, ‘weekly’, and ‘daily’. It uses the positions overview dataset for these calculations. If the necessary data has not been collected, it triggers the collection of historical and benchmark data.

Portfolio Performance in Python

Install the Finance Toolkit with:

pip install financetoolkit -U

Then call get_portfolio_performance as shown below.

from financetoolkit import Portfolio

portfolio = Portfolio(example=True, api_key="FINANCIAL_MODELING_PREP_KEY")

portfolio.get_portfolio_performance(period='weekly')

Which returns:

  Volume Costs Invested Amount Realized Proceeds Dividends Current Value Invested Weight Current Weight Return
(Period(‘2026-10-05/2026-10-11’, ‘W-SUN’), ‘META’) 15 -1 4813.61 0 81.125 10780 0.0357 0.0099 1.2563
(Period(‘2026-10-05/2026-10-11’, ‘W-SUN’), ‘MPWR’) 116 -27 30636 449.4 3301.39 160810 0.2272 0.147 4.3715
(Period(‘2026-10-05/2026-10-11’, ‘W-SUN’), ‘MSFT’) 105 -11 5529.99 147.7 3367.52 56182.3 0.041 0.0513 9.7952
(Period(‘2026-10-05/2026-10-11’, ‘W-SUN’), ‘NFLX’) 114 -32 1666.89 211.515 0 8014.2 0.0124 0.0073 3.9348
(Period(‘2026-10-05/2026-10-11’, ‘W-SUN’), ‘NVDA’) 69 -27 202.909 31.547 49.646 15820.3 0.0015 0.0145 77.3678
(Period(‘2026-10-05/2026-10-11’, ‘W-SUN’), ‘OXY’) 27 -15 2005.56 435.898 876.077 1622.97 0.0149 0.0015 0.4634
(Period(‘2026-10-05/2026-10-11’, ‘W-SUN’), ‘SKY’) 126 -23 3343.23 265.99 901.062 10033.4 0.0248 0.0092 2.3502
(Period(‘2026-10-05/2026-10-11’, ‘W-SUN’), ‘VOO’) 77 -12 20238.2 368.76 3863.3 55100.4 0.1501 0.0504 1.9317
(Period(‘2026-10-05/2026-10-11’, ‘W-SUN’), ‘VSS’) 98 -21 10366.5 997.66 3122.51 15201.8 0.0769 0.0139 0.8639
(Period(‘2026-10-05/2026-10-11’, ‘W-SUN’), ‘WMT’) 92 -18 2265.02 167.39 965.758 10244.2 0.0168 0.0094 4.0231

Parameters

get_portfolio_performance accepts the following parameters.

ParameterTypeDescriptionExample
periodstr | NoneThe time period for which portfolio performance metrics should be calculated. It can be one of the following: ‘yearly’, ‘quarterly’, ‘monthly’, ‘weekly’, or ‘daily’. If None, the default period is ‘quarterly’ (if the ‘quarterly’ attribute is set to True), otherwise, it defaults to ‘yearly’."quarterly"
exclude_sold_positionsboolA flag indicating whether to exclude sold positions. Defaults to True.False
roundingint | NoneThe number of decimal places to round the output to. If None, it defaults to the rounding precision specified in the configuration.2
Share