Forecast Cone

Calculate a forecast cone of the growth of 1 over the coming trading days, bootstrapped from the daily returns: the mean path and the bounds a number of standard deviations above and below it, against which the performance after the date range can be judged.

Every simulation draws horizon daily returns with replacement from the returns in the date range and compounds them into a path of wealth that starts at 1:

\[\text{Wealth}_{t} = \operatorname{PRODUCT}(1 + \text{Simulated Return}_{1} \ldots \;\text{Simulated Return}_{t})\] \[\text{Mean}_{t} = \operatorname{MEAN}(\text{Wealth}_{t}) \;\text{over the simulations}\] \[\text{Upper} \;(\text{Lower}) k_{t} = \text{Mean}_{t} + (-) k \cdot \operatorname{STDEV}(\text{Wealth}_{t})\]

A strategy whose live performance leaves the cone (e.g. below the lower 2 standard deviation bound) behaves differently from its history. The cone does not assume normally distributed returns, but it does assume that the coming returns are drawn independently from the same distribution as the past ones.

The bootstrap forecast cone is the one pyfolio (Quantopian) draws in its tear sheets.

Also known as: bootstrap cone, probability cone, Bayesian cone (pyfolio’s tear sheet).

Example · AAPL, MSFT · 2021 to 2025

Install the Finance Toolkit with pip install financetoolkit -U, then call get_forecast_cone:

from financetoolkit import Toolkit

toolkit = Toolkit(
    ["AAPL", "MSFT"],
    api_key="FINANCIAL_MODELING_PREP_KEY",
    start_date="2021-01-01",
    end_date="2025-12-31",
)

toolkit.performance.get_forecast_cone()["AAPL"]

Or, with the Finance Toolkit MCP set up, ask an AI assistant such as Claude or ChatGPT:

Based on Apple's daily returns from 2021 to 2025, where could $1 invested in it end up over the next year, within 1, 1.5 and 2 standard deviations?

Which returns:

Parameters

get_forecast_cone accepts the following parameters.

ParameterTypeDescriptionExample
horizonintThe number of trading days to forecast. Defaults to 252.5
standard_deviationslist[float] | NoneThe numbers of standard deviations of the bounds. Defaults to None, which uses 1, 1.5 and 2.
simulationsintThe number of simulated paths. Defaults to 1000.1000
seedint | NoneThe seed of the random numbers, so that results can be reproduced; None draws new ones every time. Defaults to 0.42
roundingint | NoneThe number of decimals to round the results to. Defaults to None, which uses the rounding of the Toolkit (4 unless set otherwise).2
show_columnsstr | list[str] | NoneThe columns to keep, a name or a list of names, matched on every column level, or the rows when no column has those names (such as the line items of a financial statement). Names that do not exist are logged, and when none exist the result is returned in full. Defaults to None, which keeps every column.None, which keeps every column

References

  • Paper Efron, B. (1979). “Bootstrap Methods: Another Look at the Jackknife.” The Annals of Statistics, 7(1), 1-26.
  • Library Referenced against pyfolio’s summarize_paths
  • Library Shares similar logic as pyfolio’s forecast_cone_bootstrap
Share