Financetoolkit

Latest version: v2.0.0

Safety actively analyzes 712615 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 13

26.99

21.0077

Next to that, I've also grouped the TQDM statements when using Ratios or Models. So instead of 5 bars, it displays just 2. Furthermore, I've extended the custom ratios functionality, see [here](https://www.jeroenbouma.com/projects/financetoolkit/custom-ratios).

2.0.0

It has been a long time since I made a significant update as I was working on the v2.0.0 of the Finance Toolkit featuring numerous improvements to the code as well as major new additions.

Portfolio Functionalities

I've added a brand new class to the Finance Toolkit called `Portfolio` (use `from financetoolkit import Portfolio`) which allows you to load in your own transactions data and see performance over any period of time (as opposed to some benchmark). For a full list of details see [here](https://github.com/JerBouma/FinanceToolkit?tab=readme-ov-file#portfolio-evaluation). Some things that are now possible:

- Load in your own transactions data, based on a custom template that is provided automatically when initializing the class.
- See an overview of your entire portfolio including invested amount, current value, return, benchmark return, alpha, beta and more.
- Explore individual transactions and see how they have contributed to the overall performance of your portfolio. This also allows you to get a breakdown per period whether it be weekly, monthly, quarterly or yearly.
- Delve deeper into how your portfolio performed with daily (cumulative) returns, portfolio weights and more.

As a simple example:

![image](https://github.com/user-attachments/assets/5929fdf4-6c5e-4c27-a9d5-d9a4e4b34e29)

This is however only minor as opposed to the integration with the Finance Toolkit itself meaning that you are able to use all of the 150+ metrics directly with your own portfolio. It also includes a "Portfolio" ticker which represents the weighted sum *over time* of your assets in the portfolio. As an example

python
from financetoolkit import Portfolio

instance = Portfolio(example=True, api_key="FMP_KEY")

profit_margin = instance.toolkit.ratios.get_net_profit_margin()


Which returns when plotted for the Portfolio the following:

![image](https://github.com/user-attachments/assets/474a0ad3-3398-4bb0-aaf1-88ef73bb26b8)

This makes it so that you can not only evaluate your portfolio through basic OHLC data but also understand the financial health of the companies you are invested in and how this impacts your overall portfolio.

Caching Capabilities

I've had this request a couple of times now and given the ever-growing size of the project it made sense to integrate caching functionalities. When using `use_cached_data=True` when you initialize the Finance Toolkit any of the core functionalities will automatically be saved to a pickle file (e.g. if you collect a balance sheet statement, these will be saved to the `cached` folder under `balance_sheet_statement.pickle`). If you then re-run the Finance Toolkit you will notice the data collection is instant, this is because the data is loaded from the pickle file.

As an example:

<img width="1000" alt="image" src="https://github.com/user-attachments/assets/943a1cfb-95ad-4455-90f0-0b33dcd7b0df" />

If I wish to receive this data again, I no longer need an API key or set the tickers and can simply keep `use_cached_data=True`.

<img width="1000" alt="image" src="https://github.com/user-attachments/assets/29ef58ca-e208-4c9a-b663-f66b299d3188" />

Please note that it will force the settings as found in the pickle files so if you wish to use a different time period, you will have to recollect.

<img width="1000" alt="image" src="https://github.com/user-attachments/assets/40229dcb-18f0-4e73-8a43-017b1b25d33f" />

You can also change the folder by entering a string instead of a boolean for the `use_cached_data` parameter.

<img width="1000" alt="image" src="https://github.com/user-attachments/assets/a6710d20-55b9-48f1-812e-4ff4fbe06a15" />

Global Macro Database Integration

I've seen the work from Karsten Muller related to the "Global Macro Database" project (see [LinkedIn](https://www.linkedin.com/posts/krstnmllr_global-macro-database-activity-7292566677659992064-UYC_/?utm_source=share&utm_medium=member_desktop&rcm=ACoAABhYAQUBkaNnlBjz_IYBRfaurU68rfoZPE8) and the GitHub project [here](https://github.com/KMueller-Lab/Global-Macro-Database)) which has Economics metrics going back all the way to the 1800s. An invaluable resource which I've integrated into the Finance Toolkit as well. You will see that the [Key Economic Indicators](https://github.com/JerBouma/FinanceToolkit?tab=readme-ov-file#key-economic-indicators) list is therefore greatly expanded.

The current list of Economic parameters is:

- Gross Domestic Product (GDP)
- Total Consumption
- Total Investment
- Total Fixed Investment
- Exports
- Imports
- Current Account Balance
- Government Debt
- Government (Tax) Revenue
- Government Expenditure
- Government Deficit
- Trust in Government
- Consumer Price Index (CPI)
- Inflation Rate
- Consumer Confidence Index (CCI)
- Business Confidence Index (BCI)
- Composite Leading Indicator (CLI)
- House Prices
- Rent Prices
- Share Prices
- Exchange Rates
- Money Supply
- Central Bank Policy Rate
- Long Term Interest Rates (10 year)
- Short Term Interest Rates (3 month)
- Renewable Energy as % of Total Energy
- Carbon Footprint
- Unemployment Rate
- Labour Productivity
- Income Inequality
- Population
- Poverty Rate

Many Bugfixes and Improvements

I've added better error handling for Bandwidth Limits, more information when data is collected from a different source, numerous minor fixes e.g. recalculating ratios found in the financial statements when applying trailing (172 and 173) and cleaned up a lot of other details.

The Streamlit Dashboard is also updated with new additions including a brand new Portfolio Dashboard, see below:

<a href="https://www.jeroenbouma.com/projects/financetoolkit/interactive-dashboard"><img width="1508" alt="image" src="https://github.com/user-attachments/assets/df95ee72-9322-425f-aecb-722b2c7cee23" /></a>

1.88

| Strike Price | 2020-01-03 | 2020-01-04 | 2020-01-05 | 2020-01-06 | 2020-01-07 | 2020-01-08 | 2020-01-09 | 2020-01-10 | 2020-01-11 | 2020-01-12 | 2020-01-13 | 2020-01-14 | 2020-01-15 | 2020-01-16 | 2020-01-17 | 2020-01-18 | 2020-01-19 | 2020-01-20 | 2020-01-21 |
|---------------:|-------------:|-------------:|-------------:|-------------:|-------------:|-------------:|-------------:|-------------:|-------------:|-------------:|-------------:|-------------:|-------------:|-------------:|-------------:|-------------:|-------------:|-------------:|-------------:|
| 130 | -0 | -0 | -0 | -0 | -0 | -0 | -0 | -0 | -0.0001 | -0.0002 | -0.0004 | -0.0008 | -0.0015 | -0.0026 | -0.0041 | -0.0062 | -0.0089 | -0.0124 | -0.0167 |
| 135 | -0 | -0 | -0 | -0 | -0 | -0.0001 | -0.0003 | -0.001 | -0.0022 | -0.0043 | -0.0076 | -0.0122 | -0.0185 | -0.0265 | -0.0365 | -0.0486 | -0.0629 | -0.0794 | -0.0982 |
| 140 | -0 | -0 | -0 | -0.0003 | -0.0015 | -0.0045 | -0.0101 | -0.0192 | -0.0322 | -0.0493 | -0.0709 | -0.0968 | -0.1271 | -0.1616 | -0.2003 | -0.2429 | -0.2895 | -0.3397 | -0.3934 |
| 145 | -0 | -0.0004 | -0.0047 | -0.017 | -0.0396 | -0.0727 | -0.1156 | -0.1676 | -0.2277 | -0.295 | -0.3689 | -0.4486 | -0.5335 | -0.6233 | -0.7174 | -0.8154 | -0.917 | -1.022 | -1.13 |
| 150 | -0.0055 | -0.0485 | -0.1251 | -0.223 | -0.3353 | -0.4579 | -0.5883 | -0.7249 | -0.8666 | -1.0125 | -1.162 | -1.3145 | -1.4698 | -1.6275 | -1.7873 | -1.949 | -2.1125 | -2.2776 | -2.4442 |
| 155 | -0.2302 | -0.4512 | -0.671 | -0.8903 | -1.1094 | -1.3284 | -1.5474 | -1.7663 | -1.9853 | -2.2043 | -2.4234 | -2.6425 | -2.8617 | -3.081 | -3.3004 | -3.5198 | -3.7393 | -3.9589 | -4.1785 |
| 160 | -0.4343 | -0.8348 | -1.2016 | -1.5461 | -1.8754 | -2.1938 | -2.504 | -2.8078 | -3.1063 | -3.4006 | -3.6912 | -3.9787 | -4.2636 | -4.5461 | -4.8265 | -5.1051 | -5.382 | -5.6574 | -5.9314 |
| 165 | -0.452 | -0.9034 | -1.35 | -1.7871 | -2.2125 | -2.6264 | -3.0295 | -3.4229 | -3.8077 | -4.1848 | -4.5552 | -4.9194 | -5.2782 | -5.6322 | -5.9817 | -6.3272 | -6.6691 | -7.0076 | -7.3431 |
| 170 | -0.4657 | -0.9314 | -1.397 | -1.8618 | -2.3248 | -2.7846 | -3.2402 | -3.6907 | -4.1358 | -4.5753 | -5.0092 | -5.4376 | -5.8608 | -6.2788 | -6.6921 | -7.1007 | -7.5049 | -7.9051 | -8.3013 |

Furthermore, each module now has it's own dedicated Jupyter Notebook. Find all of them below or on my website [here](https://www.jeroenbouma.com/projects/financetoolkit).

- [Getting Started](https://www.jeroenbouma.com/projects/financetoolkit/getting-started)
- [Discovery Module](https://www.jeroenbouma.com/projects/financetoolkit/discovery-module)
- [Ratios Module](https://www.jeroenbouma.com/projects/financetoolkit/ratios-module)
- [Models Module](https://www.jeroenbouma.com/projects/financetoolkit/models-module)
- [Options Module](https://www.jeroenbouma.com/projects/financetoolkit/options-module)
- [Technicals Module](https://www.jeroenbouma.com/projects/financetoolkit/technicals-module)
- [Risk Module](https://www.jeroenbouma.com/projects/financetoolkit/risk-module)
- [Performance Module](https://www.jeroenbouma.com/projects/financetoolkit/performance-module)
- [Economics Module](https://www.jeroenbouma.com/projects/financetoolkit/economics-module)
- [External Datasets](https://www.jeroenbouma.com/projects/financetoolkit/external-datasets)

1.9.9

Functionality for the Economics menu broke due to the fact I forgot to include headers into my request towards OECD, thanks for reporting 162. Furthermore, the Close and Adj Close price were the same for data acquired from Yahoo Finance, this has now been fixed and is correct. I've also suppressed Yahoo Finance logging messages as I'll handle all of it myself as well.

1.9.8

This release features a fix to issues with Yahoo Finance which is used as a fallback whenever FinancialModelingPrep doesn't have the data or because your plan limits you from accessing this data. E.g. if you have the Free plan you can only get historical data on U.S. listed stocks so all other historical data comes from Yahoo Finance. I used to directly query from Yahoo Finance myself but given that it can break over time, it makes more sense to add in an optional dependency (`yfinance`). This means that by default this dependency is not installed given that the Finance Toolkit doesn't have to rely on this package if you have the proper FMP plan.

This is what I am referring to (see "The following tickers acquired historical data..")

<img width="672" alt="image" src="https://github.com/user-attachments/assets/bddd9a4e-8e57-430e-aff0-3e52a3695ff9">

In case you've used `pip install financetoolkit -U` in a new environment you will receive the following message when you have a Free plan and try to download data on stocks not on U.S. exchanges:

<img width="999" alt="image" src="https://github.com/user-attachments/assets/e2393e7b-747d-46c8-bd02-82064cad6d7e">

As can be read, this can be resolved by using `pip install 'financetoolkit[yfinance]'` as shown below:

<img width="1040" alt="image" src="https://github.com/user-attachments/assets/840b67cf-dbb9-4867-8db9-a3563aeb90f6">

Page 1 of 13

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.