Volatility¶
Volatility targets compute realized volatility over a future window.
They have warm_up_period = 0 and forward_period = horizon.
Future CTC Volatility¶
Close-to-close realized volatility over the next horizon bars. Computes the
sample standard deviation of log returns over the forward window. The output
name is auto-generated as {input}_future_ctc_vol_{horizon}.
| Name | Type | Constraint | Description |
|---|---|---|---|
input |
str |
non-empty | Price column, e.g. "close" |
horizon |
int |
>= 1 | Number of bars to look ahead (\(h\)) |
| Column | When valid | Description |
|---|---|---|
{input}_future_ctc_vol_{horizon} |
t <= N - horizon - 1 |
Sample std of horizon log returns starting at t+1 |
| Property | Value |
|---|---|
warm_up_period |
0 |
forward_period |
horizon |
-
Forward NaN. The last
horizonvalues areNaNbecause the future window is not complete. The first valid value appears at bar 0. -
NaNin prices. If any price in the forward window isNaNor non-positive, the corresponding log return isNaN, and the standard deviation returnsNaN. -
Stateless.
run_research()has no internal state. Calling it twice with the same input always returns the same output. -
Implementation. Computes log returns via a pairwise pass, then applies a rolling sample standard deviation with
shiftto align results to bart.
-
Label. The standard label for realized volatility forecasting. Captures how much the price moved over the next
horizonbars, regardless of direction. -
Units. Log-return scale, not annualized. To annualize, multiply by
sqrt(periods_per_year).
import pandas as pd
from oryon.targets import FutureCTCVolatility
from oryon import TargetPipeline, run_targets_pipeline
t = FutureCTCVolatility(input="close", horizon=3)
print(t.output_names()) # ['close_future_ctc_vol_3']
tp = TargetPipeline(targets=[t], input_columns=["close"])
df = pd.DataFrame({
"close": [100.0, 101.0, 103.0, 102.0, 105.0, 107.0, 106.0],
})
out = run_targets_pipeline(tp, df)
print(out)
# close_future_ctc_vol_3
# 0 0.0150
# 1 0.0202
# 2 0.0201
# 3 0.0199
# 4 NaN
# 5 NaN
# 6 NaN