RiskModels

v2.0.1
io.github.BlueWaterCorp/riskmodels Checked 4 hours ago Published 1 month ago

Dividend-adjusted US equity total returns, risk decomposition, attribution & ETF hedge ratios

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

riskmodels_get_stock_snapshot RiskModels Stock Risk Snapshot

Use when you need one US stock's latest risk numbers: hedge ratios to SPY and to its sector and subsector ETFs, explained-risk shares by layer, volatility, closing price and market cap. Not for a layer-by-layer decomposition or the ETF hedge of a dollar position (use riskmodels_decompose), several stocks at once (use riskmodels_compare) or daily history (use riskmodels_get_returns). Returns the latest row of GET /metrics/{ticker}, including the hedge_levels block with hedge ratios, explained risk and hedge ETFs at L1, L2 and L3. End-of-day data, refreshed after each US market close. Price: $0.…

ParameterTypeDescription
ticker *stringUS stock ticker symbol, case-insensitive, e.g. NVDA

riskmodels_decompose RiskModels Single-Stock Decomposition

Use when you want one stock's risk split into market, sector, subsector and residual layers, or the ETF hedge legs for a dollar position in it. Not for several stocks (use riskmodels_compare) or a portfolio (use riskmodels_analyze_portfolio). Returns, from POST /decompose, each layer's explained-risk share, hedge ratio and hedge ETF, chart-ready data and a one-line summary; with dollars it returns the ETF hedge notionals for that position at each level (hedge ratio times dollars). End-of-day data, refreshed after each US market close. Price: $0.005 per call.

ParameterTypeDescription
ticker *stringUS stock ticker symbol, case-insensitive, e.g. NVDA
dollarsnumberPosition size in US dollars, a positive number, e.g. 10000. Omit for the decomposition alone

riskmodels_compare RiskModels Multi-Ticker Comparison

Use when you want 2-100 stocks side by side on market, sector, subsector and residual risk. Not for one stock (use riskmodels_decompose) or a weighted portfolio (use riskmodels_analyze_portfolio). Returns, from POST /batch/analyze, each ticker's explained-risk shares and hedge ratios by layer, with chart-ready data. End-of-day data, refreshed after each US market close. Price: $0.015 per ticker, minimum $0.03 per call.

ParameterTypeDescription
tickers *array2-100 US stock ticker symbols, e.g. ["AAPL","NVDA"]

riskmodels_get_returns RiskModels Stock Total Returns

Use when you need the daily dividend-adjusted total returns of one US stock or ETF over 1-15 years. Not for returns split into factor and residual parts (use riskmodels_get_return_attribution) or residual returns at the recommended hedge depth (use riskmodels_get_residual_returns). Returns, from GET /ticker-returns, the daily return series (decimal, 0.01 = 1%) with each day's L3 market, sector and subsector hedge ratios and explained-risk shares; history is point-in-time. End-of-day data, refreshed after each US market close. Price: $0.02 per call plus $0.01 per year of history beyond the firs…

ParameterTypeDescription
ticker *stringUS stock ticker symbol, case-insensitive, e.g. AAPL
yearsintegerYears of daily history, integer 1-15, e.g. 3 (default 1)

riskmodels_get_return_attribution RiskModels Return Attribution (factor vs residual)

Use when you need each day's return of one stock split into market, sector and subsector factor returns and the residual (stock-specific) return. Not for raw total returns (use riskmodels_get_returns) or residual returns for many stocks (use riskmodels_get_residual_returns). Returns, from GET /returns-decomposition, the daily gross return and its additive components (decimal returns); include_lstar adds the residual series at each day's recommended hedge depth. End-of-day data, refreshed after each US market close. Price: $0.04 per call plus $0.01 per year of history beyond the first.

