financetoolkit 2.1.4__tar.gz → 2.2.0__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.
Files changed (183) hide show
  1. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/.gitignore +1 -0
  2. financetoolkit-2.1.4/README.md → financetoolkit-2.2.0/PKG-INFO +94 -12
  3. financetoolkit-2.1.4/PKG-INFO → financetoolkit-2.2.0/README.md +56 -46
  4. financetoolkit-2.2.0/financetoolkit/cache/__init__.py +25 -0
  5. financetoolkit-2.2.0/financetoolkit/cache/cache_controller.py +821 -0
  6. financetoolkit-2.2.0/financetoolkit/cache/coverage_model.py +156 -0
  7. financetoolkit-2.2.0/financetoolkit/cache/frame_model.py +160 -0
  8. financetoolkit-2.2.0/financetoolkit/cache/policy_model.py +135 -0
  9. financetoolkit-2.2.0/financetoolkit/cache/request_model.py +30 -0
  10. financetoolkit-2.2.0/financetoolkit/cache/serialization_model.py +160 -0
  11. financetoolkit-2.2.0/financetoolkit/cache/sqlite_model.py +756 -0
  12. financetoolkit-2.2.0/financetoolkit/cache/ticker_model.py +214 -0
  13. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/currencies_model.py +117 -5
  14. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/discovery/discovery_controller.py +148 -109
  15. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/discovery/discovery_model.py +274 -109
  16. financetoolkit-2.2.0/financetoolkit/econometrics/causal_inference_model.py +1078 -0
  17. financetoolkit-2.2.0/financetoolkit/econometrics/causality_model.py +76 -0
  18. financetoolkit-2.2.0/financetoolkit/econometrics/cointegration_model.py +220 -0
  19. financetoolkit-2.2.0/financetoolkit/econometrics/diagnostics_model.py +459 -0
  20. financetoolkit-2.2.0/financetoolkit/econometrics/econometrics_controller.py +4864 -0
  21. financetoolkit-2.2.0/financetoolkit/econometrics/event_study_model.py +152 -0
  22. financetoolkit-2.2.0/financetoolkit/econometrics/fama_macbeth_model.py +233 -0
  23. financetoolkit-2.2.0/financetoolkit/econometrics/forecast_evaluation_model.py +477 -0
  24. financetoolkit-2.2.0/financetoolkit/econometrics/hypothesis_testing_model.py +480 -0
  25. financetoolkit-2.2.0/financetoolkit/econometrics/panel_data_model.py +568 -0
  26. financetoolkit-2.2.0/financetoolkit/econometrics/regression_model.py +867 -0
  27. financetoolkit-2.2.0/financetoolkit/econometrics/specification_tests_model.py +510 -0
  28. financetoolkit-2.2.0/financetoolkit/econometrics/time_series_model.py +1015 -0
  29. financetoolkit-2.2.0/financetoolkit/econometrics/unitroot_model.py +473 -0
  30. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/economics/economics_controller.py +3087 -394
  31. financetoolkit-2.2.0/financetoolkit/economics/fred_model.py +297 -0
  32. financetoolkit-2.2.0/financetoolkit/economics/gmdb_model.py +463 -0
  33. financetoolkit-2.2.0/financetoolkit/economics/oecd_model.py +1424 -0
  34. financetoolkit-2.2.0/financetoolkit/economics/yfinance_model.py +161 -0
  35. financetoolkit-2.2.0/financetoolkit/fixedincome/bond_model.py +860 -0
  36. financetoolkit-2.2.0/financetoolkit/fixedincome/derivative_model.py +321 -0
  37. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/fixedincome/ecb_model.py +3 -6
  38. financetoolkit-2.2.0/financetoolkit/fixedincome/euribor_model.py +61 -0
  39. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/fixedincome/fed_model.py +30 -6
  40. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/fixedincome/fixedincome_controller.py +1417 -241
  41. financetoolkit-2.2.0/financetoolkit/fixedincome/fmp_model.py +194 -0
  42. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/fixedincome/fred_model.py +72 -14
  43. financetoolkit-2.2.0/financetoolkit/fixedincome/helpers.py +74 -0
  44. financetoolkit-2.2.0/financetoolkit/fixedincome/yieldcurve_model.py +254 -0
  45. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/fmp_model.py +339 -77
  46. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/fundamentals_model.py +163 -11
  47. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/helpers.py +90 -7
  48. financetoolkit-2.2.0/financetoolkit/historical_model.py +806 -0
  49. financetoolkit-2.2.0/financetoolkit/mcp_server/__init__.py +1 -0
  50. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/mcp_server/auth_model.py +149 -14
  51. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/mcp_server/config.yaml +153 -17
  52. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/mcp_server/formatting_model.py +7 -7
  53. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/mcp_server/inspection_controller.py +101 -0
  54. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/mcp_server/mcp_controller.py +220 -30
  55. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/mcp_server/mcpb/manifest.json +15 -11
  56. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/mcp_server/mcpb/pyproject.toml +3 -3
  57. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/mcp_server/provider_model.py +169 -59
  58. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/mcp_server/registry_controller.py +118 -20
  59. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/mcp_server/setup_model.py +175 -64
  60. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/models/altman_model.py +30 -4
  61. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/models/dupont_model.py +52 -16
  62. financetoolkit-2.2.0/financetoolkit/models/enterprise_model.py +134 -0
  63. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/models/eva_model.py +57 -0
  64. financetoolkit-2.2.0/financetoolkit/models/fulmer_model.py +397 -0
  65. financetoolkit-2.2.0/financetoolkit/models/grover_model.py +149 -0
  66. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/models/growth_model.py +13 -0
  67. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/models/helpers.py +7 -15
  68. financetoolkit-2.2.0/financetoolkit/models/intrinsic_model.py +461 -0
  69. financetoolkit-2.2.0/financetoolkit/models/models_controller.py +4754 -0
  70. financetoolkit-2.2.0/financetoolkit/models/ohlson_model.py +413 -0
  71. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/models/piotroski_model.py +72 -50
  72. financetoolkit-2.2.0/financetoolkit/models/springate_model.py +173 -0
  73. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/models/wacc_model.py +9 -4
  74. financetoolkit-2.2.0/financetoolkit/models/zmijewski_model.py +182 -0
  75. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/normalization/balance.csv +53 -54
  76. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/normalization/balance_yf.csv +80 -74
  77. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/normalization/cash.csv +39 -40
  78. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/normalization/cash_yf.csv +53 -52
  79. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/normalization/income_yf.csv +42 -36
  80. financetoolkit-2.2.0/financetoolkit/normalization/statistics_yf.csv +2 -0
  81. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/normalization_model.py +57 -78
  82. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/options/binomial_trees_model.py +171 -15
  83. financetoolkit-2.2.0/financetoolkit/options/black_scholes_model.py +782 -0
  84. financetoolkit-2.2.0/financetoolkit/options/exotics_model.py +380 -0
  85. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/options/greeks_model.py +76 -22
  86. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/options/options_controller.py +2000 -314
  87. financetoolkit-2.2.0/financetoolkit/options/options_model.py +255 -0
  88. financetoolkit-2.2.0/financetoolkit/options/risk_neutral_density_model.py +103 -0
  89. financetoolkit-2.2.0/financetoolkit/options/svi_model.py +257 -0
  90. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/performance/helpers.py +36 -47
  91. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/performance/performance_controller.py +1435 -283
  92. financetoolkit-2.2.0/financetoolkit/performance/performance_model.py +2656 -0
  93. financetoolkit-2.2.0/financetoolkit/portfolio/overview_model.py +946 -0
  94. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/portfolio/portfolio_controller.py +1642 -1599
  95. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/portfolio/portfolio_model.py +53 -31
  96. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/ratios/efficiency_model.py +46 -8
  97. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/ratios/liquidity_model.py +71 -12
  98. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/ratios/profitability_model.py +166 -24
  99. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/ratios/ratios_controller.py +962 -191
  100. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/ratios/solvency_model.py +102 -11
  101. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/ratios/valuation_model.py +47 -7
  102. financetoolkit-2.2.0/financetoolkit/risk/backtesting_model.py +293 -0
  103. financetoolkit-2.2.0/financetoolkit/risk/copula_model.py +951 -0
  104. financetoolkit-2.2.0/financetoolkit/risk/covar_model.py +172 -0
  105. financetoolkit-2.2.0/financetoolkit/risk/cvar_model.py +429 -0
  106. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/risk/evar_model.py +4 -11
  107. financetoolkit-2.2.0/financetoolkit/risk/garch_model.py +924 -0
  108. financetoolkit-2.2.0/financetoolkit/risk/helpers.py +84 -0
  109. financetoolkit-2.2.0/financetoolkit/risk/market_liquidity_model.py +211 -0
  110. financetoolkit-2.2.0/financetoolkit/risk/realized_volatility_model.py +489 -0
  111. financetoolkit-2.2.0/financetoolkit/risk/risk_controller.py +5008 -0
  112. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/risk/risk_model.py +513 -110
  113. financetoolkit-2.2.0/financetoolkit/risk/var_model.py +545 -0
  114. financetoolkit-2.2.0/financetoolkit/technicals/__init__.py +0 -0
  115. financetoolkit-2.2.0/financetoolkit/technicals/breadth_model.py +556 -0
  116. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/technicals/helpers.py +3 -2
  117. financetoolkit-2.2.0/financetoolkit/technicals/momentum_model.py +1163 -0
  118. financetoolkit-2.2.0/financetoolkit/technicals/overlap_model.py +734 -0
  119. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/technicals/technicals_controller.py +2591 -814
  120. financetoolkit-2.2.0/financetoolkit/technicals/volatility_model.py +535 -0
  121. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/toolkit_controller.py +975 -452
  122. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/utilities/dataframe_model.py +48 -23
  123. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/utilities/error_model.py +137 -40
  124. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/utilities/logger_model.py +2 -4
  125. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/utilities/statistics_model.py +121 -33
  126. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/yfinance_model.py +170 -38
  127. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/pyproject.toml +25 -6
  128. financetoolkit-2.1.4/financetoolkit/economics/gmdb_model.py +0 -217
  129. financetoolkit-2.1.4/financetoolkit/economics/oecd_model.py +0 -666
  130. financetoolkit-2.1.4/financetoolkit/fixedincome/bond_model.py +0 -381
  131. financetoolkit-2.1.4/financetoolkit/fixedincome/derivative_model.py +0 -175
  132. financetoolkit-2.1.4/financetoolkit/fixedincome/euribor_model.py +0 -34
  133. financetoolkit-2.1.4/financetoolkit/fixedincome/helpers.py +0 -40
  134. financetoolkit-2.1.4/financetoolkit/historical_model.py +0 -479
  135. financetoolkit-2.1.4/financetoolkit/mcp_server/__init__.py +0 -1
  136. financetoolkit-2.1.4/financetoolkit/mcp_server/cache_model.py +0 -210
  137. financetoolkit-2.1.4/financetoolkit/models/enterprise_model.py +0 -72
  138. financetoolkit-2.1.4/financetoolkit/models/intrinsic_model.py +0 -158
  139. financetoolkit-2.1.4/financetoolkit/models/models_controller.py +0 -2530
  140. financetoolkit-2.1.4/financetoolkit/options/black_scholes_model.py +0 -99
  141. financetoolkit-2.1.4/financetoolkit/options/options_model.py +0 -74
  142. financetoolkit-2.1.4/financetoolkit/performance/performance_model.py +0 -1354
  143. financetoolkit-2.1.4/financetoolkit/portfolio/overview_model.py +0 -654
  144. financetoolkit-2.1.4/financetoolkit/risk/cvar_model.py +0 -244
  145. financetoolkit-2.1.4/financetoolkit/risk/garch_model.py +0 -247
  146. financetoolkit-2.1.4/financetoolkit/risk/helpers.py +0 -89
  147. financetoolkit-2.1.4/financetoolkit/risk/risk_controller.py +0 -2570
  148. financetoolkit-2.1.4/financetoolkit/risk/var_model.py +0 -254
  149. financetoolkit-2.1.4/financetoolkit/technicals/breadth_model.py +0 -187
  150. financetoolkit-2.1.4/financetoolkit/technicals/momentum_model.py +0 -511
  151. financetoolkit-2.1.4/financetoolkit/technicals/overlap_model.py +0 -370
  152. financetoolkit-2.1.4/financetoolkit/technicals/volatility_model.py +0 -207
  153. financetoolkit-2.1.4/financetoolkit/utilities/cache_model.py +0 -82
  154. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/LICENSE.txt +0 -0
  155. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/__init__.py +0 -0
  156. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/discovery/__init__.py +0 -0
  157. {financetoolkit-2.1.4/financetoolkit/economics → financetoolkit-2.2.0/financetoolkit/econometrics}/__init__.py +0 -0
  158. {financetoolkit-2.1.4/financetoolkit/fixedincome → financetoolkit-2.2.0/financetoolkit/economics}/__init__.py +0 -0
  159. {financetoolkit-2.1.4/financetoolkit/models → financetoolkit-2.2.0/financetoolkit/fixedincome}/__init__.py +0 -0
  160. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/mcp_server/__main__.py +0 -0
  161. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/mcp_server/coercion_model.py +0 -0
  162. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/mcp_server/mcpb/.mcpbignore +0 -0
  163. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/mcp_server/mcpb/LICENSE +0 -0
  164. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/mcp_server/mcpb/README.md +0 -0
  165. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/mcp_server/mcpb/build-mcpb.sh +0 -0
  166. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/mcp_server/mcpb/finance_toolkit_icon.png +0 -0
  167. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/mcp_server/tools_model.py +0 -0
  168. {financetoolkit-2.1.4/financetoolkit/options → financetoolkit-2.2.0/financetoolkit/models}/__init__.py +0 -0
  169. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/models/beneish_model.py +0 -0
  170. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/normalization/income.csv +0 -0
  171. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/normalization/statistics.csv +0 -0
  172. {financetoolkit-2.1.4/financetoolkit/performance → financetoolkit-2.2.0/financetoolkit/options}/__init__.py +0 -0
  173. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/options/helpers.py +0 -0
  174. {financetoolkit-2.1.4/financetoolkit/portfolio → financetoolkit-2.2.0/financetoolkit/performance}/__init__.py +0 -0
  175. {financetoolkit-2.1.4/financetoolkit/ratios → financetoolkit-2.2.0/financetoolkit/portfolio}/__init__.py +0 -0
  176. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/portfolio/config.yaml +0 -0
  177. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/portfolio/example_datasets/example_portfolio.csv +0 -0
  178. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/portfolio/example_datasets/example_portfolio.xlsx +0 -0
  179. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/portfolio/helpers.py +0 -0
  180. {financetoolkit-2.1.4/financetoolkit/risk → financetoolkit-2.2.0/financetoolkit/ratios}/__init__.py +0 -0
  181. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/ratios/helpers.py +0 -0
  182. {financetoolkit-2.1.4/financetoolkit/technicals → financetoolkit-2.2.0/financetoolkit/risk}/__init__.py +0 -0
  183. {financetoolkit-2.1.4 → financetoolkit-2.2.0}/financetoolkit/utilities/requests_model.py +0 -0
