Skip to content

FinanceToolkit v2.4.1

Latest

Choose a tag to compare

@github-actions github-actions released this 29 Nov 22:19
4cde958

This release fixes what came up while writing the documentation examples for v2.4.0, and adds new areas: cross-sectional factor research, extreme value theory, connectedness, realized volatility from intraday data, option-implied market structure, futures roll yield, short interest and calendar effects.

Package

New

  • get_factor_portfolios sorts the Toolkit's tickers into quantile portfolios on any ratio (lagged, no look-ahead, equal or value weighted) and gives each portfolio's returns, the top-minus-bottom spread, Newey-West factor statistics, the Patton-Timmermann monotonicity test and turnover. The model functions also build Fama-French 2x3 double sorts. (#695)
  • get_volatility_skew adds the 10-delta risk reversal and butterfly (deltas picks the wings), get_implied_correlation gives an index's implied correlation from its members' volatilities, and get_commodity_term_structure adds the roll return into the next contract. (#696)
  • get_short_interest gives FINRA's short interest twice a month with the average daily volume, days to cover and short interest as a share of the float. (#696)
  • transform on every method that returns a time series (and the matching MCP tools) applies time series steps in order: moving averages (sma, ema, median), rolling statistics (sum, std, min, max, zscore, percentile), changes (diff, pct_change, log_diff, yoy, annualize), log, cumsum and the Hodrick-Prescott trend and cycle, on the full history so the first periods shown have complete windows. It runs after trailing and rolling and before growth, and a gap that empties a window is named for the countries asked for. (#692, #697, #699)
  • get_risk_contributions shows each asset's volatility and correlation with the portfolio, and rolling= gives the risk contributions through time. (#698)
  • get_return_distribution counts the returns per bin of a chosen width, as a share with relative=True. (#700)
  • get_generalized_pareto_fit and get_mean_excess_function give the peaks-over-threshold fit behind the EVT Value at Risk, now fitted with a profile likelihood that is exact at a shape of 0. (#693)
  • get_connectedness and get_rolling_connectedness give the Diebold-Yilmaz spillover table and total and net connectedness from a VAR's generalized variance decomposition. (#693)
  • get_realized_variance and get_jump_test measure realized variance, volatility, semivariance and bipower variation from intraday bars, and test each day for a jump (Huang and Tauchen). (#694)
  • get_calendar_effects tests the day-of-week, turn-of-the-month and pre-holiday effects with Newey-West standard errors, with holidays read from each ticker's own trading days. (#694)
  • get_contribution adds each holding's Share of Total of the fund return and a Top N row, and merge_share_classes=True on get_holdings and get_concentration counts the share classes of one issuer (such as GOOGL and GOOG) as one holding. (#714)
  • get_holdings marks cash, futures, collateral and other lines that are not securities in a Security column, lists every fund largest first, and adds a Cumulative Weight from the largest holding down; get_concentration measures the securities only and gives their Cash and Derivatives Weight (SPY: 503 holdings, 500 issuers). (#714)

Fixes

  • get_gmm_moment_test with a Student-t could return a negative joint statistic: the covariance of the moment conditions is now taken wholly from the distribution or wholly from the sample, so it stays positive semi-definite (^GSPC from 2016 to 2025 gives 223.19 instead of -25.93). (#688)
  • get_bubble_episodes logs a ticker without a bubble episode, and its answer is an empty table rather than missing data. (#688)
  • show_columns with a ticker and a field gives that ticker's field: names on different column levels narrow each other, names on one level still add up. (#690)
  • Every docstring has one example, and the example tables of the diagnostics, forecasting, volatility, value-at-risk and risk controllers and of the lookback and touch options are regenerated. (#687, #688)
  • Portfolio construction takes the returns between the days every asset traded, so a return on a day one market was closed carries into the next day (AAPL's expected return next to four European listings: 0.2633 instead of 0.3165), and names the dates of the sample when a late listing shortens it. (#710)
  • Weights that sum to less than one hold the rest as cash at the risk free rate (more than one borrows it) in the risk metrics, the stress test, the discrete allocation, the return contributions, the factor attribution and the look-through, instead of being scaled to one. (#710)
  • Portfolio construction notes assets priced in different currencies, and get_discrete_allocation refuses them. (#710)
  • Yahoo Finance's statistics work with yfinance 1.6 and later, whose dates are datetimes. (#709)
  • The Portfolio converts a cryptocurrency or currency pair from the currency in its symbol, reports a pence-only account in pounds, gives an unknown money-weighted return and return contributions when a holding has no price, and takes each holding's Volatility and Beta over its own last 252 trading days. (#709)
  • Options warn when there is less than a year of history before the pricing date, the volatility skew and gamma exposure use the implied volatilities solved from the mid prices, the time to expiration counts from the last close while the market is closed, and a ticker that trades every day annualizes with 365 days. (#711)
  • The fund look-through counts a fund without weightings of the kind asked as Unclassified, keeps holdings without a symbol under their ISIN or name, and get_holdings with a limit works for bond funds. The holdings docstrings say what "Updated At" is. (#712)
  • Alpha, CAPM, the Treynor ratio and the other measures on period returns compound the daily returns within each period, so the first period has a value. (#713)
  • include_dividends=False on get_historical_data gives the price return on Close. (#713)

Changed

  • get_delta_hedging_backtest: the date the option is sold is sale_date (it was start_date, which over MCP is the Toolkit's range). (#689)
  • get_event_filter takes signals_only. (#689)

MCP server

  • A server default that changes a calculation is named in the answer's notes, with the Python default (the fractional difference threshold, applied to the fixed window only; the weekly bubble tests; the Amihud scale). (#689)
  • Entropy pooling views take inequality views such as [">=", 0.02]. (#689)
  • get_treasury_forward_prices takes maturity_start and maturity_end. (#689)
  • A benchmark that is one of the tickers is replaced by the first of ^GSPC, SPY, QQQ, IWM, DIA and VTI that is not, so SPY always gets ^GSPC. (#689)
  • A refused call (an unknown indicator, an invalid argument such as alpha="high") is an error answer. (#713)
  • The notes name tickers without data in every answer that uses them, the listing and currency an ISIN was read as, the price currencies of quotes and prices outside USD, funds without financial statements, and the warnings on too few returns, unconverted currencies and weights that do not sum to one; they no longer call a looked-through fund or a converted ISIN missing. (#713)
  • Risk indicators with a weekly to yearly period give a value per period by default (within_period=true), the correlation and covariance matrices default to monthly returns, and a rolling volatility notes that it is not annualized. (#713)
  • Two series= references of one indicator and ticker are named by their arguments, and get_correlation with series= names its column Correlation. (#713)
  • get_holdings, get_overlap, get_concentration, get_active_share and the look-through note an ignored start_date or end_date. (#712)
  • The options description gives each method's strike range. (#711)
  • Five prompts give ready-made analyses that clients show as one-click starts: company_analysis, financial_strength, portfolio_check, economy_check and week_ahead. Each lists the calls in order, follows the frameworks of analysts, rating agencies and the OECD, and runs without arguments, with examples as defaults. (#715)