performance
Calculate risk-adjusted performance metrics such as Sharpe, Sortino, Alpha, Beta and Treynor for chosen tickers, comparing returns against a benchmark over a date range.
Instructions
Pre-computed risk-adjusted performance metrics (Sharpe ratio incl. standard/adjusted/probabilistic/deflated methods, Sortino ratio, Alpha, Jensen's Alpha, Beta, CAPM, Treynor ratio, M2 ratio, Tracking Error, Information Ratio, Fama-French factors, period Returns, Excess Returns — Returns/Excess Returns support cumulative=true for the compounded growth of 1 from the start of the date range, so the first value includes the first period's return). Beta, CAPM, Alpha, Jensen's Alpha, Treynor, Sortino, M2, Tracking Error and Information Ratio support rolling=N for a rolling N-period value spanning the full history instead of one value per period (e.g. period='monthly', rolling=6 for a rolling 6-month figure). Sharpe ratios are per observation (e.g. per day within the period) unless annualize=true. Requires tickers='AAPL' — use comma-separated values for multiple tickers. Supports period='daily' only together with rolling=N (e.g. period='daily', rolling=60 for a rolling 60-day figure); per-period results use weekly, monthly, quarterly, or yearly. get_style_analysis also takes period='daily' without rolling. The factor models (get_fama_and_french_model, get_carhart_four_factor_model, get_factor_asset_correlations, get_factor_correlations) take region='United States' (default), 'Developed', 'Developed ex US', 'Europe', 'Japan', 'Asia Pacific ex Japan' or 'North America' for Ken French's regional factors. get_style_analysis is Sharpe's returns-based style analysis: style_tickers= names tickers of the call that serve as style indices (e.g. tickers='ARKK,IWF,IWD,IWO,IWN,AGG', style_tickers='IWF,IWD,IWO,IWN,AGG'), and every other ticker gets its style weights and in-sample R Squared, selection return and tracking error; window= for rolling weights, which adds Sharpe's out-of-sample selection return per period.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lag | No | Number of periods to lag when computing growth rates. | |
| alpha | No | For get_rachev_ratio: The confidence level used for both tails (e.g. 0.05 for the best/worst 5% of outcomes). For get_starr_ratio: The confidence level used for the CVaR calculation (e.g. 0.05 for the worst 5% of outcomes). | |
| limit | No | The rows to return, like head and tail: 5 for the first five, -5 for the last five (the most recent of a time series). A table with its periods as columns (financial statements, ratios) keeps its first or last periods instead. For ETF holdings the largest (or, negative, the smallest) by weight, and for a list (e.g. news or a screener) its length. | |
| order | No | The order of the lower partial moment used in the denominator. | |
| growth | No | Return period-over-period growth rates instead of absolute values. | |
| method | No | For get_fama_and_french_model: The regression method to use for the calculation. For get_sharpe_ratio: Which Sharpe ratio to calculate, one of "standard", "adjusted", "probabilistic" or "deflated". Leave unset to use the default of the indicator you selected. Defaults are 'multi' for get_fama_and_french_model; 'standard' for get_sharpe_ratio. | |
| period | No | Observation frequency, e.g. 'daily', 'weekly', 'monthly', 'quarterly', or 'annual' (supported values differ per method). Leave unset to use the default of the indicator you selected. Defaults differ between indicators. | |
| region | No | The region whose factors to use: "United States", "Developed", "Developed ex US", "Europe", "Japan", "Asia Pacific ex Japan" or "North America" (the factors of Ken French's library for that region's stocks). Every region's factors are U.S. dollar returns with the U.S. one-month Treasury bill as... | United States |
| window | No | The number of periods the indicator looks back over, e.g. 14 or 20. | |
| rolling | No | Rolling window size in number of periods. When set, the metric is computed over a smoothly overlapping trailing window across the full history (e.g. period='monthly' and rolling=6 gives a rolling 6-month value) instead of one value per period, or (for economics indicators) a simple moving average used to smooth the raw series. Leave unset to use the default of the indicator you selected. Defaults are None for get_alpha, get_appraisal_ratio, get_beta, get_capital_asset_pricing_model, get_fama_decomposition, get_information_ratio, get_jensens_alpha, get_m2_ratio, get_omega_ratio, get_sharpe_ratio, get_sortino_ratio, get_tracking_error, get_treynor_ratio; 14 for get_ulcer_performance_index. | |
| tickers | No | Comma-separated ticker symbols, e.g. 'AAPL,MSFT,GOOGL'. | |
| end_date | No | End of the date range in YYYY-MM-DD format. | 2026-10-27 |
| n_trials | No | The number of independent (or effectively independent) strategy variations, parameter combinations, or lookback windows tried before arriving at the reported Sharpe ratio. Only used when method="deflated". Pass this explicitly whenever the actual number of trials is known. | |
| annualize | No | Set to true to annualize a Sharpe ratio (by default it is per observation, e.g. per day, so roughly sqrt(252) smaller than the annualized figure). | |
| indicator | Yes | Name of the specific metric to calculate, one of the listed values. Required — search_metrics finds the indicator (and its tool) for a metric by name. | |
| quarterly | No | Return quarterly data instead of annual when True. | |
| adjustment | No | The fixed adjustment added to the Average Drawdown, conventionally 0.1 (10%). | |
| cumulative | No | Return the cumulative value compounded over time instead of the discrete value per period. Always rebased to start at 1 at the beginning of the selected date range. | |
| start_date | No | Start of the date range in YYYY-MM-DD format. | 2021-10-28 |
| standardize | No | Return the Z-Score (standard score) instead of the raw values, i.e. how many standard deviations each value is from the mean of its own series. When combined with growth=True, the growth values are standardized instead of the raw values. | |
| show_columns | No | Comma-separated names to filter the output. For historical data use the key names visible in any response record (e.g. 'Close,Volume,Return'). For financial statements use the 'metric' field values from the response (e.g. 'Revenue,Net Income,EBITDA'). Call the tool once without this parameter to see all available names, then repeat with show_columns to reduce response size and token usage. | |
| style_tickers | No | The tickers of the style indices, as a list or a comma-separated string. Leave unset to use the default of the indicator you selected. Required by: get_style_analysis. | |
| trials_window | No | The window size of the auxiliary rolling Sharpe ratio series that approximates `Var[SR_trials]` and the default `n_trials`. Only used when method="deflated". It counts observations of the returns the Sharpe ratio is computed from: daily (or intraday) observations for the Sharpe ratio per period,... | |
| within_period | No | Whether to calculate the CVaR within the specified period or for the entire period. Thus whether to look at the CVaR within a specific year (if period = 'yearly') or look at the entirety of all years. | |
| benchmark_ticker | No | Ticker used as the market benchmark, e.g. 'SPY' or '^GSPC'. | SPY |
| exclude_risk_free | No | Whether to exclude the risk-free rate from the results. | |
| show_full_results | No | Whether to show the actual and benchmark returns next to the Alpha. | |
| factors_to_calculate | No | Comma-separated factor names to include in the calculation. | |
| benchmark_sharpe_ratio | No | The hypothesized or benchmark Sharpe ratio (SR*) to test the observed Sharpe ratio against. Only used when method="probabilistic". | |
| include_daily_residuals | No | Whether to also return the pointwise (daily) regression residuals as a second DataFrame. | |
| minimum_acceptable_return | No | The minimum acceptable return (MAR) threshold below which returns are considered downside, e.g. 0.0 for downside relative to a zero return. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |