Performance
The Performance module calculates important performance metrics such as the Sharpe Ratio, Sortino Ratio, Treynor Ratio, Information Ratio, Jensen’s Alpha, Beta, Capital Asset Pricing Model (CAPM), R-Squared and more.
Every function of the Performance module has its own page with an example and its parameters. Pick one from the sidebar on the left.Every function of the Performance module has its own page with an example and its parameters. Pick one from the .
To install the FinanceToolkit it simply requires the following:
pip install financetoolkit -U
Getting Started
It gives insights in the performance a stock has to e.g. a benchmark that is not easily identified by looking at the raw data. This class is closely related to the Risk class which highlights things such as Value at Risk (VaR) and Maximum Drawdown.
The Performance module is reached through a Toolkit instance, as shown below.
from financetoolkit import Toolkit
toolkit = Toolkit(["AAPL", "TSLA"], api_key="FINANCIAL_MODELING_PREP_KEY")
toolkit.performance.get_capital_asset_pricing_model(period='quarterly')
Which returns:
| Date | AAPL | TSLA |
|---|---|---|
| 2022Q3 | -0.0684 | -0.1047 |
| 2022Q4 | 0.0857 | 0.0828 |
| 2023Q1 | 0.075 | 0.1121 |
| 2023Q2 | 0.0922 | 0.1342 |
| 2023Q3 | 0.0052 | -0.0482 |
The sidebar gives access to every metric in the Performance module, each on its own page with a description, an example and its parameters. Pick one there to open it.The sidebar gives access to every metric in the Performance module, each on its own page with a description, an example and its parameters. On a phone, open the to pick one.