jonathancornelissen/highfrequency

Error in min(selection):max(selection) while using the vol function

Opened this issue · 2 comments

Hi,

I am trying to use businessTimeAggregation function with vol (volatility) as measure:

library(QuantTools)
library(highfrequency)

# import data and cleaning
ticks <- get_finam_data("AAPL", as.Date("2021-09-01"), as.Date("2021-09-02"), "tick")
setnames(ticks, c("DT", "PRICE", "SIZE"))
ticks$SYMBOL <- "AAPL"
ticks_cleaned <- tradesCleanup(tDataRaw = ticks)
ticks_cleaned <- ticks_cleaned$tData

# aggreagtion
vol_bars <- businessTimeAggregation(ticks_cleaned, measure = "vol")

but got an error:

Error in min(selection):max(selection) : 
  result would be too long a vector
In addition: Warning messages:
1: In detPer(mR, rData = rData, options = options) :
  Periodicity estimation is unstable when the sample data contains less than 50 days. The quality of results may vary
2: In min(selection) : no non-missing arguments to min; returning Inf
3: In max(selection) : no non-missing arguments to max; returning -Inf

I have also tried with more than 50days of data, but got the same error.

The QuantTools package is not supported anymore but I think I found your error. It could be that there are too many zero-returns at the same time across days. I'll improve the error messages.

Hello, thanks for the answer. This is an old issue, but I will try again soon since I have just starterd to work with highfrequency package few days before, after some time.... I want close an issue, since you said you will add some error messages...