Closed MislavSag closed 2 years ago
Hi,
I just looked at the code on my phone and I see how it can be confusing. Currently, the volume output is the last in the window of the given sample, which is..... suboptimal.
I will try to fix it tomorrow and get an update on the repo.
I have found the code for tick, volume and other bars in this package: https://github.com/nmatare/quanttools/. Maybe it can help somehow. It uses the same Rcpp function in constructing all bars.
I forgot to provide sample code:
library(QuantTools)
library(highfrequency)
# import data and cleaning
tick_data <- get_finam_data("AAPL", as.Date("2021-09-07"), as.Date("2021-09-07"), "tick")
setnames(tick_data, c("DT", "PRICE", "SIZE"))
tick_data$SYMBOL <- "AAPL"
tick_data_cleaned <- tradesCleanup(tDataRaw = tick_data)
print(tick_data_cleaned$report)
tick_data_cleaned <- tick_data_cleaned$tData
# aggreagtion
vol_bars <- businessTimeAggregation(tick_data_cleaned, measure = "volume")
print(vol_bars$pData)
# SIZE IS NOT UNIFORM
Hi ,
I am reading the new vignette. great work.
There is a section in te vignette which says:
I have tried to use above
businessTimeAggregation
function with volume as measure. I would expect this would create "volume bars", that is bars with approximately uniform distribution wrt volume. But sizes are very different across bars. I am not sure I understand what this function really do. I have read about tick, volume and dollar bars on one side, and imbalanced bars on other side, in De Prado book on Advanced ML in finance. Is it possible to construct this kind of bars withhighfrequency
package?