github JerBouma/FinanceToolkit v2.3.5
FinanceToolkit v2.3.5

49 minutes ago

This release reorganizes the larger packages into topic folders, each with one controller and the models only that topic uses. Calls through the Toolkit stay the same: toolkit.models.get_altman_z_score(), toolkit.risk.get_value_at_risk() and every other method work as before, with the same results. Code that imports model modules directly needs the new paths listed below; the old module paths are removed. It also brings a formula audit of every package against its primary sources and reference libraries (QuantLib, TA-Lib, statsmodels, arch, scipy), a robustness sweep of the MCP server, and more than 40 new measures: technical indicators, downside performance, financial constraint and earnings quality models, systemic risk, spread estimators, option-implied moments, bond analytics and international macroeconomic statistics.

Package

Topic folders

  • Models: valuation, quality, distress and profitability, e.g. from financetoolkit.models.distress import altman_model. The module paths financetoolkit.models.<name>_model are removed. (#444)
  • Options: pricing, greeks, volatility and market, e.g. from financetoolkit.options.pricing import black_scholes_model. The module paths financetoolkit.options.<name>_model of the moved models are removed. (#445)
  • Risk: value_at_risk, drawdown, volatility, dependence, distribution and liquidity, e.g. from financetoolkit.risk.value_at_risk import var_model, cvar_model. The module paths financetoolkit.risk.<name>_model of the moved models are removed. (#446)
  • Portfolio construction: financetoolkit.portfolio.construction with optimization, analysis and attribution. The module paths financetoolkit.portfolio.construction_controller, optimization_model, backtest_model and attribution_model are removed. (#447)
  • Economics: output, government, history, prices, rates, jobs, activity, stability, environment and commodities, with the data sources in financetoolkit.economics.sources, e.g. from financetoolkit.economics.sources import oecd_model. The module paths financetoolkit.economics.<source>_model are removed. (#448)
  • Econometrics: diagnostics, stationarity, regression, testing, causal, forecasting, dynamics and significance, e.g. from financetoolkit.econometrics.regression import regression_model. The module paths financetoolkit.econometrics.<name>_model of the moved models are removed. (#449)
  • Fixed income: bonds, markets, short_rates, curves, credit, policy and loans, with the data sources in financetoolkit.fixedincome.sources. The module paths financetoolkit.fixedincome.<name>_model are removed. (#450)
  • Each package controller file holds the package's base class (__init__, the data and the methods the topics share) next to the package class, e.g. ModelsBase and Models in financetoolkit.models.models_controller. Helpers the topics share are in the package's helpers.py. (#470)

New measures

  • Technicals: the Stochastic RSI (Chande and Kroll), True Strength Index (Blau), Coppock Curve and Bollinger %B and BandWidth (#495); the Mass Index (Dorsey), Price Volume Trend, Chandelier Exit (Le Beau) and Percentage Volume Oscillator (#499).

  • Performance: Roy's safety-first ratio, the upside potential ratio (Sortino, van der Meer and Plantinga), and the Pain Index and Pain Ratio, with rolling=. (#496)

  • Ratios: the Nissim-Penman components get_return_on_net_operating_assets, get_net_borrowing_cost and get_financial_leverage (#500), the PEGY ratio and net gearing (#501), and a company's cyclically adjusted P/E, get_cyclically_adjusted_price_to_earnings_ratio, on the P/E's own EPS deflated by the consumer price index (#509).

  • Models: the Kaplan-Zingales, Whited-Wu and size-age financial constraint indices in a new financial constraints topic (#497); get_nissim_penman_decomposition, ROCE = RNOA + FLEV × (RNOA − NBC) (#500); get_graham_intrinsic_value, EPS × (8.5 + 2g) × 4.4 / Y with Moody's Aaa yield (#501); Easton's implied cost of equity capital from analyst estimates, get_implied_cost_of_capital (#511); and discretionary accruals from the modified Jones model, get_discretionary_accruals, per company over its own history or across the Toolkit's tickers (#514).

  • Value at Risk: var_model.get_liquidity_cost and get_liquidity_adjusted_value_at_risk, the liquidity-adjusted VaR of Bangia, Diebold, Schuermann and Stroughair from a series of relative bid-ask spreads (quoted spreads, or the spread estimators where they fit). (#521)

  • Risk: the Marginal Expected Shortfall and SRISK (Acharya et al.; Brownlees and Engle) (#507); get_corwin_schultz_spread, get_share_turnover and get_idiosyncratic_volatility (#486); the Abdi-Ranaldo and EDGE bid-ask spread estimators (#510).

  • Options: get_risk_neutral_moments (Bakshi, Kapadia and Madan) and a SKEW index per ticker and expiry, from the same out-of-the-money strip as the model-free implied volatility. (#498)

  • Fixed income: get_carry_and_roll_down of government bonds on the zero-coupon curve of each country (#504); bond_model.get_yield_to_call and get_yield_to_worst next to get_yield_to_maturity (#505).

  • Portfolio: get_brinson_attribution(period=, linking=) attributes per sub-period and links the effects with Cariño or Menchero, so they add up to the compounded excess return. (#512)

  • toolkit.economics.get_commodity_prices(currency=) gives the World Bank commodity prices in any currency, converted at the BIS monthly average exchange rate of the same month. (#489)

  • toolkit.economics.get_outstanding_mortgage_rates gives the distribution of interest rates on outstanding US mortgages from the FHFA National Mortgage Database: the share in each rate bucket (or below 3%, 4%, 5% and 6% with cumulative=True) and the average rate, quarterly, by market, region and weighting. (#493)

  • toolkit.economics.get_retail_sales(inflation_adjusted=True) deflates retail sales by the same country's consumer price index. (#490)

  • Jobs: get_continuing_jobless_claims and get_insured_unemployment_rate from the Department of Labor's weekly claims report (or FRED), and period with aggregation (mean, max, min, last) on the weekly claims for complete months, quarters and years. econometrics.get_level_significance(level=) also counts the observations above and at or below the level and gives the last date on each side. (#517)

  • economics.get_shiller_stock_market_data adds the trailing P/E next to the CAPE. (#519)

  • Economics: the job vacancy rate (Eurostat, BLS JOLTS), capacity utilization (Federal Reserve G.17, Eurostat), unit labour costs, foreign exchange reserves and their import cover (#508); the net international investment position from the IMF, in US dollars and as a share of GDP in national currency (#513).

Formula audit

  • Technicals: every indicator with a TA-Lib counterpart cites TA-Lib as its reference implementation, checked against TA-Lib 0.8.3. About 40 are equal to it; the docstrings state where ours deliberately differ (decimals instead of percent, NaN instead of 0, StockCharts seeding of the ATR and ADX, Chande's CMO, a rolling VWAP). (#522)
  • Performance: the risk-free rate of a partial period (the current year, a period cut by start_date) is compounded over its own dates instead of a full period's rate; tickers that trade on weekends earn the rate per calendar day and annualise on 365 observations; the rolling appraisal ratio uses its window's residuals (performance_model.get_rolling_appraisal_ratio), the Ulcer performance index measures drawdowns from the running high, and the deflated Sharpe ratio counts non-overlapping trials. (#472)
  • Ordering, rebasing and weekend transactions: rolling ratios keep their periods when a later-listed ticker comes first (and the daily style analysis with outside style tickers), China's house prices are rebased on all of 2015 also for a range that ends earlier, and a portfolio transaction is dated on the first day its own ticker traded, also next to a cryptocurrency. (#492)
  • Performance and risk next to a cryptocurrency: every ticker subtracts the risk-free rate of its own dates, and the daily rolling Fama decomposition and Omega ratio roll over each ticker's own trading days, so a stock's results are the same with or without a 24/7 ticker next to it (its rolling Sharpe ratio moved by up to 0.1). (#487)
  • Risk: CDaR and the Ulcer Index of a ticker that listed later leave out the rows before its first return; volatility of weekend-trading tickers annualises on 365 days; EVT, the drawdown table and three other measures fixed. (#474)
  • Technicals: every per-ticker indicator runs on the ticker's own trading days, so results no longer depend on which other tickers are loaded (AAPL's ATR next to a cryptocurrency: 2.91 → 4.24, equal to AAPL alone); the Parabolic SAR follows Wilder. In seasonality_model, get_relative_strength_rating is split into get_relative_strength_score(prices, observations_per_year) and get_relative_strength_rating(scores). (#475)
  • Ratios: period price ratios are priced at each ticker's own fiscal period end (Oracle's fiscal year to May 2024 was priced in December 2023); collector growth on unrounded ratios; trailing and quarterly debt ratios fixed. trailing is removed from get_price_to_book_ratio, get_price_to_tangible_book_ratio and get_ev_to_invested_capital_ratio, which are point in time. (#476)
  • Fixed income: coupon dates of bonds maturing at a month end, 30/360 for corporate bonds (get_years_to_maturity(day_count=)), bill durations and the bootstrapped zero curve, all checked against QuantLib. (#477)
  • Options: time to expiry runs to 16:00 New York time in minutes (Cboe convention); implied volatility from mid quotes, and NaN for a strike without a quote or trading activity instead of a stale last price; closed expiries left out; strike_step_size takes a float. (#478)
  • Econometrics: the move-significance window follows the data's frequency, mid-rank percentiles, Diebold-Mariano for horizons above 1 (Harvey, Leybourne and Newbold), the Chow test and difference-in-differences periods placed by their end. (#479)
  • Portfolio: transactions on a weekend or holiday are dated on the trading day they take effect, the money-weighted return values open positions at unrounded prices, and short positions stay open. (#480)
  • Data: FMP's adjusted close is kept when the dividends are incomplete; each period is translated from the currency it was reported in (IAS 21); Yahoo Finance's net debt issuance comes from its net row. (#481)
  • Economics: the euro area policy rate is extended with the ECB's latest days (and keeps the BIS series when the ECB is down), OECD datasets name the current euro area "Euro Area", country spellings and comma lists work in every source, quarterly-only CPI countries stay at quarter ends, and a BLS daily limit is reported instead of failing. (#482)
  • Discovery and ETFs: dollar volume in US dollars (London ETFs in pence were 100× too large), holdings converted into the fund currency for contributions, ETF tracking compares with the benchmark in the fund's currency, and the screener's currency table covers about 90 countries. (#483)
  • A change whose base period has no value (such as US inflation for October 2026, as the BLS skipped October 2025) is named in a warning and in the MCP _notes. (#490)
  • Cache and utilities: forward returns in factor analysis count each ticker's own trading days, growth and CAGR across a missing period are NaN, a failed Treasury window keeps its cached rows, and data reused from memory names its source. (#485)
  • Models: duplicated code removed (about 580 lines), the Piotroski accruals comparison aligned, and the cost of debt is unknown (NaN, and so the WACC) when a company has debt but reports no interest expense, instead of 0%. get_tobins_q_ratio no longer takes trailing, as it is point in time. (#473)

Fixes

  • Portfolio construction (#518): a loaded ticker without a weight no longer shortens the sample of the weighted methods (get_portfolio_risk_metrics, get_risk_contributions, get_diversification_metrics, get_brinson_attribution), which use only the held tickers; the Brinson attribution keeps the own return of a sector held short (MSFT 1.3 / TSLA -0.3 over 2023: Total 0.6371 → 0.369); a Portfolio with a single ticker collects its data; the stress test's Coverage is the share of the gross exposure with prices, between 0 and 1; and the variance objectives of the optimizers are scaled before solving, so near-cash funds get the exact minimum-variance weights. (#523)
  • Trailing windows count calendar periods (#518): the trailing sums and means of the ratios, the models and the statements with trailing, the opening and closing balance averages, and the year-ago comparisons no longer span more time when a period is not reported, such as for a half-yearly reporter on quarterly data. Such a window is NaN, and a company gets the same values on its own as next to others. The quarterly intrinsic valuation no longer sums two years of RIO's cash flow. (#524, #526)
  • Whole-sample daily measures with supplied historical data use only the rows between the start and end date (maximum drawdown with supplied data now equals downloaded data), and the options volatility rolls over each ticker's own trading days next to a cryptocurrency. (#524)
  • A Portfolio's weekly data in another currency is aggregated from the converted daily data, so each day is converted at its own rate. (#525)
  • Portfolio (#527): a holding without a price is an unknown amount, so the Portfolio row's value, return and the weights are empty instead of counting it as worthless (the overviews and the positions' weights alike); the Brinson attribution keeps a sector whose fund has no price at the start of the period with its own weight and an empty benchmark return, with a warning, instead of sharing its weight out or measuring the fund from its first price; and the whole-share allocation lets a short position fund a long share and solves the long-short cases that failed with a HiGHS error. (#529)
  • get_historical_statistics works on Windows for a stock first traded before 1970 (KO, IBM, XOM); the peer comparison uses the Toolkit's end date, quarterly, point_in_time and convert_currency, so its Company column equals the Toolkit's own figures; and intraday data includes the start and end days and follows a changed return_column. (#528)
  • The Sharpe, Sortino, upside potential and Kappa ratios of performance_model give one value per period for a Series with a within-period index, as they do for a DataFrame. (#515)
  • The dividend yield sums the dividends of each ticker's own fiscal period and prices them at its fiscal period end, like the P/E. (#502)
  • With trailing, the DuPont analyses, EVA and cash ROIC average their balances over trailing + 1 period ends, like the ratios they decompose, so the DuPont ROE equals get_return_on_equity (AAPL 2022 with trailing=2: 3.4191 → 3.2577). (#503)
  • Docstring formulas that wrap onto a second line keep their operators and brackets when rendered (64 formulas, among them the put Theta of Black-Scholes). (#494)
  • The IMF parser no longer gives an empty series the observations of the next one, which left Cyprus's and Croatia's government interest-to-GDP ratios empty. The IMF datasets are cached under new keys, so rows parsed the old way are not reused. (#513)
  • The economic calendar's series give a survey published ahead of its month (Germany's consumer climate for November, released in October) the right year. (#469)
  • The tangible measures (tangible asset value, price to tangible book, return on tangible assets, Fulmer H-Score) work again for a supplied balance sheet that has only the combined Goodwill and Intangible Assets row, or only the separate rows. (#469)
  • A basket's Total is empty when a requested ticker has no financial statements, as it is for a missing value, rather than the sum of the other tickers. (#469)
  • get_level_significance leaves out the days a ticker did not trade, such as an exchange holiday next to a benchmark that traded. (#469)

Data sources

  • China's house prices come from the BIS (the National Bureau of Statistics' prices of newly built homes in 70 cities), rebased to 2015 = 100, as the OECD's index for China kept rising while those prices fell. (#471)

  • When IMF PortWatch limits the number of requests, the cached chokepoint transits are served (or the source is reported as unreachable) instead of an error that read as a changed format. (#465)

  • Kenneth French's factor files are downloaded with the Finance Toolkit's own User-Agent, since Dartmouth answers requests that present themselves as a browser with a 404. (#467)

MCP server

  • An econometrics series= with period='daily' reads the ratios of statement items (P/E, P/B) on every trading day instead of their yearly values. (#519)
  • The new measures are in their MCP tools (momentum, volatility, breadth, performance, profitability, valuation, models, risk, options, rates, portfolio, jobs, macroeconomics); the yield to call and to worst are calculators in the package only. (#495–#501, #504, #507–#514, #517)
  • The server code is ordered into registry, inspection, auth, analytics and setup, each with at most one controller. The module paths financetoolkit.mcp_server.<name>_model, registry_controller and inspection_controller are removed. (#451)
  • The Docker image builds with uv 0.13.9. (#520)
  • financetoolkit.mcpb ships a uv.lock created at release time, which fixes every dependency at the versions current then, so a later major release of a dependency can't break an installed bundle. (#466)
  • Inputs: period in any casing ("annual" reads as "yearly"), every documented input form (short_maturity="3M", per-ticker dictionaries, lag="1,2", option strategy legs), and unknown parameters named with a "did you mean" suggestion instead of ignored. (#484)
  • SPY as a requested ticker stays a ticker in every tool, with QQQ as the benchmark; an empty benchmark_ticker means the default benchmark ("None" means none). (#484)
  • rank=true on amounts across currencies notes each ticker's currency; limit keeps ticker rows next to a Portfolio row; weekly data converts to the month of each week's last weekday; cryptocurrencies in statement tools get their own note; long answers (loan payments, support and resistance levels, move significance) have default limits. (#484)

Don't miss a new FinanceToolkit release

NewReleases is sending notifications on new releases.