@@ -195,3 +195,4 @@ cython_debug/
195
195
  # and can be added to the global gitignore or merged into this file. For a more nuclear
196
196
  # option (not recommended) you can uncomment the following to ignore the entire idea folder.
197
197
  #.idea/
198
+ articles/
@@ -1,3 +1,41 @@
1
+ Metadata-Version: 2.5
2
+ Name: financetoolkit
3
+ Version: 2.2.0
4
+ Summary: Transparent and Efficient Financial Analysis
5
+ Author: Jeroen Bouma
6
+ License: MIT
7
+ License-File: LICENSE.txt
8
+ Keywords: Analysis,Commodities,Currencies,Database,ETFs,Economics,Equities,Finance,Financial,Fundamental,Funds,Indices,Moneymarkets,Options,Quantitative,Technical,Toolkit
9
+ Classifier: Development Status :: 5 - Production/Stable
10
+ Classifier: Intended Audience :: Financial and Insurance Industry
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Programming Language :: Python :: 3.15
18
+ Classifier: Topic :: Office/Business :: Financial :: Investment
19
+ Requires-Python: <3.16,>=3.11
20
+ Requires-Dist: openpyxl>=3.1
21
+ Requires-Dist: pandas>=3.0
22
+ Requires-Dist: pyyaml>=6.0
23
+ Requires-Dist: requests>=2.32
24
+ Requires-Dist: scikit-learn>=1.6
25
+ Requires-Dist: yfinance
26
+ Provides-Extra: econometrics
27
+ Requires-Dist: linearmodels>=6.0; extra == 'econometrics'
28
+ Requires-Dist: statsmodels>=0.14; extra == 'econometrics'
29
+ Provides-Extra: mcp
30
+ Requires-Dist: fastmcp>=3.4.2; extra == 'mcp'
31
+ Requires-Dist: linearmodels>=6.0; extra == 'mcp'
32
+ Requires-Dist: mcp[cli]>=1.27.0; extra == 'mcp'
33
+ Requires-Dist: python-dotenv>=1.0; extra == 'mcp'
34
+ Requires-Dist: rich>=13.0; extra == 'mcp'
35
+ Requires-Dist: statsmodels>=0.14; extra == 'mcp'
36
+ Requires-Dist: tabulate>=0.9.0; extra == 'mcp'
37
+ Description-Content-Type: text/markdown
38
+
1
39
  <!-- mcp-name: io.github.JerBouma/financetoolkit -->
