Skip to content

FinanceToolkit v2.1.0

Latest

Choose a tag to compare

@JerBouma JerBouma released this 09 Jun 13:50
· 6 commits to main since this release
f1a5249

Many new improvements have been made this release as over 13.000 lines of code are added and 112 files have been changed. See for a complete rundown of all changed files the PR #215.

MCP Server

The Finance Toolkit now ships with a Model Context Protocol (MCP) server, making it possible to use all 200+ financial metrics directly inside AI assistants such as Claude Desktop, Cursor, and any other MCP-compatible client.

What's included:

  • A guided setup wizard (financetoolkit-mcp-setup) that auto-configures Claude Desktop, Cursor, and other clients and stores your API keys securely.
  • An interactive inspector (financetoolkit-mcp-inspector) for testing tools before connecting them to a client.
  • A built-in SKILL prompt that instructs the AI how to call the right tools, chain requests efficiently, and interpret financial results.
  • Improved logging (stderr), cache path handling, and .env auto-loading on startup.

To get started with the MCP server, simply run the following command:

uvx --from "financetoolkit[mcp]" financetoolkit-mcp-setup

Three results of a relatively advanced model (Claude Sonnet 4.6) shows how powerful models can layer in very detailed qualitative analysis and narrative synthesis with the information from the Finance Toolkit MCP.

Compare Apple with Microsoft, what company is the most profitable?

Across the five-year window from 2021 to 2025, Microsoft and Apple present genuinely different profitability profiles depending on the analytical lens applied — a nuance that institutional research rarely collapses into a single verdict. The data below, derived directly from the Finance Toolkit MCP server, covers gross margin, operating margin, and net profit margin across both companies from fiscal year 2021 through fiscal year 2025.

Microsoft commands a structurally superior margin stack at every level of the income statement. Its software and cloud-heavy revenue mix consistently produces gross margins in the 68–70% range, reflecting the near-zero marginal cost of licensing and Azure compute, while Apple's hardware-weighted mix constrains gross margins to the 42–47% band despite meaningful Services segment expansion.

Metric Company 2021 2022 2023 2024 2025
Gross Margin AAPL 41.78% 43.31% 44.13% 46.21% 46.91%
Gross Margin MSFT 68.93% 68.40% 68.92% 69.76% 68.82%
Operating Margin AAPL 29.78% 30.29% 29.82% 31.51% 31.97%
Operating Margin MSFT 41.59% 42.06% 41.77% 44.64% 45.62%
Net Profit Margin AAPL 25.88% 25.31% 25.31% 23.97% 26.92%
Net Profit Margin MSFT 36.45% 36.69% 34.15% 35.96% 36.15%

The margin story, however, is not the complete picture. When shifting from income-statement efficiency to capital deployment efficiency, Apple's financial engineering inverts the comparison dramatically. Apple carries a deliberately compressed equity base — the result of decades of aggressive share repurchases — which mechanically inflates its Return on Equity to levels that appear extraordinary, consistently exceeding 170% in recent years. The following table captures ROE, Return on Invested Capital, and Return on Assets for the same period.

Metric Company 2022 2023 2024 2025
Return on Equity AAPL 175.46% 171.95% 157.41% 171.42%
Return on Equity MSFT 47.15% 38.82% 37.13% 33.28%
Return on Invested Capital AAPL 59.90% 60.68% 60.19% 70.38%
Return on Invested Capital MSFT 38.73% 34.74% 33.71% 30.64%
Return on Assets AAPL 28.36% 27.50% 26.13% 30.93%
Return on Assets MSFT 20.82% 18.63% 19.07% 18.00%

The verdict depends precisely on what one means by "most profitable." On a pure income statement basis — gross, operating, and net margins — Microsoft is unambiguously the more profitable business, generating roughly 22 percentage points more net income per dollar of revenue than Apple in fiscal year 2025 (36.15% vs. 26.92%). This structural advantage reflects Microsoft's software and cloud economics, where incremental revenue has near-zero marginal cost.

Apple, by contrast, leads on every capital efficiency metric: its ROIC of 70.38% in 2025 versus Microsoft's 30.64% indicates that Apple extracts significantly more economic value from each dollar of invested capital. Its ROA advantage (30.93% vs. 18.00%) is similarly consistent across the full sample. The ROE comparison is analytically distorted by Apple's balance sheet structure and is better set aside in favor of ROIC as the cleanest apples-to-apples measure.

For a more complete picture, the analysis could be extended into DuPont decomposition to isolate whether Apple's ROIC lead is driven by asset turnover, operational leverage, or financial leverage — all of which the Finance Toolkit supports natively.

When looking at biggest banks in Europe, which one seems to be the most solvent?

