realized_volatility: Calculate the realized volatility for a transction price...

Description Usage Arguments Examples

View source: R/windowed_metrics.r

Description

Calculate the realized volatility for a transction price time-series

Usage

1
realized_volatility(price, interval = minutes(5), interval_const = 1)

Arguments

price

and xts object containting transaction prices

interval

the window size to calculate realized volatility over. The default is 5 mintes.

interval

const the number of trading periods specified by the interval is the number of trading days in a year. It should be noted that this is only needed for calculations like realized volatility. For comparison of two stocks over the same intervals it is fine to leave this as 1.

Examples

1
2
3
4
5
6
data(aapl_fix)
ctp = consolidate_prices(aapl_fix$sys_date, aapl_fix$sys_time,
 aapl_fix$td_price, aapl_fix$td_size, date_format="%Y-%m-%d",
 time_format="%H:%M:%S")
rv = realized_volatility(ctp$price)
plot(rv)

hafen/nxcore documentation built on May 17, 2019, 2:03 p.m.