Skip to content

Releases: JerBouma/FinanceToolkit

FinanceToolkit v1.3.8

26 Sep 13:57
Compare
Choose a tag to compare

A user of the Finance Toolkit reported some issues with the dividends. Noticed it was unfortunately broken. This has now been fixed. Other than that, I've updated a couple of docstrings.

image

FinanceToolkit v1.3.7

23 Sep 19:35
Compare
Choose a tag to compare

This release adds a minor, but important, function (get_historical_statistics) that shows in what currency the historical data is denoted. Besides that, it also gives some insights since when the product was traded and in what timezone it belongs.

image

FinanceToolkit v1.3.6

19 Sep 20:25
Compare
Choose a tag to compare

This version introduces ISIN support. If you submit an ISIN, it will find the relevant symbol and use that instead. It will also mention to what symbol it made the conversion so it is clear what ticker to look at. I've also added some dependencies, mostly a clean-up (I was struggling with getting SciPy to work, now this is built in with Pandas). Next to that, I've added the Finance Database as a dependency as in the future the Finance Toolkit will feature functionality from this database.

image

FinanceToolkit v1.3.5

17 Sep 18:39
Compare
Choose a tag to compare

This is a minor release getting some bugfixes in and making the code a bit more robust. Less errors should now occur when you do not have the correct API key set and someone noticed that if you call the Statistics functionality before anything else it returns an error. This is now fixed.

If you feel like any functionality is missing, definitely let me know and we can start adding them in!

FinanceToolkit v1.3.4

12 Sep 17:59
Compare
Choose a tag to compare

This release introduces two new models which are the Weighted Average Cost of Capital (WACC) and the Intrinsic Valuation.

As an example, see the WACC below. For the method of calculation please see here.

image

Furthermore, the Intrinsic Valuation attempts to calculate the intrinsic value of an asset. This does require some manual input through which are growth, perpetual growth and WACC numbers given that this model is highly subjective and asset dependent.

image

The growth numbers can be specified for each asset individually as well. For the method of calculation please see here.

image

Next to that, I've introduced trailing calculations for the Financial Statements and Ratios. As an example, you can now see the Trailing P/E ratio with the following code. Note that you need to have quarterly=True to get the actual TTM (otherwise you will take the trailing value over 4 years).

image

FinanceToolkit v1.3.3

10 Sep 16:31
Compare
Choose a tag to compare

This new release features a whole lot of new features yet again. This includes the following:

Performance Metrics

There is now a large list of performance metrics to be found in the performance class in similar fashion as e.g. ratios. This gets you the following:

  • Alpha
  • Jensen's Alpha
  • Beta
  • Capital Asset Pricing Model (CAPM)
  • Treynor Ratio
  • Sharpe Ratio
  • Sortino Ratio
  • Ulcer Performance Index (UPI)
  • M2 Ratio
  • Tracking Error
  • Information Error

This is an extra powerful class as you can get these ratios "within" periods. This means that if you select the period "quarterly", it will calculate the ratios for the days within each quarter. As an example:

image

Risk Metrics

Not only Performance Metrics are added in but courtesy of @northern-64bit, it is now also possible to observe the following risk metrics:

  • Value at Risk (VaR) with distributions Historical, Gaussian, Student-t, Cornish-Fisher.
  • Conditional Value at Risk (cVaR) with distributions Historical, Gaussian, Laplace, Logistic.
  • Entropic Value at Risk (eVaR) with a Gaussian distribution.
  • Ulcer Index (UI)
  • Maximum Drawdown (MDD)
  • Skewness
  • Kurtosis

Just like with the performance metrics, you can view these for within each period as well. E.g. on a weekly basis:

image

Risk Free Rates and Benchmarks

Within the Toolkit class (upon initialisation) a benchmark can be defined. By default this is set to "^GSPC" which is the S&P 500 index. This benchmark is required to calculate metrics such as CAPM, Beta and (Jensens Alpha) and is very neat to have when you wish to analyze and compare tickers. It is of course possible to change this benchmark ticker to anything (or disable it by setting it to None).

Next to that, it is also possible to define a risk free rate, this can be '13w', '5y', '10y' or '30y' and defaults to '10y'. Both settings will lead to different results for some of the calculations and it is therefore important you set a benchmark and risk free rate that matches your beliefs and analysis. As an example:

image

Other than that, many improvements behind the scenes were made. E.g. it is now really easy to add new ratios since all the data has been prepared properly and some fixes have been made to data that could sometimes mess up in niche scenarios. Next to that, the documentation has been greatly extended: https://www.jeroenbouma.com/projects/financetoolkit/docs.


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


FinanceToolkit v1.3.2

03 Sep 19:46
Compare
Choose a tag to compare

This release focusses on numerous smaller enhancements that make the quality of the data better. For example, through grouping of historical data, I've noticed that it resulted in numerous NaN values given that for that particular stock there is no data available. These were minor details but it slightly messed up any form of charting. Next to that, technical indicators falsely calculated with NaN values.

Next to that, I noticed that if you input a ticker that had no data outside of the defined period (with start and end) it gave an error. This has now been tackled. Much more is upcoming with a new Risk class (for Value at Risk, Conditional Value at Risk and much more) currently in the works!

All in all, you can now generate charts like these with relative ease through collecting data from the FinanceDatabase and FinanceToolkit incredibly quickly being able to do really proper investment research.

As an example, these are companies found through the Finance Database:

image

Which, once data is collected through the Finance Toolkit, can return:

image

Also did you notice that really any asset works and not only companies? :)

image

FinanceToolkit v1.3.1

