Skip to content

Releases: JerBouma/FinanceToolkit

FinanceToolkit v2.0.6

04 Oct 13:52

Choose a tag to compare

This release fixes issue #192 and #193. I've also transitioned from poetry to uv as package manager and builder.

Full Changelog: v2.0.5...v2.0.6

FinanceToolkit v2.0.5

10 Sep 16:55

Choose a tag to compare

As reported by #190, the endpoints used within the Finance Toolkit used a retired version of the FMP API. This led to new API keys not being able to collect any data. I have fixed this issue by changing all endpoints to the stable release. This does mean that the data can be slightly different or certain API calls under the Free plan are more limited.

Furthermore, Option Chains and Implied Volatilty calculations failed. This has now been resolved by using yfinance in these functions.

Full Changelog: v2.0.4...v2.0.5

FinanceToolkit v2.0.4

10 Jul 11:20

Choose a tag to compare

Minor update that adds some more unit tests and fixes an issue with caching not working due to a missing file. I've also worked on better Yahoo Finance error handling given that you'll hit the rate limit much quicker nowadays.

FinanceToolkit v2.0.3

01 May 10:09

Choose a tag to compare

With the 2.0.3 release of the Finance Toolkit, I've added in proper support for Yahoo Finance (through yfinance) which serves as a fallback system when data from Financial Modeling Prep is not available. This makes it possible to do any of the calculations regardless of your current Financial Modeling Prep subscription level.

The only downside is that Yahoo Finance only provides 4 years or 5 quarters meaning that for longer periods a subscription with Financial Modeling Prep is still required (get 15% off here). Don't want this behaviour? Use enforce_source='FinancialModelingPrep' to force the use of Financial Modeling Prep data only. If you want to force the use of Yahoo Finance, set enforce_source='YahooFinance'.

For example:

image

If I would now force FinancialModelingPrep, I will not be able to acquire all data:

image

Furthermore, I've introduced daily calculations for ratios that use stock data. As an example:

image

I've also added in proper logging which fixes #181. Furthermore, I've added a lot more robustness to the Finance Toolkit and moved around a bunch of files making some .py files less bulky.

FinanceToolkit v2.0.2

08 Apr 19:28

Choose a tag to compare

A few improvements:

  • All balance sheet items used in the Ratios and Models modules where calculated wrongly when the trailing parameter was used. By default it would take the rolling sum. This is however incorrect as it would sum for example the inventory of four quarters instead of taking the average over the period. This has been corrected!
  • Changed API endpoint to support the collection of Product and Geographic and Product Revenue Segmentations for Free users. This resolves issue #179.
  • Added more error handling for the Historical data which didn't always report the correct error.
  • Limited the dependencies of the Finance Toolkit to only those that are required and nothing else.

FinanceToolkit v2.0.1

08 Apr 19:03
b134ced

Choose a tag to compare

Added in Python 3.13 support which made sense to include given that all dependencies of the Finance Toolkit added support for this Python release as well.

FinanceToolkit v2.0.0

01 Mar 17:31

Choose a tag to compare

have been working on the v2.0.0 of the Finance Toolkit for a while which features numerous improvements to the code as well as major new additions. Install the Finance Toolkit now to get started with 150+ metrics!

pip install financetoolkit -U

In Python:

from financetoolkit import Toolkit

companies = Toolkit(
    tickers=['GOOGL', 'MSFT', 'AMZN'],
    api_key="FINANCIAL_MODELING_PREP_KEY",
)

Find a variety of How-To Guides including Code Documentation for the FinanceToolkit here.


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. 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.

It is important to note that it requires a specific Excel template to work, see for further instructions the following notebook here.


As a simple example:

from financetoolkit import Portfolio

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

instance.get_portfolio_overview()

The table below shows one of the functionalities of the Portfolio module but is purposely shrunken down given the >30 assets.

Identifier Volume Costs Price Invested Latest Price Latest Value Return Return Value Benchmark Return Volatility Benchmark Volatility Alpha Beta Weight
AAPL 137 -28 38.9692 5310.78 241.84 33132.1 5.2386 27821.3 2.2258 0.3858 0.1937 3.0128 1.2027 0.0405
ALGN 81 -34 117.365 9472.53 187.03 15149.4 0.5993 5676.9 2.1413 0.5985 0.1937 -1.542 1.5501 0.0185
AMD 78 -30 11.9075 898.784 99.86 7789.08 7.6662 6890.3 3.7945 0.6159 0.1937 3.8718 1.6551 0.0095
AMZN 116 -28 41.5471 4791.46 212.28 24624.5 4.1392 19833 1.8274 0.4921 0.1937 2.3118 1.1594 0.0301
ASML 129 -25 33.3184 4273.07 709.08 91471.3 20.4065 87198.3 3.8005 0.4524 0.1937 16.606 1.4407 0.1119
VOO 77 -12 238.499 18352.5 546.33 42067.4 1.2922 23715 1.1179 0.1699 0.1937 0.1743 0.9973 0.0515
WMT 92 -18 17.8645 1625.53 98.61 9072.12 4.581 7446.59 2.4787 0.2334 0.1937 2.1024 0.4948 0.0111
Portfolio 2142 -532 59.8406 128710 381.689 817577 5.3521 688867 2.0773 0.4193 0.1937 3.2747 1.2909 1

In which the weights and returns can be depicted as follows:

image

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

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

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:

image

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.

image

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.

image

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

image

Global Macro Database Integration

I've seen the work from Karsten Muller related to the "Global Macro Database" project (see LinkedIn and the GitHub project here) 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 list is therefore greatly expanded.

As an example:

from financetoolkit import Economics

economics = Economics(api_key=API_KEY, start_date="2017-12-31")

economics.get_unemployment_rate()

image

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:

image

FinanceToolkit v1.9.9

12 Dec 18:21

Choose a tag to compare

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.

FinanceToolkit v1.9.8

29 Sep 09:35

Choose a tag to compare

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..")

image

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:

image

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

image

FinanceToolkit v1.9.6

07 Sep 12:52

Choose a tag to compare

The last couple of releases were all minor bugfixes therefore it didn't merit a proper release. However, for this one quite a fix things under the hood have changed entirely inside the Economy menu. Given that OECD recently updated their databases, all of the original links broke and therefore needed fixing. This unfortunately also resulted in some functionality being scrapped given that the datapoints were archived altogether.

Furthermore, I am aware of issues with Yahoo Finance's data download. You won't notice any to this when using an API Key from FMP but if you don't, I had built a fallback method that went to Yahoo Finance. Given that Yahoo Finance doesn't officially support the collection of data for now this functionality within the Finance Toolkit won't function (it will return 0s). I have still to consider whether to remove the functionality altogether or come up with a fix (however given that it is unofficial, things can break at any time again). Given that the package yfinance exists, I might introduce it as an add-on if you still wish to have this functionality.

Please let me know if you do.