AnalyticalCone
- class qf_lib.common.utils.confidence_interval.analytical_cone.AnalyticalCone(series: Optional[QFSeries] = None)[source]
Bases:
AnalyticalConeBase
Methods:
Evaluates many simple cones and saves the end values of every individual simple cone.
calculate_simple_cone
(live_start_date, ...)Creates a simple cone starting from a given date using the solution to the stochastic equation: S(t) = S(0)*exp( (mu-0.5*sigma^2)*t + sigma*N(0,1)*sqrt(t) )
- calculate_aggregated_cone(nr_of_days_to_evaluate: int, is_end_date: datetime, number_of_std: float) QFDataFrame [source]
Evaluates many simple cones and saves the end values of every individual simple cone. While using a simple cone (e.g. LineChart with Cone decorator) the results of the evaluation may be very different depending on the starting point. To be immune to this, calculate_aggregated_cone plots only the ends of simple cones which start at 1 period, 2 periods, …, n periods before the end of the series. The period length depends on the frequency of the data provided for the chart. If it has daily frequency, then the length of one period will be 1 day.
- Parameters:
nr_of_days_to_evaluate – max number of days in the past, from when all the cones are evaluated
is_end_date – the end od in-sample date. Makes sure that in-sample doesn’t move with the cone.
number_of_std – corresponds to the randomness of the stochastic process. reflects number of standard deviations to get expected values for. For example 1.0 means 1 standard deviation above the expected value.
- Returns:
contains values corresponding to Strategy, Mean and Std. Values are indexed by number of days from which given cone was evaluated
- Return type:
- calculate_simple_cone(live_start_date: datetime, number_of_std: float) PricesSeries [source]
Creates a simple cone starting from a given date using the solution to the stochastic equation: S(t) = S(0)*exp( (mu-0.5*sigma^2)*t + sigma*N(0,1)*sqrt(t) )
- Parameters:
live_start_date (datetime) – datetime or string with date, corresponds to the cone start date
number_of_std (float) – corresponds to the randomness of the stochastic process. reflects number of standard deviations to get expected values for. For example 1.0 means 1 standard deviation above the expected value.
- Returns:
expected values
- Return type:
PriceSeries