Assessing solvency across Europe's nine largest listed banking groups — HSBC, BNP Paribas (BNPQY), Deutsche Bank (DB), Banco Santander (SAN), Barclays (BCS), UniCredit (UNCRY), Société Générale (SCGLY), ING, and Intesa Sanpaolo (ISNPY) — requires examining leverage in multiple dimensions simultaneously. Because banks operate with inherently high financial leverage by design, the equity multiplier and debt-to-assets ratio are the most discriminating solvency signals, with the debt service coverage ratio providing a cash-flow-based cross-check. Taken together, the data point to UniCredit and Intesa Sanpaolo as the standout names for solvency quality within this cohort.

The debt-to-equity ratio captures the proportion of debt relative to shareholders' equity. A lower reading indicates a more conservative capital structure relative to the equity cushion available to absorb losses. The six-year progression below reveals a clear dispersion across the group, with BNP Paribas and Santander consistently carrying the heaviest debt loads relative to equity, while HSBC and Intesa Sanpaolo trend toward the lower end.

Ticker 2020 2021 2022 2023 2024 2025
ISNPY 1.62 1.58 1.61 2.22 2.24 2.13
HSBC 1.85 1.91 1.10 2.22 1.26 2.68
UNCRY 2.24 2.01 1.82 1.91 1.95 2.57
BCS 2.15 2.38 2.65 2.46 2.56 2.81
DB 3.28 2.30 2.70 1.93 1.91 3.18
SCGLY 2.31 2.13 2.11 2.38 2.30 4.12
ING 1.42 2.12 2.37 2.87 3.34 3.32
SAN 3.53 3.45 4.36 2.98 4.50 4.40
BNPQY 6.40 6.34 2.56 5.23 5.43 6.22

The equity multiplier — total assets divided by equity — provides a balance-sheet-wide view of financial leverage and is a core input into DuPont decomposition. A lower multiplier implies a thicker equity buffer relative to the entire asset base. The 2025 cross-section is particularly telling: UniCredit stands at just 12.6x, the lowest among all nine peers, followed closely by Intesa Sanpaolo at 14.5x and Santander at 16.8x. By contrast, BNP Paribas (20.7x), Société Générale (21.0x), Barclays (20.3x), and ING (20.3x) are meaningfully more leveraged. Importantly, UniCredit's multiplier has compressed steadily from 15.1x in 2021 to 12.6x in 2025, signalling a deliberate and sustained de-leveraging trajectory.

Ticker 2021 2022 2023 2024 2025
UNCRY 15.10 14.09 12.85 12.34 12.64
ISNPY 15.86 16.33 15.46 14.66 14.50
SAN 16.48 17.09 17.49 17.18 16.82
HSBC 14.43 15.11 15.89 15.73 16.57
DB 20.38 18.97 17.99 17.50 17.69
ING 17.11 18.24 18.94 19.27 20.31
BCS 19.97 20.74 21.18 20.75 20.30
BNPQY 23.21 23.24 21.55 20.14 20.67
SCGLY 21.10 20.46 20.33 20.08 20.96

The debt-to-assets ratio corroborates this ranking. HSBC (0.153), Deutsche Bank (0.178), and Intesa Sanpaolo (0.145) hold the smallest debt loads as a share of the total balance sheet in 2025, while BNP Paribas (0.294) and Santander (0.266) are again the outliers on the high end. The debt service coverage ratio provides the critical cash-flow validation: UniCredit (0.228) and Intesa Sanpaolo (0.181) post the highest readings in 2025, meaning their operating earnings are most comfortably covering their debt obligations — a distinction that separates balance-sheet strength from earnings-backed solvency capacity.

Ticker D/A 2025 Equity Mult 2025 DSCR 2025
UNCRY 0.201 12.64 0.228
ISNPY 0.145 14.50 0.181
HSBC 0.153 16.57 0.120
DB 0.178 17.69 0.010
BCS 0.142 20.30 0.013
SCGLY 0.186 20.96 0.012
ING 0.161 20.31 0.011
SAN 0.266 16.82 0.014
BNPQY 0.294 20.67 0.013

Synthesizing across all three dimensions, UniCredit (UNCRY) emerges as the most solvent major European bank. Its equity multiplier of 12.6x is the lowest in the peer group by a meaningful margin, its trend has been consistently improving over six years, and its debt service coverage ratio of 0.228 is the highest in the cohort — confirming that the balance-sheet strength is underpinned by genuine earnings power rather than accounting structure alone. Intesa Sanpaolo (ISNPY) is the clear runner-up, posting the second-best equity multiplier and second-best DSCR. At the other end of the spectrum, BNP Paribas is the most leveraged name across nearly every metric, and Société Générale's equity multiplier spiked to 21.0x in 2025, flagging elevated structural leverage risk in that institution.

Logical extensions of this analysis within the Finance Toolkit ecosystem would include examining capital allocation quality via return on equity and return on invested capital for these same banks, running a rolling volatility and maximum drawdown comparison to understand how solvency strength translates into price resilience, or stress-testing via the Altman Z-Score model where data coverage permits.

