Description Usage Arguments Examples
View source: R/windowed_metrics.r
Calculate the realized volatility for a transction price time-series
1 | realized_volatility(price, interval = minutes(5), interval_const = 1)
|
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. |
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.