Skip to main content

cones

Calculate the realized volatility quantiles over rolling windows of time.

The model for calculating volatility is selectable.

Example:​

from openbb import obb
stock_data = obb.equity.price.historical(symbol="TSLA", start_date="2023-01-01", provider="fmp")
cones_data = obb.technical.cones(data=stock_data.results, lower_q=0.25, upper_q=0.75, model="STD")

Parameters​

NameTypeDescriptionDefaultOptional
dataList[Data]The data to use for the calculation.NoneFalse
indexstrIndex column name to use with data, by default "date"dateTrue
lower_qfloatThe lower quantile value for calculations0.25True
upper_qfloatThe upper quantile value for calculations0.75True
modelLiteral["STD", "Parkinson", "Garman-Klass", "Hodges-Tompkins", "Rogers-Satchell", "Yang-Zhang"]The model used to calculate realized volatility
Standard deviation measures how widely returns are dispersed from the average return.
It is the most common (and biased) estimator of volatility.

Parkinson volatility uses the high and low price of the day rather than just close to close prices.
It is useful for capturing large price movements during the day.

Garman-Klass volatility extends Parkinson volatility by taking into account the opening and closing price.
As markets are most active during the opening and closing of a trading session;
it makes volatility estimation more accurate.

Hodges-Tompkins volatility is a bias correction for estimation using an overlapping data sample.
It produces unbiased estimates and a substantial gain in efficiency.

Rogers-Satchell is an estimator for measuring the volatility with an average return not equal to zero.
Unlike Parkinson and Garman-Klass estimators, Rogers-Satchell incorporates a drift term,
mean return not equal to zero.

Yang-Zhang volatility is the combination of the overnight (close-to-open volatility).
It is a weighted average of the Rogers-Satchell volatility and the open-to-close volatility. | STD | True |

| is_crypto | bool | Whether the data is crypto or not. If True, volatility is calculated for 365 days instead of 252 | False | True | | trading_periods | int] [default: 252 | Number of trading periods in a year. | None | True |


Returns​

The cones data.