29 Aug 12:32
Compare
Choose a tag to compare

This is a massive release to the FinanceToolkit adding a lot more functionality including 30+ technical indicators. These are the key improvements:

Added a technicals class, this has the option to calculate over 30 technical indicators (e.g. Relative Strength Index and Bollinger Bands) with the chosen dataset. Just like other components of the FinanceToolkit, this works very well with any list of tickers. As an example, the following collects all technical indicators:

from financetoolkit import Toolkit

toolkit = Toolkit(tickers=["AAPL", "MSFT", "AMZN"])

toolkit.technicals.collect_all_indicators()

This returns the following:

image

Just like with ratios, it is also possible to show single indicators:

from financetoolkit import Toolkit

toolkit = Toolkit(tickers=["AAPL", "MSFT", "AMZN"])

toolkit.technicals.get_bollinger_bands()
image

This is a major addition as it is now possible to do quantitative research both based on fundamental data and technical indicators further accelerating the package to also become a great place for Machine Learning professionals.

I've expanded the historical dataset with new vital columns. It not only returns Open, High, Low, Close and Returns but also shows Dividends, Volatility, Excess Returns (minus Risk Free Rate), Excess Volatility and Cumulative Returns.

from financetoolkit import Toolkit

toolkit = Toolkit(tickers=["AAPL", "MSFT", "AMZN"])

toolkit.get_historical_data()
image

I've reworked a lot of docstrings. This makes it possible to better understand what a function is providing and what the meaning is of the result. This is also further highlighted on the documentation page here. As an example:

"""
Calculate the debt to equity ratio, a solvency ratio that measures the
proportion of a company's equity that is financed by debt.

The debt to equity ratio, also known as the D/E ratio, indicates the relative
contribution of debt and equity to a company's capital structure. It helps assess
the level of financial risk a company carries due to its debt obligations. A higher
ratio implies a higher reliance on debt to finance the business, which could increase
risk but also potentially lead to higher returns for shareholders.

Args:
    rounding (int, optional): The number of decimals to round the results to. Defaults to 4.
    growth (bool, optional): Whether to calculate the growth of the ratios. Defaults to False.
    lag (int | str, optional): The lag to use for the growth calculation. Defaults to 1.

Returns:
    pd.DataFrame: Debt to equity ratio values.

Notes:
- The method retrieves historical data and calculates the ratio for each asset in the Toolkit instance.
- If `growth` is set to True, the method calculates the growth of the ratio values using the specified `lag`.

As an example:

from financetoolkit import Toolkit

toolkit = Toolkit(["AAPL", "TSLA"], api_key=FMP_KEY)

debt_to_equity_ratios = toolkit.ratios.get_debt_to_equity_ratio()
"""

I've added in a risk free rate. This is based on ^TNX which is the 10-year Treasury Rate. This is relevant for calculations that require a Risk Free Rate such as the Sharpe Ratio. This is hidden in the back-end but can be retrieved (after using get_historical_data) with companies._daily_risk_free_rate. As an example:

from financetoolkit import Toolkit

toolkit = Toolkit(tickers=["AAPL", "MSFT", "AMZN"])

toolkit.get_historical_data()

toolkit._daily_risk_free_rate

Which returns:

image

FinanceToolkit v1.2.6

24 Aug 10:32
Compare
Choose a tag to compare

Major release with numerous new functionality and a lot of misc fixes. The major components are:

Calculating custom ratios are greatly improved with a lot of robustness. This now features the following things:

  • Simple operations such as: 'Quick Assets': 'Cash and Short Term Investments + Accounts Receivable'
  • Working with multiple operations: 'Cash Op Expenses':'Cost of Goods Sold + Selling, General and Administrative Expenses - Depreciation and Amortization',
  • Using curly brackets: 'WC / Net Income as %': '(Working Capital / Net Income) * 100',
  • Defining a criteria: 'Large Revenues': 'Revenue > 1000000000',
  • Using actual numbers: 'Daily Cash Op Expenses': 'Cash Op Expenses / 365',
  • Combining earlier defined formulas: 'Defensive Interval':'Quick Assets / Daily Cash Op Expenses'

As an example (also see the README and Notebooks):

image

The historical dataset now calculates OLHC, volumes, returns, cumulative returns and volatility. This also works for different periods (e.g. yearly) to see how volatility moved over the years for example. Next to that, within the backend a bit more data is collected than displayed to overcome issues with incomplete quarters or years.

image

It is possible to view treasury rates over the last 3 months for multiple maturities. This makes it possible to create yield curves for multiple months and can serve as a basis for discounting.

image

Improved the External Datasets usage. Previously, this was a little bit buggy and could result in a lot of errors when things didn't match up right. This has now been corrected and the example is also better explained. Please see the updated Jupyter Notebook here.

FinanceToolkit v1.2.5

20 Aug 20:07
Compare
Choose a tag to compare

I've been busy again to improve numerous docstrings, optimize code and ensure that there is better error handling. I've introduced some other features that have been requested which are the following:

An earnings calendar in which all exact earnings dates in the past and in the future are displayed including estimates. It has the option to show the quarterly statement dates or the annual dates and can be shown for any amount of companies.

image

The option to segregate revenue by product. This makes it possible to understand where the revenue is coming from. Note that this is a Professional and Enterprise Subscription feature. As an example, Apple.

image

The option to segregate revenue by geography. This makes it possible to understand from what countries, a company makes its revenue. Note that this is a Professional and Enterprise Subscription feature. As an example, Google.

image

As you can see, both options can be either quarterly or annually.