ParameterTypeDescription
ticker *stringUS stock ticker symbol, case-insensitive, e.g. AAPL
include_lstarbooleantrue adds the lstar level and lstar_residual_return arrays, e.g. true (default false)
market_factor_etfstringETF ticker used as the market factor, e.g. QQQ (default SPY)
thresholdnumberMarginal explained-risk threshold for the hedge-depth rule, a fraction, e.g. 0.01 (default 0.01)
yearsintegerCalendar years of daily history, integer, e.g. 2 (default 1)

riskmodels_get_residual_returns RiskModels Residual Returns and Recommended Hedge Depth

Use when you need daily residual (stock-specific) returns and the recommended hedge depth (L1 market, L2 sector or L3 subsector) for 1-100 stocks. Not for the full factor split of each day's return (use riskmodels_get_return_attribution) or a mean-reversion signal on a basket (use riskmodels_get_residual_signal). Returns, per ticker, the recommended depth by date, the hedge ratios at that depth and the daily residual return series. One ticker is served by GET /lstar; 2-100 tickers by POST /batch/lstar. Without threshold the depth is the one ERM3 publishes; with threshold it is the simplest dep…

ParameterTypeDescription
tickers *array1-100 US stock ticker symbols, e.g. ["NVDA"] or ["AAPL","MSFT"]
market_factor_etfstringETF ticker used as the market factor, e.g. QQQ (default SPY)
thresholdnumberMarginal explained-risk threshold, a fraction, e.g. 0.01. Omit for the depth ERM3 publishes
yearsintegerCalendar years of daily history, integer 1-15, e.g. 3 (default 1)

riskmodels_get_residual_signal RiskModels Residual Mean-Reversion Signal

Use when you want the L3 residual mean-reversion signal aggregated over a basket of 1-100 stocks. Not for the residual return series themselves (use riskmodels_get_residual_returns). Returns, from POST /signals/residual-reversion/basket, the basket-aggregated signal, with optional weights and a minimum signal-quality quintile; it describes recent residual moves and is not a forecast. End-of-day data, refreshed after each US market close. Price: $0.02 per call.

ParameterTypeDescription
tickers *array1-100 basket ticker symbols, e.g. ["AAPL","MSFT","NVDA"]
signal_quality_min_quintileintegerDrop names below this signal-quality quintile, integer 1-5, e.g. 3
weightsarrayWeights aligned to tickers, decimals, e.g. [0.5,0.3,0.2] (default equal weight)

riskmodels_get_macro_correlation RiskModels Macro Factor Correlation

Use when you want to know how one stock's returns co-move with macro factors such as rates, credit, oil, the dollar or volatility. Not for the macro factor return series themselves (use riskmodels_get_factor_returns). Returns, from POST /correlation, Pearson or Spearman correlations over a trailing window, using the L3 residual return by default. End-of-day data, refreshed after each US market close. Price: $0.01 per call.

ParameterTypeDescription
ticker *stringUS stock ticker symbol, case-insensitive, e.g. NVDA
factorsarrayMacro factor keys, e.g. ["oil","usd","term_spread"] (default: the standard set)
methodstring"pearson" or "spearman", e.g. "spearman" (default "pearson")
return_typestringReturn series to correlate, e.g. "gross" (default "l3_residual")
window_daysintegerTrailing window in trading days, integer, e.g. 126 (default 252)

riskmodels_get_fundamentals RiskModels PIT Quarterly Fundamentals

Use when you need point-in-time quarterly fundamentals or CAPM cost of capital for one stock. Not for risk or hedge numbers (use riskmodels_get_stock_snapshot). Returns, from GET /fundamentals/{ticker}: TTM profitability and capital-return ratios, leverage, ERM3 valuation betas, cost_of_debt and wacc from reported data, separately labelled cost_of_debt_imputed and wacc_imputed from a market proxy (10-year Treasury plus a high-quality corporate spread, not issuer-specific), economic profit, an equity-bridge decomposition and SEC line items (sec_facts). A quarter is included only if it was filed…

