vwap: Calculated the VWAP for a specified interval

Description Usage Arguments Value Examples

View source: R/utilities.r

Description

Calculated the VWAP for a specified interval

Usage

1
vwap(price, size, date_time, on = "minutes", k = 1)

Arguments

price

the product's tranaction price.

size

the number of products transacted.

date_time

the date-times for the tranactions

on

the interval to find the average over.

k

along every k elements.

Value

an xts object with the volume-weighted average price for the specified interval of time.

Examples

1
2
3
4
5
data(aapl_fix)
aapl_fix$dt_string = paste(aapl_fix$sys_date, aapl_fix$sys_time)
aapl_fix$dt = strptime(aapl_fix$dt_string, "%Y-%m-%d %H:%M:%OS")
# Minute-aggregated vwap prices.
minute_prices = vwap(aapl_fix$td_price, aapl_fix$td_size, aapl_fix$dt)

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