Tell me something about the Semiconductor industry, is it overbought?

The following analysis covers eight representative semiconductor names spanning the full value chain — fabless designers (NVDA, AMD, QCOM), integrated device manufacturers (INTC, MU), a pure-play foundry (TSM), a diversified chip infrastructure leader (AVGO), and the European lithography monopoly (ASML) — using RSI momentum, trailing P/E multiples, and risk-adjusted Sharpe ratios sourced entirely from the Finance Toolkit MCP server.

Momentum: The Sector Was Overbought in May — and Has Since Corrected

The most telling technical story of 2026 is a sharp but short-lived overbought surge in May, now substantially unwound as of the June 4 close. The table below presents trailing 14-day RSI readings across the cohort for the last ten trading sessions. Readings above 70 flag overbought conditions; readings below 30 indicate oversold pressure.

Date NVDA AMD INTC QCOM AVGO TSM MU ASML SPY (Benchmark)
2026-05-19 58.45 66.12 60.91 62.48 52.18 49.43 67.19 55.28 67.57
2026-05-20 69.80 68.27 65.02 58.07 50.13 52.43 69.30 58.35 67.79
2026-05-21 66.66 67.75 62.29 62.11 47.27 54.00 69.58 61.87 67.52
2026-05-22 62.51 75.22 66.19 70.96 49.00 51.24 66.21 67.74 71.84
2026-05-26 63.94 77.28 61.71 69.59 47.68 57.60 70.64 64.79 71.48
2026-05-27 54.20 67.28 57.01 62.13 48.42 51.57 70.92 54.65 65.84
2026-05-28 52.51 74.45 59.39 62.11 56.65 55.36 72.68 58.08 71.16
2026-05-29 46.25 66.97 39.94 60.01 57.75 53.26 70.09 52.15 68.77
2026-06-03 41.65 74.14 42.23 61.96 73.63 64.73 74.99 65.57 61.53
2026-06-04 35.85 67.01 45.42 64.32 43.84 61.77 68.09 67.54 59.15

The data paints a diverging picture within the sector. NVDA is the clearest outlier: its RSI has collapsed from a local peak of ~70 in mid-May to 35.85 on June 4, approaching oversold territory and suggesting near-term selling pressure has been substantial. AVGO echoes a similar dynamic, dropping from an intraday peak above 73 to 43.84 in just two sessions, possibly reflecting rotation out of AI-infrastructure adjacent names. In contrast, AMD, QCOM, MU, and ASML remain in the 60–75 band — elevated but not technically overbought as of the last close. The broader SPY benchmark sits at 59.15, meaning several semiconductor names (AMD at 67, QCOM at 64, MU at 68, ASML at 68) are trading with more momentum than the broad market, but not yet at alarming levels. Notably, the sector as a whole touched genuinely overbought readings of 80–89 on INTC, QCOM, and MU in the first two weeks of May, coinciding with the US-China trade truce news and renewed AI capex guidance from hyperscalers. That wave has receded.

Valuation: Multiples Remain Structurally Elevated for AI-Exposed Names

The overbought question cannot be answered through momentum alone — RSI describes the speed of price change, not whether the underlying business justifies the price. The following table presents trailing annual P/E ratios for the cohort from 2021 through 2026 (2026 where available).

Ticker 2021 2022 2023 2024 2025 2026
NVDA 170.5 38.0 284.3 112.5 63.5 44.6
AMD 55.9 77.1 280.5 120.5 80.8
AVGO 44.3 21.1 33.8 187.9 72.6
ASML 49.0 36.3 34.4 34.6 36.9
MU 18.1 6.5 120.9 37.6
QCOM 23.2 9.7 22.5 17.1 34.1
TSM 29.1 11.9 19.4 29.0 28.4
INTC 10.6 13.6 125.3

NVDA's P/E compression from its stratospheric 284x in 2023 to 44.6x on a current-year basis is meaningful progress, but at 44x it still prices in enormous earnings growth expectations that leave little room for execution disappointment. AMD at 80.8x and AVGO at 72.6x for 2025 are similarly demanding. In contrast, TSM trades at a comparatively modest 28x, QCOM at 34x, and ASML at 37x — multiples that, while not cheap, are more defensible given their structural moat positions in leading-edge foundry, mobile/auto connectivity, and EUV lithography respectively. INTC remains the sector's distressed outlier, posting deeply negative earnings in 2024 and 2025 as its restructuring and process-technology catch-up remains unresolved.

Risk-Adjusted Returns: The Sector Has Not Rewarded Shareholders Proportionally

Sharpe ratios on an annual basis tell a sobering story. The table below shows risk-adjusted excess return (versus the risk-free rate) for each name since 2021.