ParameterTypeDescription
ticker *stringUS stock ticker symbol, case-insensitive, e.g. AAPL
as_ofstringPoint-in-time date; only quarters filed on or before it are returned (default today), format YYYY-MM-DD, e.g. 2025-12-31
erpnumberEquity risk premium as a decimal, e.g. 0.055 for 5.5% (default 0.05)
erp_gridstringComma-separated ERP decimals for the grid, e.g. "0.03,0.04,0.05,0.06,0.07"; used only when grid=true
gridbooleantrue adds sensitivity_grid (cost_of_equity, wacc, wacc_imputed, economic_profit) across erp_grid x rf_tenor_grid for the latest period, e.g. true (default false)
periodsintegerQuarterly rows returned, most recent last, integer 1-40, e.g. 12 (default 8)
rf_tenorstringTreasury constant-maturity tenor for the risk-free rate, e.g. 10y (default 10y); pair a short tenor with a bill-basis ERP
rf_tenor_gridstringComma-separated tenors for the grid, e.g. "1y,10y,30y"; used only when grid=true
tax_ratenumberTax rate for the WACC debt shield as a decimal, e.g. 0.25 (default 0.21)

riskmodels_analyze_portfolio RiskModels Portfolio Hedge Levels and ETF Hedge

Use when you have a long-only book of up to 100 names and want its holdings-weighted L1, L2 and L3 hedge ratios, or the ETF hedge notionals for dollar positions. Not for books with shorts or more than 100 names (use riskmodels_portfolio_exposure) or a variance decomposition with return attribution (use riskmodels_get_portfolio_risk_snapshot). Returns, from POST /batch/analyze, portfolio hedge levels at L1, L2 and L3 with per-ticker detail. Only when every position is given in dollars does it also return the ETF hedge notionals at hedge_level (set by level, default L3), by ticker and summed by…

ParameterTypeDescription
positions *arrayLong positions, each with weight or dollars, combined per ticker, e.g. [{"ticker":"AAPL","dollars":25000},{"ticker":"NVDA","dollars":15000}]
levelstringHedge depth for the ETF notionals, used only when every position is in dollars, e.g. L2 (default L3)
yearsintegerLookback window in years, integer 1-30, e.g. 2 (default 1)

riskmodels_get_portfolio_risk_snapshot RiskModels Portfolio Risk Snapshot

Use when you want a long-only portfolio's risk decomposed into market, sector, subsector and residual variance, with diversification analytics and return attribution. Not for long/short books (use riskmodels_portfolio_exposure) or ETF hedge notionals (use riskmodels_analyze_portfolio). Returns, from POST /snapshot (the canonical portfolio snapshot), the L3 variance decomposition, per-position L3 hedge ratios, diversification analytics with sector and subsector ETF correlations, frozen-weight daily return attribution, cumulative return and drawdown over lookback_days, and a risk summary with do…

ParameterTypeDescription
positions *arrayLong positions, each with one of weight, dollars or shares (shares on every position or none), e.g. [{"ticker":"AAPL","weight":0.4},{"ticker":"NVDA","weight":0.35},{"ticker":"CRWD","weight":0.25}]
benchmarkstringBenchmark ticker, e.g. SPY
lookback_daysintegerTrading days of history for returns, attribution and the diversification window, integer 20-2000, e.g. 504 (default 252)

riskmodels_portfolio_exposure RiskModels Long/Short Portfolio Exposure

Use when a book has short positions or more than 100 names, or when you want its beta-dollars and the ETF trades that neutralise it. Not for long-only books of up to 100 names given as weights (use riskmodels_analyze_portfolio). Returns, from POST /portfolio/exposure, beta-dollars by sector, the ETF trades that neutralise the book at L1, L2 and L3, systematic and residual dollar risk at hedge_level (default lstar: each name at its own recommended depth), coverage (positions not modelled, with reasons) and warnings. Positions are netted by security and not rescaled. End-of-day data, refreshed a…

