AnalyticalConeBase

class qf_lib.common.utils.confidence_interval.analytical_cone_base.AnalyticalConeBase[source]

Bases: object

Methods:

calculate_simple_cone_for_process(mu, sigma, ...)

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) )

get_expected_value(mu, sigma, ...)

For the mu and sigma calculated based on log returns:

calculate_simple_cone_for_process(mu: float, sigma: float, number_of_std: float, number_of_steps: int, starting_value=1) 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:
  • mu – mean return of the process. expressed in the frequency of samples (not annualised)

  • sigma – std of returns of the process. expressed in the frequency of samples (not annualised)

  • 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.

  • number_of_steps – length of the cone that we are creating

  • starting_value – corresponds to the starting price of the instrument

Returns:

expected values

Return type:

PriceSeries

static get_expected_value(mu, sigma, starting_price, number_of_steps, random_element) float[source]
For the mu and sigma calculated based on log returns:

S(t) = S(0)*exp( (mu-0.5*sigma^2)*t + sigma*N(0,1)*sqrt(t))

Parameters:
  • mu – mean of the distribution of returns

  • sigma – standard deviation of the returns

  • starting_price – price of the stock at the beginning of the cone

  • number_of_steps – horizon for which the expected value is calculated

  • random_element – corresponds to the N(0,1). is expressed in number of standard deviations. Use 1 to model 1std up move, Use 0 to model expected vale of the stock

Returns:

Expected value of the stock after number_of_steps given the input parameters

Return type:

float