Year NVDA AMD INTC QCOM AVGO TSM MU ASML
2021 -0.38 -0.46 -0.70 -0.62 -0.70 -0.66 -0.53 -0.51
2022 -0.79 -0.82 -1.27 -1.03 -1.23 -1.19 -1.04 -0.93
2023 -1.10 -1.20 -1.49 -1.90 -1.77 -1.91 -1.59 -1.90
2024 -1.13 -1.39 -1.40 -1.71 -1.14 -1.53 -1.27 -1.48
2025 -1.32 -1.05 -0.98 -1.75 -1.22 -1.57 -0.94 -1.61
2026 -1.73 -0.74 -0.57 -1.03 -1.41 -1.53 -0.59 -1.24

These uniformly negative Sharpe ratios indicate that, in every period, volatility has outpaced risk-compensated returns across the cohort. NVDA stands out negatively in 2026 with a Sharpe of -1.73, confirming that its recent price drawdown has been accompanied by elevated volatility — consistent with the RSI collapse observed above. AMD and MU register the least-negative 2026 ratios (-0.74 and -0.59 respectively), suggesting comparatively less turbulent price action relative to their returns. QCOM and INTC are also showing improvement in 2026 versus 2025, which aligns with their RSI readings reflecting a less extended momentum condition.

Synthesis: Mixed Signals — Sector Was Overbought, Now Normalizing

The semiconductor sector is not uniformly overbought as of June 4, 2026. The data reveals a sector mid-cycle in a technical correction from a genuine May overbought peak. NVDA and AVGO have unwound their momentum surges most aggressively and now flash caution signals in the opposite direction, with NVDA approaching oversold territory. AMD, MU, QCOM, and ASML remain mildly elevated on momentum but well below the threshold that would warrant an overbought classification. Valuations remain the persistent structural concern: NVDA, AMD, and AVGO carry multiples that require continued AI-driven earnings acceleration to justify, while ASML, QCOM, and TSM offer more moderate entry points from a fundamental standpoint. For investors monitoring the sector, the logical next steps within the Finance Toolkit ecosystem would include drilling into individual-name volatility profiles using GARCH forecasts, running rolling Sharpe analyses to capture momentum-regime shifts, or examining sector-level factor exposures through Fama-French decomposition to isolate whether excess returns are attributable to market beta, size, or value factors.

See an example of the Finance Toolkit MCP server in action in Claude Desktop below:

Demonstration-of-the-Finance-Toolkit-MCP.mp4

Also see the MCP Documentation for full setup instructions and usage examples.


Unified HTTP Request Layer

A single get_request() helper now handles all outbound HTTP calls across the toolkit (FRED, OECD, GMDB, FMP, yFinance fallbacks). This replaces several ad-hoc requests.get() calls scattered across modules and makes timeout handling, error reporting, and future retry logic consistent everywhere.

Fixed Income Improvements

  • All FRED data functions now accept an optional FRED_API_KEY (also readable from the FRED_API_KEY environment variable), unlocking ICE BofA bond index series (option-adjusted spread, effective yield, total return, yield to worst) that previously required a key but had no path to supply one.
  • Fixed a bug where selecting a start and end date on a different time period could result in no data being returned.
  • Fixed floating-point index noise in get_duration and get_derivative_price, np.arange results are now rounded to 10 decimal places, eliminating platform-dependent representations like 0.030000000000000002.
  • Improved robustness when a DataFrame index is not entirely a PeriodIndex.

Test Coverage

  • Added a --live pytest flag. Tests run against pickle fixtures by default; pass --live to hit real APIs (requires valid API keys set as env vars).
  • New test files for the Economics, Fixed Income, and MCP server modules, and significantly expanded coverage for Technicals, Options, Ratios, Models, Risk, and Performance.
  • Fama-French and factor-correlation tests (which download data from Dartmouth) are now skipped in standard CI and only run under --live.
  • Economics tests (which require live OECD/GMDB data) follow the same pattern.

CI / Tooling

  • Migrated from Poetry to uv across all GitHub Actions workflows and pre-commit hooks.
  • Extended the Python version matrix to 3.10 – 3.14.
  • Replaced pylint (not in dev dependencies) with codespell in the linting workflow; added an explicit --config pyproject.toml to the black pre-commit hook.
  • Upgraded action versions: actions/checkout@v4, actions/setup-python@v5, astral-sh/setup-uv@v5.

Documentation & Examples

  • Removed the HTML/CSS button navigation blocks from all 12 example notebooks; replaced with a direct link to jeroenbouma.com/projects/financetoolkit.
  • Fixed a broken /portfolio link and several triple-concatenated URLs that had accumulated in the Discovery and Models notebooks.
  • Updated the README with MCP setup instructions and revised module descriptions.
  • Docstring improvements across the controllers.

Full Changelog: v2.0.7...v2.1.0