2
40
  [![FinanceToolkit](https://github.com/JerBouma/FinanceToolkit/assets/46355364/198d47bd-e1b3-492d-acc4-5d9f02d1d009)](https://github.com/JerBouma/FinanceToolkit)
3
41
 
@@ -17,7 +55,7 @@ While browsing a variety of websites, I repeatedly observed significant fluctuat
17
55
 
18
56
  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 of calculation varies leading to different results. Therefore, collecting data from multiple sources can lead to wrong interpretation of the results given that one source could apply a different definition than another. And that is, if that definition is even available as often the underlying methods are hidden behind a paid subscription.
19
57
 
20
- **This is why I designed the FinanceToolkit**, this is an open-source toolkit in which all relevant financial ratios ([200+](https://www.jeroenbouma.com/projects/financetoolkit/docs)), indicators and performance measurements are written down in the most simplistic way allowing for complete transparency of the method of calculation ([proof](https://github.com/JerBouma/FinanceToolkit/blob/main/financetoolkit/ratios/valuation_model.py)). This enables you to avoid dependence on metrics from other providers that do not provide their methods. With a large selection of financial statements in hand, it facilitates streamlined calculations, promoting the adoption of a consistent and universally understood methods and formulas.
58
+ **This is why I designed the FinanceToolkit**, this is an open-source toolkit in which all relevant financial methods ([500+](https://www.jeroenbouma.com/projects/financetoolkit/docs)) are written down in the most simplistic way allowing for complete transparency of the method of calculation ([proof](https://github.com/JerBouma/FinanceToolkit/blob/main/financetoolkit/ratios/valuation_model.py)). This enables you to avoid dependence on metrics from other providers that do not provide their methods. With a large selection of financial statements in hand, it facilitates streamlined calculations, promoting the adoption of a consistent and universally understood methods and formulas.
21
59
 
22
60
  Beyond Equities, it supports Options, Currencies, Cryptocurrencies, ETFs, Mutual Funds, Indices, Money Markets, Commodities, Key Economic Indicators and more, allowing you to obtain historical data as well as important performance and risk measurements such as the Sharpe Ratio and Value at Risk.
23
61
 
@@ -26,7 +64,7 @@ Complementing this is the [Finance Database 🌎](https://github.com/JerBouma/Fi
26
64
  ___
27
65
  **🔌 The Finance Toolkit is also available as an [MCP Server](https://www.jeroenbouma.com/projects/financetoolkit/mcp)**
28
66
 
29
- Query 200+ metrics from Claude, Copilot, Cursor, Windsurf or any MCP-compatible client without writing code.
67
+ Query 500+ methods from Claude, Copilot, Cursor, Windsurf or any MCP-compatible client without writing code.
30
68
 
31
69
  - **Hosted:** connect to `https://financetoolkit.jeroenbouma.com/mcp` — OAuth handles the rest on first use.
32
70
  - **Local:** `uvx --from "financetoolkit[mcp]" financetoolkit-mcp-setup` — sets up your client config and API key automatically. See [MCP Server Documentation](https://www.jeroenbouma.com/projects/financetoolkit/mcp#local-clients) for manual setup.
@@ -77,6 +115,8 @@ Through the link you are able to subscribe for the free plan and also premium pl
77
115
 
78
116
  **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.
79
117
 
118
+ The same `enforce_source` argument is also accepted per call on `get_historical_data`, `get_treasury_data` and the four statement functions (`get_balance_sheet_statement`, `get_income_statement`, `get_cash_flow_statement` and `get_statistics_statement`), where it overrides whatever the Toolkit was initialised with.
119
+
80
120
  # Functionality
81
121
 
82
122
  This section is an introduction to the Finance Toolkit. Find with the link below 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,9 +481,37 @@ In which the weights and returns can be depicted as follows:
441
481
 
442
482
  ![Portfolio](https://github.com/user-attachments/assets/a5e05df5-a76a-42fa-bb30-f640cd48da62)
443
483
 
484
+ ### Applying Econometric Techniques
485
+
486
+ The `econometrics` module provides [regression](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_ols), [hypothesis testing](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_jarque_bera_test), [unit root and cointegration](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_augmented_dickey_fuller), [Granger causality](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_granger_causality) and [panel data](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_fixed_effects) methods built on `statsmodels` and `linearmodels`. It requires the optional `financetoolkit[econometrics]` extra (`pip install financetoolkit[econometrics]`) and can be used via `companies.econometrics`.
487
+
488
+ ```python
489
+ # AAPL is the Toolkit's first ticker, so it's the default dependent ticker;
490
+ # every other ticker becomes the default independent set
491
+ companies.econometrics.get_ols(period="weekly")
492
+ ```
493
+
494
+ Regressing Apple's returns on a mix of its chip suppliers, megacap peers and two unrelated names (Benchmark excluded) gives:
495
+
496
+ | | Coefficient | Std. Error | t-Statistic | P-Value |
497
+ |:----------|--------------:|-------------:|--------------:|----------:|
498
+ | Intercept | 0.0028 | 0.0017 | 1.6815 | 0.0943 |
499
+ | TSM | -0.0054 | 0.0523 | -0.1028 | 0.9182 |
500
+ | QCOM | 0.1432 | 0.0361 | 3.9717 | 0.0001 |
501
+ | SWKS | 0.2141 | 0.0484 | 4.4221 | 0.0000 |
502
+ | MSFT | 0.3036 | 0.0864 | 3.5144 | 0.0005 |
503
+ | GOOGL | 0.1448 | 0.0689 | 2.1015 | 0.0369 |
504
+ | AMZN | 0.0617 | 0.0529 | 1.1664 | 0.2448 |
505
+ | META | -0.0132 | 0.0389 | -0.3398 | 0.7343 |
506
+ | NVDA | -0.0024 | 0.0415 | -0.0575 | 0.9542 |
507
+ | XOM | -0.0291 | 0.0373 | -0.7799 | 0.4364 |
508
+ | PG | 0.2858 | 0.0707 | 4.0393 | 0.0001 |
509
+
510
+ Only `QCOM`, `SWKS`, `MSFT` and `GOOGL` come out statistically significant once every regressor is controlled for at once. The `econometrics` module covers 48 methods in total, including [unit root tests](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_augmented_dickey_fuller) (ADF, KPSS, Phillips-Perron), [cointegration and Granger causality](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_engle_granger_cointegration), [panel data estimators](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_fixed_effects) (Fixed/Random Effects), [causal inference](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_propensity_score_matching) (IV-2SLS, Difference-in-Differences, Regression Discontinuity, Propensity Score Matching, Synthetic Control) and [time-series forecasting](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_arima_forecast) (ARIMA, VAR, VECM). **Find the Notebook [here](https://www.jeroenbouma.com/projects/financetoolkit/econometrics-notebook) and the full econometrics documentation [here](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics).**
511
+
444
512
  # MCP Server
445
513
 
446
- The Finance Toolkit MCP Server exposes 200+ financial metrics, models, and economic indicators directly to any AI assistant that supports the [Model Context Protocol](https://modelcontextprotocol.io) (MCP). Ask questions in plain English — the AI fetches live financial data on your behalf, backed by the transparent, open-source calculation methods of the Finance Toolkit.
514
+ The Finance Toolkit MCP Server exposes 500+ financial methods directly to any AI assistant that supports the [Model Context Protocol](https://modelcontextprotocol.io) (MCP). Ask questions in plain English — the AI fetches live financial data on your behalf, backed by the transparent, open-source calculation methods of the Finance Toolkit.
447
515
 
448
516
  See an example of the Finance Toolkit MCP server in action in Claude Desktop below:
449
517
 
@@ -504,23 +572,37 @@ Most functions will have the option to define the `trailing` parameter. This let
504
572
 
505
573
  > **How can I save the data periodically so that I don't have to retrieve it every single time again?**
506
574
 
507
- The Toolkit has the option to work with cached data through `use_cached_data=True` when initializing the Toolkit class. If you then use any of the functionalities of the Toolkit itself (e.g. `get_balance_sheet_statement`) it will store the data in a pickle file. When initializing the Toolkit class again with `use_cached_data=True`, it will load the data from the pickle file including all other previously set parameters (e.g. start_date and quarterly). You are also able to select a specific location to store the cached data by providing a string to the `use_cached_data` parameter. This will store the data in the provided location (with the assumption the folder exists).
575
+ The Toolkit has the option to work with cached data through `use_cached_data=True` when initializing the Toolkit class. Any data that comes from an external source (financial statements, historical prices, economic indicators, and so on) is then stored in a local SQLite database and reused on the next run. Anything the Toolkit calculates itself is never cached, it is always derived from that data on demand.
508
576
 
509
- As an example:
577
+ The cache keeps track of what it already holds per ticker and per date range, which means changing a parameter does not throw the rest away:
510
578
 
511
- <img width="1000" alt="image" src="https://github.com/user-attachments/assets/943a1cfb-95ad-4455-90f0-0b33dcd7b0df" />
579
+ - Repeating the same request retrieves nothing at all.
580
+ - Widening the period only retrieves the years that were missing.
581
+ - Adding a ticker only retrieves that one ticker.
512
582
 
513
- If I wish to receive this data again, I no longer need an API key or set the tickers and can simply keep `use_cached_data=True`.
583
+ By default the database lives in your user configuration directory, which is the same one the MCP server uses, so both share a single cache. You can also select a specific location by providing a string to the `use_cached_data` parameter, which will store the database in the provided folder.
514
584
 
515
- <img width="1000" alt="image" src="https://github.com/user-attachments/assets/29ef58ca-e208-4c9a-b663-f66b299d3188" />
585
+ To see what is currently stored, use `toolkit.get_cache_contents()`. It reports the entries grouped by source and dataset:
516
586
 
517
- Please note that it will force the settings as found in the pickle files so if you wish to use a different time period, you will have to recollect.
587
+ | source | dataset | entities | entries | oldest_write | newest_write |
588
+ |:----------------------|:-----------|---------:|--------:|:--------------------|:--------------------|
589
+ | FinancialModelingPrep | historical | 2 | 2 | 2025-01-14 09:12:03 | 2025-01-14 09:12:05 |
590
+ | FinancialModelingPrep | statements | 2 | 2 | 2025-01-14 09:12:01 | 2025-01-14 09:12:02 |
518
591
 
519
- <img width="1000" alt="image" src="https://github.com/user-attachments/assets/40229dcb-18f0-4e73-8a43-017b1b25d33f" />
592
+ The Finance Toolkit never clears the cache on its own, not even when its own internal structure changes. Removing data is always something you ask for explicitly with `toolkit.clear_cache()`, and it can be narrowed instead of wholesale:
520
593
 
521
- You can also change the folder by entering a string instead of a boolean for the `use_cached_data` parameter.
594
+ ```python
595
+ # Remove only the price history of a single ticker
596
+ toolkit.clear_cache(source="FinancialModelingPrep", ticker="AAPL")
597
+
598
+ # Remove everything retrieved from the OECD
599
+ toolkit.clear_cache(source="OECD")
600
+
601
+ # Remove the entire cache, which has to be confirmed
602
+ toolkit.clear_cache(confirm=True)
603
+ ```
522
604
 
523
- <img width="1000" alt="image" src="https://github.com/user-attachments/assets/a6710d20-55b9-48f1-812e-4ff4fbe06a15" />
605
+ The `source` names match the ones used by the `enforce_source` parameter, so "FinancialModelingPrep" and "YahooFinance" mean the same thing in both places.
524
606
 
525
607
  > **What is the "Benchmark" that is automatically obtained when acquiring historical data?**
526
608
 
@@ -1,37 +1,3 @@
1
- Metadata-Version: 2.4
2
- Name: financetoolkit
3
- Version: 2.1.4
4
- Summary: Transparent and Efficient Financial Analysis
5
- Author: Jeroen Bouma
6
- License: MIT
7
- License-File: LICENSE.txt
8
- Keywords: Analysis,Commodities,Currencies,Database,ETFs,Economics,Equities,Finance,Financial,Fundamental,Funds,Indices,Moneymarkets,Options,Quantitative,Technical,Toolkit
9
- Classifier: Development Status :: 5 - Production/Stable
10
- Classifier: Intended Audience :: Financial and Insurance Industry
11
- Classifier: License :: OSI Approved :: MIT License
12
- Classifier: Operating System :: OS Independent
13
- Classifier: Programming Language :: Python :: 3.10
14
- Classifier: Programming Language :: Python :: 3.11
15
- Classifier: Programming Language :: Python :: 3.12
16
- Classifier: Programming Language :: Python :: 3.13
17
- Classifier: Programming Language :: Python :: 3.14
18
- Classifier: Programming Language :: Python :: 3.15
19
- Classifier: Topic :: Office/Business :: Financial :: Investment
20
- Requires-Python: <3.16,>=3.10
21
- Requires-Dist: openpyxl>=3.1
22
- Requires-Dist: pandas>=2.2
23
- Requires-Dist: requests>=2.32
24
- Requires-Dist: scikit-learn>=1.6
25
- Requires-Dist: yfinance
26
- Provides-Extra: mcp
27
- Requires-Dist: fastmcp>=3.4.2; extra == 'mcp'
28
- Requires-Dist: mcp[cli]>=1.27.0; extra == 'mcp'
29
- Requires-Dist: python-dotenv>=1.0; extra == 'mcp'
30
- Requires-Dist: pyyaml>=6.0; extra == 'mcp'
31
- Requires-Dist: rich>=13.0; extra == 'mcp'
32
- Requires-Dist: tabulate>=0.9.0; extra == 'mcp'
33
- Description-Content-Type: text/markdown
34
-
35
1
  <!-- mcp-name: io.github.JerBouma/financetoolkit -->
36
2
  [![FinanceToolkit](https://github.com/JerBouma/FinanceToolkit/assets/46355364/198d47bd-e1b3-492d-acc4-5d9f02d1d009)](https://github.com/JerBouma/FinanceToolkit)
37
3
 
@@ -51,7 +17,7 @@ While browsing a variety of websites, I repeatedly observed significant fluctuat
51
17
 
52
18
  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 of calculation varies leading to different results. Therefore, collecting data from multiple sources can lead to wrong interpretation of the results given that one source could apply a different definition than another. And that is, if that definition is even available as often the underlying methods are hidden behind a paid subscription.
53
19
 
54
- **This is why I designed the FinanceToolkit**, this is an open-source toolkit in which all relevant financial ratios ([200+](https://www.jeroenbouma.com/projects/financetoolkit/docs)), indicators and performance measurements are written down in the most simplistic way allowing for complete transparency of the method of calculation ([proof](https://github.com/JerBouma/FinanceToolkit/blob/main/financetoolkit/ratios/valuation_model.py)). This enables you to avoid dependence on metrics from other providers that do not provide their methods. With a large selection of financial statements in hand, it facilitates streamlined calculations, promoting the adoption of a consistent and universally understood methods and formulas.
20
+ **This is why I designed the FinanceToolkit**, this is an open-source toolkit in which all relevant financial methods ([500+](https://www.jeroenbouma.com/projects/financetoolkit/docs)) are written down in the most simplistic way allowing for complete transparency of the method of calculation ([proof](https://github.com/JerBouma/FinanceToolkit/blob/main/financetoolkit/ratios/valuation_model.py)). This enables you to avoid dependence on metrics from other providers that do not provide their methods. With a large selection of financial statements in hand, it facilitates streamlined calculations, promoting the adoption of a consistent and universally understood methods and formulas.
55
21
 
56
22
  Beyond Equities, it supports Options, Currencies, Cryptocurrencies, ETFs, Mutual Funds, Indices, Money Markets, Commodities, Key Economic Indicators and more, allowing you to obtain historical data as well as important performance and risk measurements such as the Sharpe Ratio and Value at Risk.
57
23
 
@@ -60,7 +26,7 @@ Complementing this is the [Finance Database 🌎](https://github.com/JerBouma/Fi
60
26
  ___
61
27
  **🔌 The Finance Toolkit is also available as an [MCP Server](https://www.jeroenbouma.com/projects/financetoolkit/mcp)**
62
28
 
63
- Query 200+ metrics from Claude, Copilot, Cursor, Windsurf or any MCP-compatible client without writing code.
29
+ Query 500+ methods from Claude, Copilot, Cursor, Windsurf or any MCP-compatible client without writing code.
64
30
 
65
31
  - **Hosted:** connect to `https://financetoolkit.jeroenbouma.com/mcp` — OAuth handles the rest on first use.
66
32
  - **Local:** `uvx --from "financetoolkit[mcp]" financetoolkit-mcp-setup` — sets up your client config and API key automatically. See [MCP Server Documentation](https://www.jeroenbouma.com/projects/financetoolkit/mcp#local-clients) for manual setup.
@@ -111,6 +77,8 @@ Through the link you are able to subscribe for the free plan and also premium pl
111
77
 
112
78
  **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.
113
79
 
80
+ The same `enforce_source` argument is also accepted per call on `get_historical_data`, `get_treasury_data` and the four statement functions (`get_balance_sheet_statement`, `get_income_statement`, `get_cash_flow_statement` and `get_statistics_statement`), where it overrides whatever the Toolkit was initialised with.
81
+
114
82
  # Functionality
115
83
 
116
84
  This section is an introduction to the Finance Toolkit. Find with the link below 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,9 +443,37 @@ In which the weights and returns can be depicted as follows:
475
443
 
476
444
  ![Portfolio](https://github.com/user-attachments/assets/a5e05df5-a76a-42fa-bb30-f640cd48da62)
477
445
 
446
+ ### Applying Econometric Techniques
447
+
448
+ The `econometrics` module provides [regression](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_ols), [hypothesis testing](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_jarque_bera_test), [unit root and cointegration](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_augmented_dickey_fuller), [Granger causality](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_granger_causality) and [panel data](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_fixed_effects) methods built on `statsmodels` and `linearmodels`. It requires the optional `financetoolkit[econometrics]` extra (`pip install financetoolkit[econometrics]`) and can be used via `companies.econometrics`.
449
+
450
+ ```python
451
+ # AAPL is the Toolkit's first ticker, so it's the default dependent ticker;
452
+ # every other ticker becomes the default independent set
453
+ companies.econometrics.get_ols(period="weekly")
454
+ ```
455
+
456
+ Regressing Apple's returns on a mix of its chip suppliers, megacap peers and two unrelated names (Benchmark excluded) gives:
457
+
458
+ | | Coefficient | Std. Error | t-Statistic | P-Value |
459
+ |:----------|--------------:|-------------:|--------------:|----------:|
460
+ | Intercept | 0.0028 | 0.0017 | 1.6815 | 0.0943 |
461
+ | TSM | -0.0054 | 0.0523 | -0.1028 | 0.9182 |
462
+ | QCOM | 0.1432 | 0.0361 | 3.9717 | 0.0001 |
463
+ | SWKS | 0.2141 | 0.0484 | 4.4221 | 0.0000 |
464
+ | MSFT | 0.3036 | 0.0864 | 3.5144 | 0.0005 |
465
+ | GOOGL | 0.1448 | 0.0689 | 2.1015 | 0.0369 |
466
+ | AMZN | 0.0617 | 0.0529 | 1.1664 | 0.2448 |
467
+ | META | -0.0132 | 0.0389 | -0.3398 | 0.7343 |
468
+ | NVDA | -0.0024 | 0.0415 | -0.0575 | 0.9542 |
469
+ | XOM | -0.0291 | 0.0373 | -0.7799 | 0.4364 |
470
+ | PG | 0.2858 | 0.0707 | 4.0393 | 0.0001 |
471
+
472
+ Only `QCOM`, `SWKS`, `MSFT` and `GOOGL` come out statistically significant once every regressor is controlled for at once. The `econometrics` module covers 48 methods in total, including [unit root tests](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_augmented_dickey_fuller) (ADF, KPSS, Phillips-Perron), [cointegration and Granger causality](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_engle_granger_cointegration), [panel data estimators](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_fixed_effects) (Fixed/Random Effects), [causal inference](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_propensity_score_matching) (IV-2SLS, Difference-in-Differences, Regression Discontinuity, Propensity Score Matching, Synthetic Control) and [time-series forecasting](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics#get_arima_forecast) (ARIMA, VAR, VECM). **Find the Notebook [here](https://www.jeroenbouma.com/projects/financetoolkit/econometrics-notebook) and the full econometrics documentation [here](https://www.jeroenbouma.com/projects/financetoolkit/docs/econometrics).**
473
+
478
474
  # MCP Server
479
475
 
480
- The Finance Toolkit MCP Server exposes 200+ financial metrics, models, and economic indicators directly to any AI assistant that supports the [Model Context Protocol](https://modelcontextprotocol.io) (MCP). Ask questions in plain English — the AI fetches live financial data on your behalf, backed by the transparent, open-source calculation methods of the Finance Toolkit.
476
+ The Finance Toolkit MCP Server exposes 500+ financial methods directly to any AI assistant that supports the [Model Context Protocol](https://modelcontextprotocol.io) (MCP). Ask questions in plain English — the AI fetches live financial data on your behalf, backed by the transparent, open-source calculation methods of the Finance Toolkit.
481
477
 
482
478
  See an example of the Finance Toolkit MCP server in action in Claude Desktop below:
483
479
 
@@ -538,23 +534,37 @@ Most functions will have the option to define the `trailing` parameter. This let
538
534
 
539
535
  > **How can I save the data periodically so that I don't have to retrieve it every single time again?**
540
536
 
541
- The Toolkit has the option to work with cached data through `use_cached_data=True` when initializing the Toolkit class. If you then use any of the functionalities of the Toolkit itself (e.g. `get_balance_sheet_statement`) it will store the data in a pickle file. When initializing the Toolkit class again with `use_cached_data=True`, it will load the data from the pickle file including all other previously set parameters (e.g. start_date and quarterly). You are also able to select a specific location to store the cached data by providing a string to the `use_cached_data` parameter. This will store the data in the provided location (with the assumption the folder exists).
537
+ The Toolkit has the option to work with cached data through `use_cached_data=True` when initializing the Toolkit class. Any data that comes from an external source (financial statements, historical prices, economic indicators, and so on) is then stored in a local SQLite database and reused on the next run. Anything the Toolkit calculates itself is never cached, it is always derived from that data on demand.
542
538
 
543
- As an example:
539
+ The cache keeps track of what it already holds per ticker and per date range, which means changing a parameter does not throw the rest away:
544
540
 
545
- <img width="1000" alt="image" src="https://github.com/user-attachments/assets/943a1cfb-95ad-4455-90f0-0b33dcd7b0df" />
541
+ - Repeating the same request retrieves nothing at all.
542
+ - Widening the period only retrieves the years that were missing.
543
+ - Adding a ticker only retrieves that one ticker.
546
544
 
547
- If I wish to receive this data again, I no longer need an API key or set the tickers and can simply keep `use_cached_data=True`.
545
+ By default the database lives in your user configuration directory, which is the same one the MCP server uses, so both share a single cache. You can also select a specific location by providing a string to the `use_cached_data` parameter, which will store the database in the provided folder.
548
546
 
549
- <img width="1000" alt="image" src="https://github.com/user-attachments/assets/29ef58ca-e208-4c9a-b663-f66b299d3188" />
547
+ To see what is currently stored, use `toolkit.get_cache_contents()`. It reports the entries grouped by source and dataset:
550
548
 
551
- Please note that it will force the settings as found in the pickle files so if you wish to use a different time period, you will have to recollect.
549
+ | source | dataset | entities | entries | oldest_write | newest_write |
550
+ |:----------------------|:-----------|---------:|--------:|:--------------------|:--------------------|
551
+ | FinancialModelingPrep | historical | 2 | 2 | 2025-01-14 09:12:03 | 2025-01-14 09:12:05 |
552
+ | FinancialModelingPrep | statements | 2 | 2 | 2025-01-14 09:12:01 | 2025-01-14 09:12:02 |
552
553
 
553
- <img width="1000" alt="image" src="https://github.com/user-attachments/assets/40229dcb-18f0-4e73-8a43-017b1b25d33f" />
554
+ The Finance Toolkit never clears the cache on its own, not even when its own internal structure changes. Removing data is always something you ask for explicitly with `toolkit.clear_cache()`, and it can be narrowed instead of wholesale:
554
555
 
555
- You can also change the folder by entering a string instead of a boolean for the `use_cached_data` parameter.
556
+ ```python
557
+ # Remove only the price history of a single ticker
558
+ toolkit.clear_cache(source="FinancialModelingPrep", ticker="AAPL")
559
+
560
+ # Remove everything retrieved from the OECD
561
+ toolkit.clear_cache(source="OECD")
562
+
563
+ # Remove the entire cache, which has to be confirmed
564
+ toolkit.clear_cache(confirm=True)
565
+ ```
556
566
 
557
- <img width="1000" alt="image" src="https://github.com/user-attachments/assets/a6710d20-55b9-48f1-812e-4ff4fbe06a15" />
567
+ The `source` names match the ones used by the `enforce_source` parameter, so "FinancialModelingPrep" and "YahooFinance" mean the same thing in both places.
558
568
 
559
569
  > **What is the "Benchmark" that is automatically obtained when acquiring historical data?**
560
570
 
@@ -0,0 +1,25 @@
1
+ """Cache Module"""
2
+
3
+ from financetoolkit.cache.cache_controller import (
4
+ Cache,
5
+ CachePlan,
6
+ get_cache,
7
+ get_default_cache_location,
8
+ parse_use_cached_data,
9
+ reset_cache_registry,
10
+ resolve_cache_location,
11
+ )
12
+ from financetoolkit.cache.policy_model import CachePolicy, get_policy, register_policy
13
+
14
+ __all__ = [
15
+ "Cache",
16
+ "CachePlan",
17
+ "CachePolicy",
18
+ "get_cache",
19
+ "get_default_cache_location",
20
+ "get_policy",
21
+ "parse_use_cached_data",
22
+ "register_policy",
23
+ "reset_cache_registry",
24
+ "resolve_cache_location",
25
+ ]