Repository navigation
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_portfoliossorts 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_skewadds the 10-delta risk reversal and butterfly (deltaspicks the wings),get_implied_correlationgives an index's implied correlation from its members' volatilities, andget_commodity_term_structureadds the roll return into the next contract. (#696)get_short_interestgives 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)transformon 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,cumsumand 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_contributionsshows each asset's volatility and correlation with the portfolio, androlling=gives the risk contributions through time. (#698)get_return_distributioncounts the returns per bin of a chosen width, as a share withrelative=True. (#700)get_generalized_pareto_fitandget_mean_excess_functiongive 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_connectednessandget_rolling_connectednessgive the Diebold-Yilmaz spillover table and total and net connectedness from a VAR's generalized variance decomposition. (#693)get_realized_varianceandget_jump_testmeasure realized variance, volatility, semivariance and bipower variation from intraday bars, and test each day for a jump (Huang and Tauchen). (#694)get_calendar_effectstests 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_contributionadds each holding's Share of Total of the fund return and a Top N row, andmerge_share_classes=Trueonget_holdingsandget_concentrationcounts the share classes of one issuer (such as GOOGL and GOOG) as one holding. (#714)get_holdingsmarks cash, futures, collateral and other lines that are not securities in aSecuritycolumn, lists every fund largest first, and adds aCumulative Weightfrom the largest holding down;get_concentrationmeasures the securities only and gives theirCash and Derivatives Weight(SPY: 503 holdings, 500 issuers). (#714)
Fixes
get_gmm_moment_testwith 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_episodeslogs a ticker without a bubble episode, and its answer is an empty table rather than missing data. (#688)show_columnswith 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_allocationrefuses 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_holdingswith 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=Falseonget_historical_datagives the price return on Close. (#713)
Changed
get_delta_hedging_backtest: the date the option is sold issale_date(it wasstart_date, which over MCP is the Toolkit's range). (#689)get_event_filtertakessignals_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_pricestakesmaturity_startandmaturity_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, andget_correlationwithseries=names its column Correlation. (#713) get_holdings,get_overlap,get_concentration,get_active_shareand the look-through note an ignoredstart_dateorend_date. (#712)- The
optionsdescription 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_checkandweek_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)