Skip to content

Commit 7304fb7

Browse files
committed
Merge branch 'develop'
2 parents ca8409d + 72907eb commit 7304fb7

12 files changed

+4534
-1800
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ repos:
2525
entry: codespell
2626
args:
2727
[
28-
"--ignore-words-list=VAI,MIS,shs,amplitud,gard,te,commun,ro,zar,vie,hel,jewl,zlot,ba,buil,coo,ether,hist,hsi,mape,navagation,operatio,pres,ser,yeld,shold,ist,varian,datas,ake,creat,statics,ket,toke,certi,buidl,ot",
28+
"--ignore-words-list=VAI,nam,tha,MIS,shs,amplitud,gard,te,commun,ro,zar,vie,hel,jewl,zlot,ba,buil,coo,ether,hist,hsi,mape,navagation,operatio,pres,ser,yeld,shold,ist,varian,datas,ake,creat,statics,ket,toke,certi,buidl,ot",
2929
"--quiet-level=2",
3030
"--skip=./tests,.git,*.css,*.csv,*.html,*.ini,*.ipynb,*.js,*.json,*.lock,*.scss,*.txt,*.yaml,build/pyinstaller/*,pyproject.toml",
3131
"-x=.github/workflows/linting.yml"

README.md

Lines changed: 65 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ While browsing a variety of websites, I kept finding that the same financial met
1313

1414
For example, Microsoft's Price-to-Earnings (PE) ratio on the 6th of May, 2023 is reported to be 28.93 (Stockopedia), 32.05 (Morningstar), 32.66 (Macrotrends), 33.09 (Finance Charts), 33.66 (Y Charts), 33.67 (Wall Street Journal), 33.80 (Yahoo Finance) and 34.4 (Companies Market Cap). All of these calculations are correct, however the method applied varies leading to different results. Therefore, collecting data from multiple sources can lead to wrong interpretation of the results given that one source could be applying a different calculation method than another. And that is, if it is even freely available. Often the calculation is hidden behind a paid subscription.
1515

16-
**This is why I designed the FinanceToolkit**, this is an open-source toolkit in which all relevant financial ratios ([130+](#available-metrics)), indicators and performance measurements are written down in the most simplistic way allowing for complete transparency of the calculation method ([proof](https://github.com/JerBouma/FinanceToolkit/blob/main/financetoolkit/ratios/valuation_model.py)). This allows you to not have to rely on metrics from other providers and, given a financial statement, allow for efficient manual calculations. This leads to one uniform method of calculation being applied that is available and understood by everyone.
16+
**This is why I designed the FinanceToolkit**, this is an open-source toolkit in which all relevant financial ratios ([150+](#available-metrics)), indicators and performance measurements are written down in the most simplistic way allowing for complete transparency of the calculation method ([proof](https://github.com/JerBouma/FinanceToolkit/blob/main/financetoolkit/ratios/valuation_model.py)). This allows you to not have to rely on metrics from other providers and, given a financial statement, allow for efficient manual calculations. This leads to one uniform method of calculation being applied that is available and understood by everyone.
1717

1818
The Finance Toolkit not only supports Equities. Even for Currencies, Cryptocurrencies, ETFs, Mutual Funds, Indices, Money Markets, Commodities, Key Economic Indicators and more, the Finance Toolkit can be used to obtain historical data as well as important performance and risk measurements such as the Sharpe Ratio and Value at Risk.
1919

@@ -70,10 +70,10 @@ Through the link you are able to subscribe for the free plan and also premium pl
7070
The Finance Toolkit features the following functionality, also see [Basic Usage](#basic-usage) to see some of these functions in action:
7171

7272
- **Company profiles** (`get_profile`), including country, sector, ISIN and general characteristics (from FinancialModelingPrep)
73-
- **Company quotes** (`get_quote`), inclufding 52 week highs and lows, volume metrics and current shares outstanding (from FinancialModelingPrep)
73+
- **Company quotes** (`get_quote`), including 52 week highs and lows, volume metrics and current shares outstanding (from FinancialModelingPrep)
7474
- **Company ratings** (`get_rating`), based on key indicators like PE and DE ratios (from FinancialModelingPrep)
7575
- **Historical market data** (`get_historical_data`), which can be retrieved on a daily, weekly, monthly, quarterly and yearly basis. This includes OHLC, dividends, returns, cumulative returns and volatility calculations for each corresponding period. (from FinancialModelingPrep or Yahoo Finance)
76-
- **Treasury Rates** (`get_treasury_data`) for several months and several years over the last 3 months which allows yield curves to be constructed (from FinancialModelingPrep or Yahoo Finance)
76+
- **Treasury Rates** (`get_treasury_data`) for several months and several years that can serve as risk-free rate (from Yahoo Finance)
7777
- **Dividends Calendar** (`get_dividend_calendar`) which shows the (adjusted) dividend and the the related record, payment and declaration dates (from FinancialModelingPrep)
7878
- **Analyst Estimates** (`get_analyst_estimates`) that show the expected EPS and Revenue from the past and future from a range of analysts (from FinancialModelingPrep)
7979
- **Earnings Calendar**(`get_earnings_calendar`) which shows the exact dates earnings are released in the past and in the future including expectations (from FinancialModelingPrep)
@@ -85,6 +85,7 @@ The Finance Toolkit features the following functionality, also see [Basic Usage]
8585
- **Performance metrics** like Jensens Alpha (`performance.get_jensens_alpha`), Capital Asset Pricing Model (CAPM) (`performance.get_capital_asset_pricing_model`) and (Rolling) Sharpe Ratio (`performance.get_sharpe_ratio`) that can be used to understand how each company is performing versus the benchmark and compared to each other.
8686
- **Risk metrics** like Value at Risk (`risk.get_value_at_risk`) and Conditional Value at Risk (`risk.get_conditional_value_at_risk`) that can be used to understand the risk profile of each company and how it compares to the benchmark.
8787
- **Technical indicators** like Relative Strength Index (`technicals.get_relative_strength_index`), Exponential Moving Average (`technicals.get_exponential_moving_average`) and Bollinger Bands (`technicals.get_bollinger_bands`) that can be used to perform in-depth momentum and trend analysis. These functions allow for the calculation of technical indicators based on the historical market data.
88+
- **Key Economic Indicators** like Gross Domestic Product (GDP) (`economics.get_gross_domestic_product`), Consumer Price Index (CPI) (`economics.get_consumer_price_index`) and Federal Funds Rate (FED) (`economics.get_federal_reserve_rates`) that can be used to analyse over 60 different countries. Based on these indicators, it is possible to understand the economic landscape of each country and whether companies within these countries are a great fit for your portfolio.
8889

8990
The dependencies of the package are on purpose *very slim* so that it will work well with any combination of packages and not result in conflicts.
9091

@@ -127,15 +128,15 @@ value_at_risk = companies.risk.get_value_at_risk(period="weekly")
127128
# a Technical example
128129
ichimoku_cloud = companies.technicals.get_ichimoku_cloud()
129130

130-
# a Economics example
131+
# an Economics example
131132
unemployment_rates = companies.economics.get_unemployment_rate()
132133
````
133134

134-
Generally, the functions return a DataFrame with a multi-index in which all tickers, in this case Apple and Microsoft, are presented. To keep things manageable for this README, I've selected just Apple in most cases but in essence it can be any list of tickers (no limit). The filtering is done through using `.loc['AAPL']` and `.xs('AAPL', level=1, axis=1)` based on whether it's fundamental data or historical data respectively.
135+
Generally, the functions return a DataFrame with a multi-index in which all tickers, in this case Apple and Microsoft, are presented. To keep things manageable for this README, I select just Apple but in essence the list of tickers can be endless as I've seen DataFrames with thousands of tickers. The filtering is done through `.loc['AAPL']` and `.xs('AAPL', level=1, axis=1)` based on whether it's fundamental data or historical data respectively.
135136

136137
### Obtaining Historical Data
137138

138-
Obtain historical data on a daily, weekly, monthly or yearly basis. This includes OHLC, volumes, dividends, returns, cumulative returns and volatility calculations for each corresponding period. For example, the historical data for Apple is shown below.
139+
Obtain historical data on a daily, weekly, monthly or yearly basis. This includes OHLC, volumes, dividends, returns, cumulative returns and volatility calculations for each corresponding period. For example, the a portion of the historical data for Apple is shown below.
139140

140141
| date | Open | High | Low | Close | Adj Close | Volume | Dividends | Return | Volatility | Excess Return | Excess Volatility | Cumulative Return |
141142
|:-----------|--------:|--------:|--------:|--------:|------------:|------------:|------------:|---------:|-------------:|----------------:|--------------------:|--------------------:|
@@ -217,7 +218,7 @@ And below the correlations with each factor are plotted over time for both Apple
217218

218219
### Obtaining Risk Metrics
219220

220-
Get the Value at Risk for each quarter. Here, the days within each quarter are considered for the Value at Risk. This makes it so that you can understand within each period what is the expected Value at Risk (VaR) which can again be any period but also based on distributions such as Historical, Gaussian, Student-t, Cornish-Fisher.
221+
Get the Value at Risk for each week. Here, the days within each week are considered for the Value at Risk. This makes it so that you can understand within each period what is the expected Value at Risk (VaR) which can again be any period but also based on distributions such as Historical, Gaussian, Student-t, Cornish-Fisher.
221222

222223
| | AAPL | MSFT | Benchmark |
223224
|:----------------------|--------:|--------:|------------:|
@@ -266,7 +267,7 @@ And below these Unemployment Rates are plotted over time:
266267

267268
# Available Metrics
268269

269-
The Finance Toolkit has the ability to calculate 100+ financial metrics. The following list shows all of the available metrics. Note that the Finance Toolkit is not limited to these ratios and indicators as it is possible to add custom ratios as well. See [this Notebook](https://www.jeroenbouma.com/projects/financetoolkit/custom-ratios) for more information.
270+
The Finance Toolkit has the ability to calculate 150+ financial metrics. The following list shows all of the available metrics. Note that the Finance Toolkit is not limited to these ratios and indicators as it is possible to add custom ratios as well. See [this Notebook](https://www.jeroenbouma.com/projects/financetoolkit/custom-ratios) for more information.
270271

271272
Each ratio and indicator has a corresponding function that can be called directly for example `ratios.get_return_on_equity` or `technicals.get_relative_strength_index`.
272273

@@ -281,7 +282,7 @@ The Ratios Module contains over 50+ ratios that can be used to analyse companies
281282

282283
All of these ratios can be calculated based on (lagged) growth as well as trailing (e.g. TTM) metrics. This is embedded in all ratios as well as the financial statements themselves which means it is possible to calculate revenue growth and 12-month (TTM) Price-to-Earnings with the parameters `growth=True` and `trailing=4` respectively. Note that trailing is based on periods therefore TTM can only be calculated by setting `quarterly=True` in the Toolkit initialization.
283284

284-
### Efficiency Ratios
285+
### Efficiency Ratios ⚙️
285286
- Asset Turnover Ratio
286287
- Inventory Turnover Ratio
287288
- Days of Inventory Outstanding
@@ -295,7 +296,7 @@ All of these ratios can be calculated based on (lagged) growth as well as traili
295296
- Fixed Asset Turnover
296297
- Operating Ratio
297298

298-
### Liquidity Ratios
299+
### Liquidity Ratios 💧
299300
- Current Ratio
300301
- Quick Ratio
301302
- Cash Ratio
@@ -304,7 +305,7 @@ All of these ratios can be calculated based on (lagged) growth as well as traili
304305
- Operating Cash Flow Sales Ratio
305306
- Short Term Coverage Ratio
306307

307-
### Profitability Ratios
308+
### Profitability Ratios 💰
308309
- Gross Margin
309310
- Operating Margin
310311
- Net Profit Margin
@@ -323,7 +324,7 @@ All of these ratios can be calculated based on (lagged) growth as well as traili
323324
- EBT to EBIT
324325
- EBIT to Revenue
325326

326-
### Solvency Ratios
327+
### Solvency Ratios 🪨
327328
- Debt to Assets Ratio
328329
- Debt to Equity Ratio
329330
- Interest Coverage Ratio
@@ -335,7 +336,7 @@ All of these ratios can be calculated based on (lagged) growth as well as traili
335336
- CAPEX Coverage Ratio
336337
- CAPEX Dividend Coverage Ratio
337338

338-
### Valuation Ratios
339+
### Valuation Ratios ⚖️
339340
- Earnings per Share (EPS)
340341
- Revenue per Share (RPS)
341342
- Price Earnings Ratio (PE)
@@ -408,14 +409,14 @@ The Risk module is meant to calculate important risk metrics such as Value at Ri
408409

409410
The Technicals Module contains 30+ Technical Indicators that can be used to analyse companies. These ratios are divided into 4 categories which are breadth, momentum, overlap and volatility. Each indicator is calculated using the data from the Toolkit module. **Find the documentation [here](https://www.jeroenbouma.com/projects/financetoolkit/docs/technicals) which includes an explanation about the indicator, the parameters and an example.**
410411

411-
### Breadth Indicators
412+
### Breadth Indicators 💨
412413
- McClellan Oscillator
413414
- Advancers/Decliners Ratio
414415
- On-Balance Volume (OBV)
415416
- Accumulation/Distribution Line (ADL)
416417
- Chaikin Oscillator
417418

418-
### Momentum Indicators
419+
### Momentum Indicators ⏱️
419420
- Money Flow Index
420421
- Williams %R
421422
- Aroon Indicator
@@ -433,37 +434,80 @@ The Technicals Module contains 30+ Technical Indicators that can be used to anal
433434
- Relative Strength Index (RSI)
434435
- Balance of Power (BOP)
435436

436-
### Overlap Indicators
437+
### Overlap Indicators 🌈
437438
- Simple Moving Average (SMA)
438439
- Exponential Moving Average (EMA)
439440
- Double Exponential Moving Average (DEMA)
440441
- Triple Exponential Moving Average (TRIX)
441442
- Triangular Moving Average (TMA)
442443

443-
### Volatility Indicators
444+
### Volatility Indicators ⚠️
444445
- True Range (TR)
445446
- Average True Range (ATR)
446447
- Keltners Channels
447448
- Bollinger Bands
448449

449450
## Key Economic Indicators
450451

451-
The Economics Module contains a variety of Key Economic Indicators that help in understanding the health and performance of more than 60 different countries. This module can be called directly via the Toolkit but also separately if desired. **Find the documentation [here](https://www.jeroenbouma.com/projects/financetoolkit/docs/economics) which includes an explanation about each indicator, the parameters and an example.**
452+
The Economics Module contains a variety of Key Economic Indicators that help in understanding the health and performance of more than 60 different countries. This module can be called directly via the Toolkit but also separately if desired through `from financetoolkit import Economics`. **Find the documentation [here](https://www.jeroenbouma.com/projects/financetoolkit/docs/economics) which includes an explanation about each indicator, the parameters and an example.**
452453

454+
### Economy 💵
453455
- Gross Domestic Product (GDP) including Growth and Forecasts
454456
- Consumer Confidence Index (CCI)
455457
- Business Confidence Index (BCI)
456458
- Composite Leading Indicator (CLI)
457459
- Consumer Price Index (CPI)
458460
- Producer Price Index (PPI)
459461
- House and Rent Prices
460-
- Unemployment Rates
462+
- Share Prices
463+
464+
### Finance 💹
461465
- Long Term Interest Rates (10 year)
462466
- Short Term Interest Rates (3 month)
467+
- Narrow Money (M1)
468+
- Broad Money (M3)
463469
- Purchasing Power Parity (PPP)
464470
- Exchange Rates
465-
- European Central Bank (ECB) Interest Rates
466-
- Federal Reserve (FED) Interest Rates
471+
472+
### Central Banks 🏦
473+
- Main Refinancing Operations (ECB)
474+
- Marginal Lending Facility (ECB)
475+
- Deposit Facility (ECB)
476+
- Effective Federal Funds Rate (FED)
477+
- Overnight Bank Funding Rate (FED)
478+
- Tri-Party General Collateral Rate (FED)
479+
- Broad General Collateral Rate (FED)
480+
- Secured Overnight Financing Rate (FED)
481+
482+
### Environment 💚
483+
- Renewable Energy as % of Total Energy
484+
- Environmental Tax as % of GDP
485+
- Greenhouse Gas Emissions
486+
- Crude Oil Production and Prices
487+
488+
### Government 🏛️
489+
- Deficit as % of GDP
490+
- Revenue as % of GDP
491+
- Spending as % of GDP
492+
- Debt as % of GDP
493+
- Financial Wealth as % of GDP
494+
- Production Costs as % of GDP
495+
- Central Spending based on the System of National accounts (SNA)
496+
- Trust in Government
497+
498+
### Jobs 🗂️
499+
- Unemployment Rates
500+
- Labour Productivity
501+
- Income Inequality
502+
503+
### Society 👪
504+
- Population
505+
- Young Population
506+
- Working Age Population
507+
- Elderly Population
508+
- Fertility Rates
509+
- Old-Age Dependency Ratio
510+
- Poverty Rate
467511

468512
# Contributing
469513
First off all, thank you for taking the time to contribute (or at least read the Contributing Guidelines)! 🚀

0 commit comments

Comments
 (0)