financetoolkit 2.1.0__tar.gz → 2.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/.gitignore +4 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/PKG-INFO +41 -54
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/README.md +39 -52
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/currencies_model.py +2 -6
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/fmp_model.py +38 -57
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/fundamentals_model.py +17 -8
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/helpers.py +127 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/historical_model.py +8 -15
- financetoolkit-2.1.2/financetoolkit/mcp_server/__main__.py +10 -0
- financetoolkit-2.1.2/financetoolkit/mcp_server/auth_model.py +940 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/mcp_server/cache_model.py +48 -2
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/mcp_server/config.yaml +25 -23
- financetoolkit-2.1.2/financetoolkit/mcp_server/formatting_model.py +212 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/mcp_server/mcp_controller.py +95 -92
- financetoolkit-2.1.2/financetoolkit/mcp_server/mcpb/.mcpbignore +8 -0
- financetoolkit-2.1.2/financetoolkit/mcp_server/mcpb/README.md +20 -0
- financetoolkit-2.1.2/financetoolkit/mcp_server/mcpb/build-mcpb.sh +45 -0
- financetoolkit-2.1.2/financetoolkit/mcp_server/mcpb/finance_toolkit_icon.png +0 -0
- financetoolkit-2.1.2/financetoolkit/mcp_server/mcpb/manifest.json +178 -0
- financetoolkit-2.1.2/financetoolkit/mcp_server/mcpb/pyproject.toml +8 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/mcp_server/provider_model.py +91 -15
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/mcp_server/registry_controller.py +194 -7
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/mcp_server/setup_model.py +2 -216
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/mcp_server/tools_model.py +63 -10
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/models/models_controller.py +67 -22
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/options/options_controller.py +10 -19
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/performance/performance_controller.py +27 -40
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/portfolio/overview_model.py +1 -1
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/portfolio/portfolio_model.py +2 -6
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/ratios/ratios_controller.py +282 -154
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/risk/risk_controller.py +1 -1
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/toolkit_controller.py +158 -83
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/yfinance_model.py +29 -4
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/pyproject.toml +9 -2
- financetoolkit-2.1.0/financetoolkit/mcp_server/SKILL.md +0 -46
- financetoolkit-2.1.0/financetoolkit/mcp_server/__main__.py +0 -9
- financetoolkit-2.1.0/financetoolkit/mcp_server/formatting_model.py +0 -69
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/LICENSE.txt +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/__init__.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/discovery/__init__.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/discovery/discovery_controller.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/discovery/discovery_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/economics/__init__.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/economics/economics_controller.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/economics/gmdb_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/economics/oecd_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/fixedincome/__init__.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/fixedincome/bond_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/fixedincome/derivative_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/fixedincome/ecb_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/fixedincome/euribor_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/fixedincome/fed_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/fixedincome/fixedincome_controller.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/fixedincome/fred_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/fixedincome/helpers.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/mcp_server/__init__.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/mcp_server/coercion_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/mcp_server/inspection_controller.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/models/__init__.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/models/altman_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/models/dupont_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/models/enterprise_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/models/growth_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/models/helpers.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/models/intrinsic_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/models/piotroski_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/models/wacc_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/normalization/balance.csv +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/normalization/balance_yf.csv +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/normalization/cash.csv +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/normalization/cash_yf.csv +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/normalization/income.csv +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/normalization/income_yf.csv +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/normalization/statistics.csv +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/normalization_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/options/__init__.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/options/binomial_trees_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/options/black_scholes_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/options/greeks_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/options/helpers.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/options/options_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/performance/__init__.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/performance/helpers.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/performance/performance_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/portfolio/__init__.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/portfolio/config.yaml +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/portfolio/example_datasets/example_portfolio.csv +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/portfolio/example_datasets/example_portfolio.xlsx +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/portfolio/helpers.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/portfolio/portfolio_controller.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/ratios/__init__.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/ratios/efficiency_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/ratios/helpers.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/ratios/liquidity_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/ratios/profitability_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/ratios/solvency_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/ratios/valuation_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/risk/__init__.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/risk/cvar_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/risk/evar_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/risk/garch_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/risk/helpers.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/risk/risk_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/risk/var_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/technicals/__init__.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/technicals/breadth_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/technicals/helpers.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/technicals/momentum_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/technicals/overlap_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/technicals/statistic_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/technicals/technicals_controller.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/technicals/volatility_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/utilities/cache_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/utilities/error_model.py +0 -0
- {financetoolkit-2.1.0 → financetoolkit-2.1.2}/financetoolkit/utilities/logger_model.py +0 -0
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*.ipynb
|
|
6
6
|
cached/
|
|
7
7
|
debugging.py
|
|
8
|
+
.planning/
|
|
8
9
|
|
|
9
10
|
# Finance Toolkit Example Datasets
|
|
10
11
|
!examples/*.ipynb
|
|
@@ -25,6 +26,9 @@ debugging.py
|
|
|
25
26
|
.claude/
|
|
26
27
|
*.sh
|
|
27
28
|
|
|
29
|
+
# Specific files for the MCP Bundle
|
|
30
|
+
!financetoolkit/mcp_server/mcpb/build-mcpb.sh
|
|
31
|
+
|
|
28
32
|
# Byte-compiled / optimized / DLL files
|
|
29
33
|
__pycache__/
|
|
30
34
|
*.py[cod]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: financetoolkit
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.2
|
|
4
4
|
Summary: Transparent and Efficient Financial Analysis
|
|
5
5
|
Author: Jeroen Bouma
|
|
6
6
|
License: MIT
|
|
@@ -22,9 +22,9 @@ Requires-Dist: openpyxl>=3.1
|
|
|
22
22
|
Requires-Dist: pandas>=2.2
|
|
23
23
|
Requires-Dist: requests>=2.32
|
|
24
24
|
Requires-Dist: scikit-learn>=1.6
|
|
25
|
-
Requires-Dist: tqdm>=4.67
|
|
26
25
|
Requires-Dist: yfinance
|
|
27
26
|
Provides-Extra: mcp
|
|
27
|
+
Requires-Dist: fastmcp>=3.4.2; extra == 'mcp'
|
|
28
28
|
Requires-Dist: mcp[cli]>=1.27.0; extra == 'mcp'
|
|
29
29
|
Requires-Dist: python-dotenv>=1.0; extra == 'mcp'
|
|
30
30
|
Requires-Dist: pyyaml>=6.0; extra == 'mcp'
|
|
@@ -32,12 +32,16 @@ Requires-Dist: rich>=13.0; extra == 'mcp'
|
|
|
32
32
|
Requires-Dist: tabulate>=0.9.0; extra == 'mcp'
|
|
33
33
|
Description-Content-Type: text/markdown
|
|
34
34
|
|
|
35
|
+
<!-- mcp-name: io.github.JerBouma/financetoolkit -->
|
|
35
36
|
[](https://github.com/JerBouma/FinanceToolkit)
|
|
36
37
|
|
|
37
38
|
[](https://github.com/sponsors/JerBouma)
|
|
38
39
|
[](https://www.buymeacoffee.com/jerbouma)
|
|
39
40
|
[](https://www.linkedin.com/in/boumajeroen/)
|
|
40
|
-
[](https://
|
|
41
|
+
[](https://www.jeroenbouma.com/projects/financetoolkit/mcp)
|
|
42
|
+
[](https://github.com/JerBouma/FinanceToolkit/releases/latest/download/financetoolkit.mcpb)
|
|
43
|
+
[](https://smithery.ai/servers/jer-bouma/financetoolkit)
|
|
44
|
+
[](https://glama.ai/mcp/servers/JerBouma/FinanceToolkit)
|
|
41
45
|
[](https://www.jeroenbouma.com/projects/financetoolkit/docs)
|
|
42
46
|
[](https://pypi.org/project/FinanceToolkit/)
|
|
43
47
|
[](https://pypi.org/project/FinanceToolkit/)
|
|
@@ -53,7 +57,20 @@ Beyond Equities, it supports Options, Currencies, Cryptocurrencies, ETFs, Mutual
|
|
|
53
57
|
|
|
54
58
|
Complementing this is the [Finance Database 🌎](https://github.com/JerBouma/FinanceDatabase), a database featuring 300.000+ symbols containing Equities, ETFs, Funds, Indices, Currencies, Cryptocurrencies and Money Markets. By utilising both, it is possible to do a fully-fledged competitive analysis with the tickers found from the FinanceDatabase inputted into the FinanceToolkit.
|
|
55
59
|
|
|
56
|
-
|
|
60
|
+
___
|
|
61
|
+
**🔌 The Finance Toolkit is also available as a hosted [MCP Server](https://www.jeroenbouma.com/projects/financetoolkit/mcp)**
|
|
62
|
+
|
|
63
|
+
Simply point any MCP-compatible AI assistant (like *Claude, GitHub Copilot, Cursor, or Windsurf*) to:
|
|
64
|
+
|
|
65
|
+
`https://financetoolkit.jeroenbouma.com/mcp`
|
|
66
|
+
|
|
67
|
+
Key features:
|
|
68
|
+
* **⚡ No Local Installation Required:** The server runs completely in the cloud.
|
|
69
|
+
* **🔐 Secure OAuth:** Authenticates safely on your very first connection.
|
|
70
|
+
* **📊 Conversational Data:** Query over 200+ financial metrics naturally.
|
|
71
|
+
|
|
72
|
+
Also available on [Smithery](https://smithery.ai/servers/jer-bouma/financetoolkit), [Glama](https://glama.ai/mcp/servers/JerBouma/FinanceToolkit),[ MCP Servers](https://mcpservers.org/servers/jerbouma/financetoolkit) and more.
|
|
73
|
+
___
|
|
57
74
|
|
|
58
75
|
# Table of Contents
|
|
59
76
|
|
|
@@ -99,14 +116,6 @@ Through the link you are able to subscribe for the free plan and also premium pl
|
|
|
99
116
|
|
|
100
117
|
**By default, the Finance Toolkit prioritizes Financial Modeling Prep for data retrieval. If data acquisition from Financial Modeling Prep is unsuccessful (e.g., due to plan restrictions or API key issues), the toolkit automatically switches to Yahoo Finance as a secondary source.** To disable this fallback behavior and exclusively use Financial Modeling Prep, set `enforce_source="FinancialModelingPrep"` during Toolkit initialization. This configuration ensures that an error is raised if Financial Modeling Prep data cannot be accessed. Alternatively, you can set `enforce_source="YahooFinance"` to exclusively use Yahoo Finance as the data source.
|
|
101
118
|
|
|
102
|
-
Prefer a conversational interface over writing Python? Run the one-line setup wizard and it will configure your AI client automatically, **no local installation or Python knowledge required**:
|
|
103
|
-
|
|
104
|
-
```
|
|
105
|
-
uvx --from "financetoolkit[mcp]" financetoolkit-mcp-setup
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
Supports Claude Desktop, Claude Code, GitHub Copilot (VS Code), Cursor, Windsurf, and Gemini. See the full MCP documentation [here](https://github.com/JerBouma/FinanceToolkit/blob/main/MCP.md).
|
|
109
|
-
|
|
110
119
|
# Basic Usage
|
|
111
120
|
|
|
112
121
|
This section is an introduction to the Finance Toolkit. Also see [this notebook](https://www.jeroenbouma.com/projects/financetoolkit/getting-started) for a detailed Getting Started guide as well as [this notebook](https://www.jeroenbouma.com/projects/financedatabase/getting-started) that includes the [Finance Database 🌎](https://www.jeroenbouma.com/projects/financedatabase) and a proper financial analysis. Next to that, find below a fully-fledged code documentation as well as Jupyter Notebooks in which you can see many examples ranging from basic examples to creating custom ratios to working with your own datasets.
|
|
@@ -475,7 +484,7 @@ Which returns:
|
|
|
475
484
|
| CUSIP | 594918104 | 37833100 |
|
|
476
485
|
| Exchange | NASDAQ Global Select | NASDAQ Global Select |
|
|
477
486
|
| Exchange Short Name | NASDAQ | NASDAQ |
|
|
478
|
-
| Industry | Software
|
|
487
|
+
| Industry | Software - Infrastructure | Consumer Electronics |
|
|
479
488
|
| Website | https://www.microsoft.com | https://www.apple.com |
|
|
480
489
|
| CEO | Mr. Satya Nadella | Mr. Timothy D. Cook |
|
|
481
490
|
| Sector | Technology | Technology |
|
|
@@ -3115,54 +3124,32 @@ This returns a rather large DataFrame so to keep it concise, only the first 5 ti
|
|
|
3115
3124
|
|
|
3116
3125
|
# MCP Server
|
|
3117
3126
|
|
|
3118
|
-
The Finance Toolkit
|
|
3127
|
+
The Finance Toolkit MCP Server exposes 200+ financial metrics, models, and economic indicators directly to any AI assistant that supports the Model Context Protocol including Claude Desktop & Code, GitHub Copilot, Cursor and Windsurf.
|
|
3119
3128
|
|
|
3120
|
-
|
|
3121
|
-
uvx --from "financetoolkit[mcp]" financetoolkit-mcp-setup
|
|
3122
|
-
```
|
|
3123
|
-
|
|
3124
|
-
After the installation process is finished, it will automatically launch the setup wizard. For more information about the setup wizard, see the [MCP Documentation](https://github.com/JerBouma/FinanceToolkit/blob/main/MCP.md) which also contains example prompts to get you started with using the Finance Toolkit MCP server in your AI assistant.
|
|
3125
|
-
|
|
3126
|
-
Once configured, you can ask your AI assistant questions like:
|
|
3127
|
-
|
|
3128
|
-
> *"Compare Apple with Microsoft, what company is the most profitable?"*
|
|
3129
|
+
**Option 1: Remote server (all clients, no installation):** Connect directly to the hosted server. Nothing needs to be installed locally. On first connection your client opens an OAuth consent page asking for your FMP API key; enter it once and the server handles authentication from there. Add the URL as a remote HTTP MCP server in your client's settings or config file.
|
|
3129
3130
|
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3131
|
+
___
|
|
3132
|
+
<b><div align="center">MCP Server URL: <code>https://financetoolkit.jeroenbouma.com/mcp</code></div></b>
|
|
3133
|
+
___
|
|
3133
3134
|
|
|
3134
|
-
If you prefer not to run the setup wizard, you can configure each client manually by editing its JSON configuration file. The `env` block accepts either of two environment variables — set whichever suits your workflow. When both are present the directly-set key takes priority.
|
|
3135
3135
|
|
|
3136
|
-
-
|
|
3137
|
-
- `FINANCETOOLKIT_ENV_FILE`: an absolute path to a `.env` file that contains `FINANCIAL_MODELING_PREP_API_KEY=<your-key>`.
|
|
3136
|
+
**Option 2: One-click install (Claude Desktop):** Download the MCP Bundle and open it with Claude Desktop. An installation dialog will appear and prompt you for your API key. No terminal required.
|
|
3138
3137
|
|
|
3139
|
-
|
|
3138
|
+
___
|
|
3139
|
+
<b><div align="center">Download the Finance Toolkit MCP Bundle <a href="https://github.com/JerBouma/FinanceToolkit/releases/latest/download/financetoolkit.mcpb">here</a>.</div></b>
|
|
3140
|
+
___
|
|
3140
3141
|
|
|
3141
|
-
|
|
3142
|
+
**Option 3: Local installation (all clients):** Run the one-line setup wizard and it will configure your AI client automatically:
|
|
3142
3143
|
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
| Windows | `%APPDATA%\Claude\claude_desktop_config.json` |
|
|
3147
|
-
| Linux | `~/.config/claude/claude_desktop_config.json` |
|
|
3144
|
+
```
|
|
3145
|
+
uvx --from "financetoolkit[mcp]" financetoolkit-mcp-setup
|
|
3146
|
+
```
|
|
3148
3147
|
|
|
3149
|
-
|
|
3148
|
+
After running this command the wizard will launch and walk you through the rest of the setup interactively. For more information, see the [MCP Documentation](https://www.jeroenbouma.com/projects/financetoolkit/mcp) which also contains example prompts to get you started.
|
|
3150
3149
|
|
|
3151
|
-
|
|
3152
|
-
{
|
|
3153
|
-
"mcpServers": {
|
|
3154
|
-
"finance-toolkit": {
|
|
3155
|
-
"command": "uvx",
|
|
3156
|
-
"args": ["--from", "financetoolkit[mcp]", "financetoolkit-mcp"],
|
|
3157
|
-
"env": {
|
|
3158
|
-
"FINANCIAL_MODELING_PREP_API_KEY": "YOUR_API_KEY_HERE"
|
|
3159
|
-
}
|
|
3160
|
-
}
|
|
3161
|
-
}
|
|
3162
|
-
}
|
|
3163
|
-
```
|
|
3150
|
+
See an example of the Finance Toolkit MCP server in action in Claude Desktop below:
|
|
3164
3151
|
|
|
3165
|
-
|
|
3152
|
+
https://github.com/user-attachments/assets/96ad5288-d83d-4497-a345-1841c48c29d5
|
|
3166
3153
|
|
|
3167
3154
|
# Questions & Answers
|
|
3168
3155
|
|
|
@@ -3228,12 +3215,12 @@ The Finance Toolkit has been mentioned in various blogposts, research papers, ne
|
|
|
3228
3215
|
|
|
3229
3216
|
**Blogposts**
|
|
3230
3217
|
- [A Deep Dive into EOY Financial Performance & Risk Measures of Big Five using the Finance Toolkit in Python](https://wire.insiderfinance.io/a-deep-dive-into-eoy-financial-performance-risk-measures-of-big-five-using-the-financetoolkit-in-ef93fddd11db)
|
|
3231
|
-
- [Discovering the Best Integrated Platforms for Big Tech Quantitative Finance
|
|
3232
|
-
- [Investment Analysis
|
|
3218
|
+
- [Discovering the Best Integrated Platforms for Big Tech Quantitative Finance: 1. Finance Toolkit](https://wire.insiderfinance.io/discovering-the-best-integrated-platforms-for-big-tech-quantitative-finance-1-finance-toolkit-2e29b67eb4ea)
|
|
3219
|
+
- [Investment Analysis with the Finance Database](https://alpha2phi.medium.com/investment-analysis-finance-database-61f47ecfe7ca)
|
|
3233
3220
|
- [Unlocking Financial Clarity: Introducing the Open-Source Finance Toolkit Powered by FMP](https://site.financialmodelingprep.com/education/ESG/unlocking-financial-clarity-introducing-the-open-source-finance-toolkit-powered-by-fmp)
|
|
3234
3221
|
|
|
3235
3222
|
**Research**
|
|
3236
|
-
- [AI, Help Me Think
|
|
3223
|
+
- [AI, Help Me Think, but for Myself: Assisting People in Complex Decision-Making by Providing Different Kinds of Cognitive Support](https://www.microsoft.com/en-us/research/wp-content/uploads/2025/03/AI-Help-Me-Think-CHI-2025.pdf)
|
|
3237
3224
|
- [Fundamental Analysis using Muli-Agent System and Agentic RAG](https://connect.cfauk.org/HigherLogic/System/DownloadDocumentFile.ashx?DocumentFileKey=3ae6f3fc-593a-04ec-c3b8-be5643cab479&forceDialog=0)
|
|
3238
3225
|
|
|
3239
3226
|
**Newsletters & Social Media**
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
<!-- mcp-name: io.github.JerBouma/financetoolkit -->
|
|
1
2
|
[](https://github.com/JerBouma/FinanceToolkit)
|
|
2
3
|
|
|
3
4
|
[](https://github.com/sponsors/JerBouma)
|
|
4
5
|
[](https://www.buymeacoffee.com/jerbouma)
|
|
5
6
|
[](https://www.linkedin.com/in/boumajeroen/)
|
|
6
|
-
[](https://
|
|
7
|
+
[](https://www.jeroenbouma.com/projects/financetoolkit/mcp)
|
|
8
|
+
[](https://github.com/JerBouma/FinanceToolkit/releases/latest/download/financetoolkit.mcpb)
|
|
9
|
+
[](https://smithery.ai/servers/jer-bouma/financetoolkit)
|
|
10
|
+
[](https://glama.ai/mcp/servers/JerBouma/FinanceToolkit)
|
|
7
11
|
[](https://www.jeroenbouma.com/projects/financetoolkit/docs)
|
|
8
12
|
[](https://pypi.org/project/FinanceToolkit/)
|
|
9
13
|
[](https://pypi.org/project/FinanceToolkit/)
|
|
@@ -19,7 +23,20 @@ Beyond Equities, it supports Options, Currencies, Cryptocurrencies, ETFs, Mutual
|
|
|
19
23
|
|
|
20
24
|
Complementing this is the [Finance Database 🌎](https://github.com/JerBouma/FinanceDatabase), a database featuring 300.000+ symbols containing Equities, ETFs, Funds, Indices, Currencies, Cryptocurrencies and Money Markets. By utilising both, it is possible to do a fully-fledged competitive analysis with the tickers found from the FinanceDatabase inputted into the FinanceToolkit.
|
|
21
25
|
|
|
22
|
-
|
|
26
|
+
___
|
|
27
|
+
**🔌 The Finance Toolkit is also available as a hosted [MCP Server](https://www.jeroenbouma.com/projects/financetoolkit/mcp)**
|
|
28
|
+
|
|
29
|
+
Simply point any MCP-compatible AI assistant (like *Claude, GitHub Copilot, Cursor, or Windsurf*) to:
|
|
30
|
+
|
|
31
|
+
`https://financetoolkit.jeroenbouma.com/mcp`
|
|
32
|
+
|
|
33
|
+
Key features:
|
|
34
|
+
* **⚡ No Local Installation Required:** The server runs completely in the cloud.
|
|
35
|
+
* **🔐 Secure OAuth:** Authenticates safely on your very first connection.
|
|
36
|
+
* **📊 Conversational Data:** Query over 200+ financial metrics naturally.
|
|
37
|
+
|
|
38
|
+
Also available on [Smithery](https://smithery.ai/servers/jer-bouma/financetoolkit), [Glama](https://glama.ai/mcp/servers/JerBouma/FinanceToolkit),[ MCP Servers](https://mcpservers.org/servers/jerbouma/financetoolkit) and more.
|
|
39
|
+
___
|
|
23
40
|
|
|
24
41
|
# Table of Contents
|
|
25
42
|
|
|
@@ -65,14 +82,6 @@ Through the link you are able to subscribe for the free plan and also premium pl
|
|
|
65
82
|
|
|
66
83
|
**By default, the Finance Toolkit prioritizes Financial Modeling Prep for data retrieval. If data acquisition from Financial Modeling Prep is unsuccessful (e.g., due to plan restrictions or API key issues), the toolkit automatically switches to Yahoo Finance as a secondary source.** To disable this fallback behavior and exclusively use Financial Modeling Prep, set `enforce_source="FinancialModelingPrep"` during Toolkit initialization. This configuration ensures that an error is raised if Financial Modeling Prep data cannot be accessed. Alternatively, you can set `enforce_source="YahooFinance"` to exclusively use Yahoo Finance as the data source.
|
|
67
84
|
|
|
68
|
-
Prefer a conversational interface over writing Python? Run the one-line setup wizard and it will configure your AI client automatically, **no local installation or Python knowledge required**:
|
|
69
|
-
|
|
70
|
-
```
|
|
71
|
-
uvx --from "financetoolkit[mcp]" financetoolkit-mcp-setup
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Supports Claude Desktop, Claude Code, GitHub Copilot (VS Code), Cursor, Windsurf, and Gemini. See the full MCP documentation [here](https://github.com/JerBouma/FinanceToolkit/blob/main/MCP.md).
|
|
75
|
-
|
|
76
85
|
# Basic Usage
|
|
77
86
|
|
|
78
87
|
This section is an introduction to the Finance Toolkit. Also see [this notebook](https://www.jeroenbouma.com/projects/financetoolkit/getting-started) for a detailed Getting Started guide as well as [this notebook](https://www.jeroenbouma.com/projects/financedatabase/getting-started) that includes the [Finance Database 🌎](https://www.jeroenbouma.com/projects/financedatabase) and a proper financial analysis. Next to that, find below a fully-fledged code documentation as well as Jupyter Notebooks in which you can see many examples ranging from basic examples to creating custom ratios to working with your own datasets.
|
|
@@ -441,7 +450,7 @@ Which returns:
|
|
|
441
450
|
| CUSIP | 594918104 | 37833100 |
|
|
442
451
|
| Exchange | NASDAQ Global Select | NASDAQ Global Select |
|
|
443
452
|
| Exchange Short Name | NASDAQ | NASDAQ |
|
|
444
|
-
| Industry | Software
|
|
453
|
+
| Industry | Software - Infrastructure | Consumer Electronics |
|
|
445
454
|
| Website | https://www.microsoft.com | https://www.apple.com |
|
|
446
455
|
| CEO | Mr. Satya Nadella | Mr. Timothy D. Cook |
|
|
447
456
|
| Sector | Technology | Technology |
|
|
@@ -3081,54 +3090,32 @@ This returns a rather large DataFrame so to keep it concise, only the first 5 ti
|
|
|
3081
3090
|
|
|
3082
3091
|
# MCP Server
|
|
3083
3092
|
|
|
3084
|
-
The Finance Toolkit
|
|
3093
|
+
The Finance Toolkit MCP Server exposes 200+ financial metrics, models, and economic indicators directly to any AI assistant that supports the Model Context Protocol including Claude Desktop & Code, GitHub Copilot, Cursor and Windsurf.
|
|
3085
3094
|
|
|
3086
|
-
|
|
3087
|
-
uvx --from "financetoolkit[mcp]" financetoolkit-mcp-setup
|
|
3088
|
-
```
|
|
3089
|
-
|
|
3090
|
-
After the installation process is finished, it will automatically launch the setup wizard. For more information about the setup wizard, see the [MCP Documentation](https://github.com/JerBouma/FinanceToolkit/blob/main/MCP.md) which also contains example prompts to get you started with using the Finance Toolkit MCP server in your AI assistant.
|
|
3091
|
-
|
|
3092
|
-
Once configured, you can ask your AI assistant questions like:
|
|
3093
|
-
|
|
3094
|
-
> *"Compare Apple with Microsoft, what company is the most profitable?"*
|
|
3095
|
+
**Option 1: Remote server (all clients, no installation):** Connect directly to the hosted server. Nothing needs to be installed locally. On first connection your client opens an OAuth consent page asking for your FMP API key; enter it once and the server handles authentication from there. Add the URL as a remote HTTP MCP server in your client's settings or config file.
|
|
3095
3096
|
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3097
|
+
___
|
|
3098
|
+
<b><div align="center">MCP Server URL: <code>https://financetoolkit.jeroenbouma.com/mcp</code></div></b>
|
|
3099
|
+
___
|
|
3099
3100
|
|
|
3100
|
-
If you prefer not to run the setup wizard, you can configure each client manually by editing its JSON configuration file. The `env` block accepts either of two environment variables — set whichever suits your workflow. When both are present the directly-set key takes priority.
|
|
3101
3101
|
|
|
3102
|
-
-
|
|
3103
|
-
- `FINANCETOOLKIT_ENV_FILE`: an absolute path to a `.env` file that contains `FINANCIAL_MODELING_PREP_API_KEY=<your-key>`.
|
|
3102
|
+
**Option 2: One-click install (Claude Desktop):** Download the MCP Bundle and open it with Claude Desktop. An installation dialog will appear and prompt you for your API key. No terminal required.
|
|
3104
3103
|
|
|
3105
|
-
|
|
3104
|
+
___
|
|
3105
|
+
<b><div align="center">Download the Finance Toolkit MCP Bundle <a href="https://github.com/JerBouma/FinanceToolkit/releases/latest/download/financetoolkit.mcpb">here</a>.</div></b>
|
|
3106
|
+
___
|
|
3106
3107
|
|
|
3107
|
-
|
|
3108
|
+
**Option 3: Local installation (all clients):** Run the one-line setup wizard and it will configure your AI client automatically:
|
|
3108
3109
|
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3112
|
-
| Windows | `%APPDATA%\Claude\claude_desktop_config.json` |
|
|
3113
|
-
| Linux | `~/.config/claude/claude_desktop_config.json` |
|
|
3110
|
+
```
|
|
3111
|
+
uvx --from "financetoolkit[mcp]" financetoolkit-mcp-setup
|
|
3112
|
+
```
|
|
3114
3113
|
|
|
3115
|
-
|
|
3114
|
+
After running this command the wizard will launch and walk you through the rest of the setup interactively. For more information, see the [MCP Documentation](https://www.jeroenbouma.com/projects/financetoolkit/mcp) which also contains example prompts to get you started.
|
|
3116
3115
|
|
|
3117
|
-
|
|
3118
|
-
{
|
|
3119
|
-
"mcpServers": {
|
|
3120
|
-
"finance-toolkit": {
|
|
3121
|
-
"command": "uvx",
|
|
3122
|
-
"args": ["--from", "financetoolkit[mcp]", "financetoolkit-mcp"],
|
|
3123
|
-
"env": {
|
|
3124
|
-
"FINANCIAL_MODELING_PREP_API_KEY": "YOUR_API_KEY_HERE"
|
|
3125
|
-
}
|
|
3126
|
-
}
|
|
3127
|
-
}
|
|
3128
|
-
}
|
|
3129
|
-
```
|
|
3116
|
+
See an example of the Finance Toolkit MCP server in action in Claude Desktop below:
|
|
3130
3117
|
|
|
3131
|
-
|
|
3118
|
+
https://github.com/user-attachments/assets/96ad5288-d83d-4497-a345-1841c48c29d5
|
|
3132
3119
|
|
|
3133
3120
|
# Questions & Answers
|
|
3134
3121
|
|
|
@@ -3194,12 +3181,12 @@ The Finance Toolkit has been mentioned in various blogposts, research papers, ne
|
|
|
3194
3181
|
|
|
3195
3182
|
**Blogposts**
|
|
3196
3183
|
- [A Deep Dive into EOY Financial Performance & Risk Measures of Big Five using the Finance Toolkit in Python](https://wire.insiderfinance.io/a-deep-dive-into-eoy-financial-performance-risk-measures-of-big-five-using-the-financetoolkit-in-ef93fddd11db)
|
|
3197
|
-
- [Discovering the Best Integrated Platforms for Big Tech Quantitative Finance
|
|
3198
|
-
- [Investment Analysis
|
|
3184
|
+
- [Discovering the Best Integrated Platforms for Big Tech Quantitative Finance: 1. Finance Toolkit](https://wire.insiderfinance.io/discovering-the-best-integrated-platforms-for-big-tech-quantitative-finance-1-finance-toolkit-2e29b67eb4ea)
|
|
3185
|
+
- [Investment Analysis with the Finance Database](https://alpha2phi.medium.com/investment-analysis-finance-database-61f47ecfe7ca)
|
|
3199
3186
|
- [Unlocking Financial Clarity: Introducing the Open-Source Finance Toolkit Powered by FMP](https://site.financialmodelingprep.com/education/ESG/unlocking-financial-clarity-introducing-the-open-source-finance-toolkit-powered-by-fmp)
|
|
3200
3187
|
|
|
3201
3188
|
**Research**
|
|
3202
|
-
- [AI, Help Me Think
|
|
3189
|
+
- [AI, Help Me Think, but for Myself: Assisting People in Complex Decision-Making by Providing Different Kinds of Cognitive Support](https://www.microsoft.com/en-us/research/wp-content/uploads/2025/03/AI-Help-Me-Think-CHI-2025.pdf)
|
|
3203
3190
|
- [Fundamental Analysis using Muli-Agent System and Agentic RAG](https://connect.cfauk.org/HigherLogic/System/DownloadDocumentFile.ashx?DocumentFileKey=3ae6f3fc-593a-04ec-c3b8-be5643cab479&forceDialog=0)
|
|
3204
3191
|
|
|
3205
3192
|
**Newsletters & Social Media**
|
|
@@ -143,12 +143,8 @@ def convert_currencies(
|
|
|
143
143
|
|
|
144
144
|
if currencies_text:
|
|
145
145
|
logger.info(
|
|
146
|
-
"
|
|
147
|
-
|
|
148
|
-
financial_statement_name
|
|
149
|
-
if financial_statement_name
|
|
150
|
-
else "financial statement"
|
|
151
|
-
),
|
|
146
|
+
"Converting %s currency to match OHLC for: %s",
|
|
147
|
+
financial_statement_name or "financial statement",
|
|
152
148
|
", ".join(currencies_text),
|
|
153
149
|
)
|
|
154
150
|
|
|
@@ -14,7 +14,6 @@ from urllib.error import HTTPError, URLError
|
|
|
14
14
|
import numpy as np
|
|
15
15
|
import pandas as pd
|
|
16
16
|
import requests
|
|
17
|
-
from tqdm import tqdm
|
|
18
17
|
from urllib3.exceptions import MaxRetryError
|
|
19
18
|
|
|
20
19
|
from financetoolkit import helpers
|
|
@@ -131,6 +130,7 @@ def get_financial_statement(
|
|
|
131
130
|
start_date: str | None = None,
|
|
132
131
|
sleep_timer: bool = True,
|
|
133
132
|
user_subscription: str = "Free",
|
|
133
|
+
fiscal_year_adjustments: dict | None = None,
|
|
134
134
|
) -> pd.DataFrame:
|
|
135
135
|
"""
|
|
136
136
|
Retrieves financial statements (balance, income, or cash flow statements) for a single company ticker.
|
|
@@ -219,9 +219,26 @@ def get_financial_statement(
|
|
|
219
219
|
if quarter:
|
|
220
220
|
financial_statement["date"] = financial_statement["date"].dt.to_period("Q")
|
|
221
221
|
else:
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
222
|
+
# Derive the calendar year the fiscal period mostly represents.
|
|
223
|
+
# If the fiscal year ends in months 1-5 (Jan-May), more than half the period
|
|
224
|
+
# falls in the prior calendar year (e.g. NVDA Jan 31 end → label as prior year).
|
|
225
|
+
# Months 6-12 (Jun-Dec) stay as-is (current year is majority or tied).
|
|
226
|
+
end_month = financial_statement["date"].dt.month
|
|
227
|
+
end_year = financial_statement["date"].dt.year
|
|
228
|
+
calendar_year = end_year - (end_month < 6).astype(int) # noqa
|
|
229
|
+
|
|
230
|
+
shifted_mask = end_month < 6 # noqa
|
|
231
|
+
if shifted_mask.any() and fiscal_year_adjustments is not None:
|
|
232
|
+
fiscal_year_adjustments[ticker] = [
|
|
233
|
+
{"fiscal_year": int(fy), "calendar_year": int(cy)}
|
|
234
|
+
for fy, cy in zip(
|
|
235
|
+
end_year[shifted_mask], calendar_year[shifted_mask]
|
|
236
|
+
)
|
|
237
|
+
]
|
|
238
|
+
|
|
239
|
+
financial_statement["date"] = pd.PeriodIndex(
|
|
240
|
+
calendar_year.astype(str), freq="Y"
|
|
241
|
+
)
|
|
225
242
|
|
|
226
243
|
financial_statement = financial_statement.set_index("date").T
|
|
227
244
|
|
|
@@ -741,13 +758,10 @@ def get_revenue_segmentation(
|
|
|
741
758
|
no_data: list[str] = []
|
|
742
759
|
threads = []
|
|
743
760
|
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
if progress_bar
|
|
747
|
-
else ticker_list
|
|
761
|
+
logger.info(
|
|
762
|
+
"Obtaining %s segmentation data for %d tickers", method, len(ticker_list)
|
|
748
763
|
)
|
|
749
|
-
|
|
750
|
-
for ticker in ticker_list_iterator:
|
|
764
|
+
for ticker in ticker_list:
|
|
751
765
|
# Introduce a sleep timer to prevent rate limit errors
|
|
752
766
|
time.sleep(0.1)
|
|
753
767
|
|
|
@@ -950,13 +964,8 @@ def get_analyst_estimates(
|
|
|
950
964
|
no_data: list[str] = []
|
|
951
965
|
threads = []
|
|
952
966
|
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
if progress_bar
|
|
956
|
-
else ticker_list
|
|
957
|
-
)
|
|
958
|
-
|
|
959
|
-
for ticker in ticker_list_iterator:
|
|
967
|
+
logger.info("Obtaining analyst estimates for %d tickers", len(ticker_list))
|
|
968
|
+
for ticker in ticker_list:
|
|
960
969
|
# Introduce a sleep timer to prevent rate limit errors
|
|
961
970
|
time.sleep(0.1)
|
|
962
971
|
|
|
@@ -1094,13 +1103,8 @@ def get_profile(
|
|
|
1094
1103
|
no_data: list[str] = []
|
|
1095
1104
|
threads = []
|
|
1096
1105
|
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
if progress_bar
|
|
1100
|
-
else ticker_list
|
|
1101
|
-
)
|
|
1102
|
-
|
|
1103
|
-
for ticker in ticker_list_iterator:
|
|
1106
|
+
logger.info("Obtaining company profiles for %d tickers", len(ticker_list))
|
|
1107
|
+
for ticker in ticker_list:
|
|
1104
1108
|
# Introduce a sleep timer to prevent rate limit errors
|
|
1105
1109
|
time.sleep(0.1)
|
|
1106
1110
|
|
|
@@ -1209,13 +1213,8 @@ def get_quote(
|
|
|
1209
1213
|
no_data: list[str] = []
|
|
1210
1214
|
threads = []
|
|
1211
1215
|
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
if progress_bar
|
|
1215
|
-
else ticker_list
|
|
1216
|
-
)
|
|
1217
|
-
|
|
1218
|
-
for ticker in ticker_list_iterator:
|
|
1216
|
+
logger.info("Obtaining company quotes for %d tickers", len(ticker_list))
|
|
1217
|
+
for ticker in ticker_list:
|
|
1219
1218
|
# Introduce a sleep timer to prevent rate limit errors
|
|
1220
1219
|
time.sleep(0.1)
|
|
1221
1220
|
|
|
@@ -1305,13 +1304,8 @@ def get_rating(
|
|
|
1305
1304
|
no_data: list[str] = []
|
|
1306
1305
|
threads = []
|
|
1307
1306
|
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
if progress_bar
|
|
1311
|
-
else ticker_list
|
|
1312
|
-
)
|
|
1313
|
-
|
|
1314
|
-
for ticker in ticker_list_iterator:
|
|
1307
|
+
logger.info("Obtaining company ratings for %d tickers", len(ticker_list))
|
|
1308
|
+
for ticker in ticker_list:
|
|
1315
1309
|
# Introduce a sleep timer to prevent rate limit errors
|
|
1316
1310
|
time.sleep(0.1)
|
|
1317
1311
|
|
|
@@ -1433,13 +1427,8 @@ def get_earnings_calendar(
|
|
|
1433
1427
|
no_data: list[str] = []
|
|
1434
1428
|
threads = []
|
|
1435
1429
|
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
if progress_bar
|
|
1439
|
-
else ticker_list
|
|
1440
|
-
)
|
|
1441
|
-
|
|
1442
|
-
for ticker in ticker_list_iterator:
|
|
1430
|
+
logger.info("Obtaining earnings calendars for %d tickers", len(ticker_list))
|
|
1431
|
+
for ticker in ticker_list:
|
|
1443
1432
|
# Introduce a sleep timer to prevent rate limit errors
|
|
1444
1433
|
time.sleep(0.1)
|
|
1445
1434
|
|
|
@@ -1558,13 +1547,8 @@ def get_dividend_calendar(
|
|
|
1558
1547
|
no_data: list[str] = []
|
|
1559
1548
|
threads = []
|
|
1560
1549
|
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
if progress_bar
|
|
1564
|
-
else ticker_list
|
|
1565
|
-
)
|
|
1566
|
-
|
|
1567
|
-
for ticker in ticker_list_iterator:
|
|
1550
|
+
logger.info("Obtaining dividend calendars for %d tickers", len(ticker_list))
|
|
1551
|
+
for ticker in ticker_list:
|
|
1568
1552
|
# Introduce a sleep timer to prevent rate limit errors
|
|
1569
1553
|
time.sleep(0.1)
|
|
1570
1554
|
|
|
@@ -1689,11 +1673,8 @@ def get_esg_scores(
|
|
|
1689
1673
|
no_data: list[str] = []
|
|
1690
1674
|
threads = []
|
|
1691
1675
|
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
)
|
|
1695
|
-
|
|
1696
|
-
for ticker in ticker_list_iterator:
|
|
1676
|
+
logger.info("Obtaining ESG scores for %d tickers", len(ticker_list))
|
|
1677
|
+
for ticker in ticker_list:
|
|
1697
1678
|
# Introduce a sleep timer to prevent rate limit errors
|
|
1698
1679
|
time.sleep(0.1)
|
|
1699
1680
|
|
|
@@ -6,7 +6,6 @@ import time
|
|
|
6
6
|
|
|
7
7
|
import numpy as np
|
|
8
8
|
import pandas as pd
|
|
9
|
-
from tqdm import tqdm
|
|
10
9
|
|
|
11
10
|
from financetoolkit import fmp_model, normalization_model, yfinance_model
|
|
12
11
|
from financetoolkit.utilities import error_model, logger_model
|
|
@@ -31,6 +30,7 @@ def collect_financial_statements(
|
|
|
31
30
|
rounding: int | None = 4,
|
|
32
31
|
fmp_statement_format: pd.DataFrame = pd.DataFrame(),
|
|
33
32
|
fmp_statistics_format: pd.DataFrame = pd.DataFrame(),
|
|
33
|
+
fiscal_year_adjustments: dict | None = None,
|
|
34
34
|
yf_statement_format: pd.DataFrame = pd.DataFrame(),
|
|
35
35
|
sleep_timer: bool = True,
|
|
36
36
|
progress_bar: bool = True,
|
|
@@ -90,6 +90,7 @@ def collect_financial_statements(
|
|
|
90
90
|
start_date=start_date,
|
|
91
91
|
sleep_timer=sleep_timer,
|
|
92
92
|
user_subscription=user_subscription,
|
|
93
|
+
fiscal_year_adjustments=fiscal_year_adjustments,
|
|
93
94
|
)
|
|
94
95
|
|
|
95
96
|
financial_statement_dict["FinancialModelingPrep"][
|
|
@@ -108,6 +109,7 @@ def collect_financial_statements(
|
|
|
108
109
|
statement=statement,
|
|
109
110
|
quarter=quarter,
|
|
110
111
|
fallback=attempted_fmp,
|
|
112
|
+
fiscal_year_adjustments=fiscal_year_adjustments,
|
|
111
113
|
)
|
|
112
114
|
|
|
113
115
|
financial_statement_dict["YahooFinance"][
|
|
@@ -139,12 +141,7 @@ def collect_financial_statements(
|
|
|
139
141
|
"For more information, look here: https://www.jeroenbouma.com/fmp"
|
|
140
142
|
)
|
|
141
143
|
|
|
142
|
-
|
|
143
|
-
tqdm(ticker_list, desc=f"Obtaining {statement} data")
|
|
144
|
-
if progress_bar
|
|
145
|
-
else ticker_list
|
|
146
|
-
)
|
|
147
|
-
|
|
144
|
+
logger.info("Obtaining %s data for %d tickers", statement, len(ticker_list))
|
|
148
145
|
financial_statement_dict: dict[str, pd.DataFrame] = {
|
|
149
146
|
"FinancialModelingPrep": {},
|
|
150
147
|
"YahooFinance": {},
|
|
@@ -154,7 +151,12 @@ def collect_financial_statements(
|
|
|
154
151
|
no_data: list[str] = []
|
|
155
152
|
threads = []
|
|
156
153
|
|
|
157
|
-
|
|
154
|
+
# Shared registry populated by worker threads (dict writes per unique ticker key are
|
|
155
|
+
# effectively atomic under the GIL, so no explicit lock is needed here).
|
|
156
|
+
if fiscal_year_adjustments is None:
|
|
157
|
+
fiscal_year_adjustments = {}
|
|
158
|
+
|
|
159
|
+
for ticker in ticker_list:
|
|
158
160
|
# Introduce a sleep timer to prevent rate limit errors
|
|
159
161
|
time.sleep(0.1)
|
|
160
162
|
|
|
@@ -168,6 +170,12 @@ def collect_financial_statements(
|
|
|
168
170
|
for thread in threads:
|
|
169
171
|
thread.join()
|
|
170
172
|
|
|
173
|
+
if fiscal_year_adjustments:
|
|
174
|
+
logger.info(
|
|
175
|
+
"Mapping fiscal year to calendar year for: %s",
|
|
176
|
+
", ".join(fiscal_year_adjustments.keys()),
|
|
177
|
+
)
|
|
178
|
+
|
|
171
179
|
fmp_financial_statements_total = pd.DataFrame()
|
|
172
180
|
yf_financial_statements_total = pd.DataFrame()
|
|
173
181
|
fmp_financial_statement_statistics = pd.DataFrame()
|
|
@@ -300,4 +308,5 @@ def collect_financial_statements(
|
|
|
300
308
|
financial_statement_total,
|
|
301
309
|
financial_statement_statistics,
|
|
302
310
|
no_data,
|
|
311
|
+
fiscal_year_adjustments,
|
|
303
312
|
)
|