ParameterTypeDescription
positions *arraySigned book of 1-1000 positions, e.g. [{"ticker":"AAPL","value":100000},{"ticker":"TSLA","value":-50000}]
as_ofstringPast model date, 2011-12-07 or later; before 2013-01-01 lstar uses L3 (default latest), format YYYY-MM-DD, e.g. 2024-12-31
hedge_levelstringlstar: each name at its own recommended depth; l1/l2/l3: one depth for every name, e.g. l3 (default lstar)
lookback_daysintegerTrading days in the ETF covariance window, integer 60-756, e.g. 126 (default 252)

riskmodels_decompose_selection_vs_drift RiskModels Selection vs Drift

Use when you want a book's realized residual return over a date window attributed to stock selection versus drift. Not for current risk or hedges (use riskmodels_portfolio_exposure). Returns, from POST /cohorts/pnl-decomposition, selection (from holding names that beat their cohort's average residual) and drift (from net exposure to the cohort average), which sum exactly to the total; weights are held constant over the window and not normalized, a short is a negative weight, and positions that cannot be mapped to a cohort are listed in coverage.dropped. Historical attribution on end-of-day dat…

ParameterTypeDescription
positions *arrayThe book to attribute, 1-500 positions, e.g. [{"ticker":"MSFT","weight":0.1},{"ticker":"INTC","weight":-0.05}]
end_datestringWindow end, format YYYY-MM-DD, e.g. 2026-06-30
include_seriesbooleantrue adds the daily selection and drift series (large), e.g. true (default false)
levelstringCohort level, e.g. market (default sector)
min_namesintegerIgnore cohort means on days the cohort had fewer members, integer, e.g. 20
start_datestringWindow start, format YYYY-MM-DD, e.g. 2026-01-02

riskmodels_get_my_positions RiskModels linked brokerage positions

Use when the request concerns the caller's own linked brokerage book. Not for a book typed into the conversation (use riskmodels_analyze_portfolio or riskmodels_portfolio_exposure). Returns the caller's positions from their default riskmodels.net portfolio (Alpaca Connect, Connect Trade or Plaid): ticker, quantity, market value and weight of each position, has_shorts, and the same book in three shapes: for_analysis (positive weights), for_hedge (positive dollar values) and for_exposure (signed dollars, short < 0). Returns an empty book when no brokerage is linked. Read-only; it does not place…

riskmodels_get_rankings RiskModels Cross-Sectional Rankings

Use when you want one stock's percentile rank within the universe, its sector or its subsector on a risk or return metric. Not for screening the whole universe (use riskmodels_screen_rankings). Returns, from GET /rankings/{ticker}, the stock's rank and percentile for the metric and window. Metrics: subsector_residual, sector_residual, gross_return, mkt_cap, er_l1, er_l2 or er_l3. Windows: 1d, 21d, 63d, 252d. End-of-day data, refreshed after each US market close. Price: $0.005 per call.

ParameterTypeDescription
ticker *stringUS stock ticker symbol, case-insensitive, e.g. NVDA
cohortstringCohort: universe, sector or subsector, e.g. sector
metricstringMetric: subsector_residual, sector_residual, gross_return, mkt_cap, er_l1, er_l2 or er_l3, e.g. subsector_residual
windowstringWindow in trading days: 1d, 21d, 63d or 252d, e.g. 63d

riskmodels_screen_rankings RiskModels Rankings Screen

Use when you want the names in the universe that rank highest or lowest on one metric, with optional percentile, decile and sector filters. Not for one stock's rank (use riskmodels_get_rankings). Returns, from POST /rankings/screen, the ranked rows that pass the filters; metrics, cohorts and windows are the same as for one stock's rank. End-of-day data, refreshed after each US market close. Price: $0.25 per call.

ParameterTypeDescription
cohort *stringCohort: universe, sector or subsector, e.g. universe
metric *stringMetric: subsector_residual, sector_residual, gross_return, mkt_cap, er_l1, er_l2 or er_l3, e.g. er_l3
window *stringWindow in trading days: 1d, 21d, 63d or 252d, e.g. 21d
as_ofstringRanking date (default latest), format YYYY-MM-DD, e.g. 2026-06-30
decileintegerRestrict to one decile, integer 1-10, e.g. 10
limitintegerMaximum rows, integer, e.g. 25 (default 100)
min_percentilenumberMinimum percentile, 0-100, e.g. 90
sector_filterstringRestrict to one sector, by sector ETF ticker, e.g. XLK

