You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+65-21Lines changed: 65 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ While browsing a variety of websites, I kept finding that the same financial met
13
13
14
14
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.
15
15
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.
17
17
18
18
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.
19
19
@@ -70,10 +70,10 @@ Through the link you are able to subscribe for the free plan and also premium pl
70
70
The Finance Toolkit features the following functionality, also see [Basic Usage](#basic-usage) to see some of these functions in action:
71
71
72
72
-**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)
74
74
-**Company ratings** (`get_rating`), based on key indicators like PE and DE ratios (from FinancialModelingPrep)
75
75
-**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)
77
77
-**Dividends Calendar** (`get_dividend_calendar`) which shows the (adjusted) dividend and the the related record, payment and declaration dates (from FinancialModelingPrep)
78
78
-**Analyst Estimates** (`get_analyst_estimates`) that show the expected EPS and Revenue from the past and future from a range of analysts (from FinancialModelingPrep)
79
79
-**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]
85
85
-**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.
86
86
-**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.
87
87
-**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.
88
89
89
90
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.
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.
135
136
136
137
### Obtaining Historical Data
137
138
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.
139
140
140
141
| date | Open | High | Low | Close | Adj Close | Volume | Dividends | Return | Volatility | Excess Return | Excess Volatility | Cumulative Return |
@@ -217,7 +218,7 @@ And below the correlations with each factor are plotted over time for both Apple
217
218
218
219
### Obtaining Risk Metrics
219
220
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.
@@ -266,7 +267,7 @@ And below these Unemployment Rates are plotted over time:
266
267
267
268
# Available Metrics
268
269
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.
270
271
271
272
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`.
272
273
@@ -281,7 +282,7 @@ The Ratios Module contains over 50+ ratios that can be used to analyse companies
281
282
282
283
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.
283
284
284
-
### Efficiency Ratios
285
+
### Efficiency Ratios ⚙️
285
286
- Asset Turnover Ratio
286
287
- Inventory Turnover Ratio
287
288
- Days of Inventory Outstanding
@@ -295,7 +296,7 @@ All of these ratios can be calculated based on (lagged) growth as well as traili
295
296
- Fixed Asset Turnover
296
297
- Operating Ratio
297
298
298
-
### Liquidity Ratios
299
+
### Liquidity Ratios 💧
299
300
- Current Ratio
300
301
- Quick Ratio
301
302
- Cash Ratio
@@ -304,7 +305,7 @@ All of these ratios can be calculated based on (lagged) growth as well as traili
304
305
- Operating Cash Flow Sales Ratio
305
306
- Short Term Coverage Ratio
306
307
307
-
### Profitability Ratios
308
+
### Profitability Ratios 💰
308
309
- Gross Margin
309
310
- Operating Margin
310
311
- Net Profit Margin
@@ -323,7 +324,7 @@ All of these ratios can be calculated based on (lagged) growth as well as traili
323
324
- EBT to EBIT
324
325
- EBIT to Revenue
325
326
326
-
### Solvency Ratios
327
+
### Solvency Ratios 🪨
327
328
- Debt to Assets Ratio
328
329
- Debt to Equity Ratio
329
330
- Interest Coverage Ratio
@@ -335,7 +336,7 @@ All of these ratios can be calculated based on (lagged) growth as well as traili
335
336
- CAPEX Coverage Ratio
336
337
- CAPEX Dividend Coverage Ratio
337
338
338
-
### Valuation Ratios
339
+
### Valuation Ratios ⚖️
339
340
- Earnings per Share (EPS)
340
341
- Revenue per Share (RPS)
341
342
- Price Earnings Ratio (PE)
@@ -408,14 +409,14 @@ The Risk module is meant to calculate important risk metrics such as Value at Ri
408
409
409
410
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.**
410
411
411
-
### Breadth Indicators
412
+
### Breadth Indicators 💨
412
413
- McClellan Oscillator
413
414
- Advancers/Decliners Ratio
414
415
- On-Balance Volume (OBV)
415
416
- Accumulation/Distribution Line (ADL)
416
417
- Chaikin Oscillator
417
418
418
-
### Momentum Indicators
419
+
### Momentum Indicators ⏱️
419
420
- Money Flow Index
420
421
- Williams %R
421
422
- Aroon Indicator
@@ -433,37 +434,80 @@ The Technicals Module contains 30+ Technical Indicators that can be used to anal
433
434
- Relative Strength Index (RSI)
434
435
- Balance of Power (BOP)
435
436
436
-
### Overlap Indicators
437
+
### Overlap Indicators 🌈
437
438
- Simple Moving Average (SMA)
438
439
- Exponential Moving Average (EMA)
439
440
- Double Exponential Moving Average (DEMA)
440
441
- Triple Exponential Moving Average (TRIX)
441
442
- Triangular Moving Average (TMA)
442
443
443
-
### Volatility Indicators
444
+
### Volatility Indicators ⚠️
444
445
- True Range (TR)
445
446
- Average True Range (ATR)
446
447
- Keltners Channels
447
448
- Bollinger Bands
448
449
449
450
## Key Economic Indicators
450
451
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.**
452
453
454
+
### Economy 💵
453
455
- Gross Domestic Product (GDP) including Growth and Forecasts
454
456
- Consumer Confidence Index (CCI)
455
457
- Business Confidence Index (BCI)
456
458
- Composite Leading Indicator (CLI)
457
459
- Consumer Price Index (CPI)
458
460
- Producer Price Index (PPI)
459
461
- House and Rent Prices
460
-
- Unemployment Rates
462
+
- Share Prices
463
+
464
+
### Finance 💹
461
465
- Long Term Interest Rates (10 year)
462
466
- Short Term Interest Rates (3 month)
467
+
- Narrow Money (M1)
468
+
- Broad Money (M3)
463
469
- Purchasing Power Parity (PPP)
464
470
- 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
467
511
468
512
# Contributing
469
513
First off all, thank you for taking the time to contribute (or at least read the Contributing Guidelines)! 🚀
0 commit comments