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:
python
from financetoolkit import Toolkit
toolkit = Toolkit(tickers=["AAPL", "MSFT", "AMZN"])
toolkit.technicals.collect_all_indicators()
This returns the following:
<img width="1473" alt="image" src="https://github.com/JerBouma/FinanceToolkit/assets/46355364/7dbc9b85-c697-44eb-b2dc-f7ebacfdf697">
Just like with ratios, it is also possible to show single indicators:
python
from financetoolkit import Toolkit
toolkit = Toolkit(tickers=["AAPL", "MSFT", "AMZN"])
toolkit.technicals.get_bollinger_bands()
<img width="1207" alt="image" src="https://github.com/JerBouma/FinanceToolkit/assets/46355364/9e271e4a-1f13-48b5-8299-a75c30fc2960">
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.
python
from financetoolkit import Toolkit
toolkit = Toolkit(tickers=["AAPL", "MSFT", "AMZN"])
toolkit.get_historical_data()
<img width="1210" alt="image" src="https://github.com/JerBouma/FinanceToolkit/assets/46355364/17e14d00-ffdf-4195-8925-f3535fbc2187">
**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](https://www.jeroenbouma.com//projects/financetoolkit/docs). 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:
python
from financetoolkit import Toolkit
toolkit = Toolkit(tickers=["AAPL", "MSFT", "AMZN"])
toolkit.get_historical_data()
toolkit._daily_risk_free_rate
Which returns:
<img width="578" alt="image" src="https://github.com/JerBouma/FinanceToolkit/assets/46355364/7b0351f0-3082-41d3-b7d3-5260710611f2">