riskmodels_get_cohorts RiskModels Cohort Statistics

Use when you want cross-sectional residual statistics for SPY and the 11 GICS sector SPDR cohorts, on one date or as a time series. Not for one stock's peers (use riskmodels_get_peers) or one stock's rank (use riskmodels_get_rankings). Returns, from GET /cohorts (one date) or GET /cohorts/series (series=true), residual_mean, residual_sd, mean_pairwise_corr, n_names and n_effective by default, more on request. ERM3 residuals are fitted without an intercept, so residual_mean is not zero; link_fit_resid_sd is the residual standard deviation of the 252-day link regression, a fit-quality measure ra…

ParameterTypeDescription
cohortsstringComma-separated cohort tickers from SPY, XLE, XLB, XLI, XLY, XLP, XLV, XLF, XLK, XLC, XLU, XLRE, e.g. "SPY,XLK" (default all)
end_datestringSeries end, series=true only, format YYYY-MM-DD, e.g. 2026-06-30
min_namesintegerDrop cohorts or days with fewer members, integer, e.g. 20
seriesbooleantrue returns a time series over start_date..end_date, e.g. true (default false: one date)
start_datestringSeries start, series=true only, format YYYY-MM-DD, e.g. 2025-01-02
teostringObservation date for the one-date view (default latest), format YYYY-MM-DD, e.g. 2026-06-30
variablesstringComma-separated variables, e.g. "residual_sd,n_names" (default residual_mean, residual_sd, mean_pairwise_corr, n_names, n_effective)

riskmodels_get_peers RiskModels Peer Group

Use when you want the stocks that share a stock's subsector ETF or sector ETF. Not for cohort-level residual statistics (use riskmodels_get_cohorts). Returns, from GET /peers, the peer list ordered by market cap with each peer's market cap. End-of-day data, refreshed after each US market close. Price: $0.005 per call.

ParameterTypeDescription
ticker *stringUS stock ticker symbol, case-insensitive, e.g. NVDA
group_bystringPeer grouping, e.g. sector_etf (default subsector_etf)
limitintegerMaximum peers, integer 1-200, e.g. 20 (default 50)

riskmodels_get_filer RiskModels 13F Filer

Use when you want a 13F filer's profile, latest metrics and concentration, and optionally its largest holdings. Not for finding the bw_filer_id (use riskmodels_search) or comparing the book with a benchmark (use riskmodels_get_benchmark_fit). Returns { snapshot, holdings }: snapshot from GET /13f/filers/{bw_filer_id}/snapshot (registry details, latest metrics, concentration); holdings, only when holdings_top is set, from GET /13f/filers/{bw_filer_id}/holdings with the source filing's accession_number, filing_type (13F-HR, 13F-HR/A, 13F-NT) and amendment_type (ORIGINAL, RESTATEMENT, NEW_HOLDING…

ParameterTypeDescription
bw_filer_id *stringbw_filer_id, e.g. BW-FILER-CIK0001067983, or a composite entity id BW-SYNTH-…
holdings_topintegerAlso return the largest N holdings, integer 1-200, e.g. 25 (default: no holdings)

riskmodels_get_fund RiskModels Mutual Fund

Use when you want a US mutual fund's profile, return decomposition, hedge ratios and style-box ranks, and optionally its full holdings. Not for finding the bw_fund_id (use riskmodels_search) or comparing the fund with a benchmark (use riskmodels_get_benchmark_fit). Returns { snapshot, holdings }: snapshot from GET /funds/snapshot/{bw_fund_id} (registry details, latest return decomposition and diagnostics, top 25 holdings, L1/L2/L3 ETF hedge ratios, a 12-month portfolio time series and the fund's rank within its style box on each ranked metric); holdings, only when holdings_limit is set, from G…

ParameterTypeDescription
bw_fund_id *stringFund id, e.g. BW-FUND-S000019457
holdings_limitintegerAlso return up to N holdings, integer 1-5000, e.g. 100; 5000 returns the whole book (default: no holdings)

riskmodels_get_etf RiskModels ETF

Use when you want one ETF's registry metadata and portfolio surface, and optionally its largest holdings. Not for finding an ETF ticker (use riskmodels_search) or the ETF's daily returns (use riskmodels_get_returns). Returns { snapshot, holdings }: snapshot from GET /data/etf/{ticker}; holdings, only when holdings_top is set, from GET /data/etf/{ticker}/holdings. Holdings follow the latest published holdings file; registry refreshed end-of-day. Free (no per-call charge).

ParameterTypeDescription
ticker *stringETF ticker symbol, case-insensitive, e.g. SMH
holdings_topintegerAlso return the largest N holdings, integer 1-200, e.g. 25 (default: no holdings)

riskmodels_get_benchmark_fit RiskModels Benchmark Fit (active weights)

Use when you want to compare a fund, 13F filer or ETF portfolio with a benchmark: active share and the largest active weights. Not for the subject's own holdings (use riskmodels_get_fund, riskmodels_get_filer or riskmodels_get_etf). Returns, from GET /data/benchmark-fit, active share, active-weight RMS (a coarse tracking-error proxy), overlap, and the largest over- and underweights at a common date. Benchmarks: ff_own (free-float-cap weights of the subject's own holdings), the large and small style cells (cell_large-value, cell_large-blend, cell_large-growth, cell_small-value, cell_small-blend…

ParameterTypeDescription
benchmark *stringff_own, a large or small style cell, or all, e.g. cell_large-growth
subject *stringBW-* portfolio id (BW-FUND-…, BW-FILER-…, BW-ETF-…) or an ETF ticker, e.g. BW-FUND-S000019457 or SPY
as_ofstringUpper bound on the subject's holdings date; the benchmark is taken at its latest date on or before it, format YYYY-MM-DD, e.g. 2026-03-31
topintegerNumber of over- and underweights, integer 1-100, e.g. 20 (default 10)

riskmodels_get_factor_returns RiskModels Macro and Sector ETF Factor Returns

Use when you need macro factor return series (inflation, term spread, short rates, credit, oil, gold, the dollar, volatility, bitcoin, VIX) or the trailing returns of SPY and the 11 GICS sector SPDR ETFs. Not for a stock's correlation with those factors (use riskmodels_get_macro_correlation) or one ETF's daily return series (use riskmodels_get_returns). kind macro returns daily total returns over a date range (GET /macro-factors); kind sector_etf returns closing price and trailing 1, 21, 63 and 252-day total returns on one date (GET /etf/factor-returns). End-of-day data, refreshed after each U…

ParameterTypeDescription
kind *stringmacro: daily macro factor returns over a range; sector_etf: SPY and sector SPDR returns on one date, e.g. macro
endstringkind macro only: last date, inclusive (default today), format YYYY-MM-DD, e.g. 2026-06-30
factorsstringkind macro only: comma-separated keys from inflation, term_spread, short_rates, credit, oil, gold, usd, volatility, bitcoin, vix_spot, e.g. "oil,gold,usd" (default all ten)
sleevestringkind sector_etf only: market (SPY), sector (11 sector SPDRs) or all, e.g. sector (default all)
startstringkind macro only: first date, inclusive (default five years before end), format YYYY-MM-DD, e.g. 2021-01-04
teostringkind sector_etf only: observation date (default latest), format YYYY-MM-DD, e.g. 2026-06-30
tickersstringkind sector_etf only: comma-separated subset of SPY, XLE, XLB, XLI, XLY, XLP, XLV, XLF, XLK, XLC, XLU, XLRE, e.g. "XLK,XLF"