jonathancornelissen / highfrequency

The highfrequency package contains an extensive toolkit for the use of highfrequency financial data in R. It contains functionality to manage, clean and match highfrequency trades and quotes data. Furthermore, it enables users to: calculate easily various liquidity measures, estimate and forecast volatility, and investigate microstructure noise and intraday periodicity.
147 stars 63 forks source link

Help with docs and intraday jumps #98

Closed MislavSag closed 1 year ago

MislavSag commented 1 year ago

Hello,

I would like to estimate intraday jumps from 1-minute close price data.

I have looked at CRAN documentation and SSRN article and it seems to me intradayJumpTest function is way to go. I looked at source code and it seems to it is just (return - drift) / vol, compared to critical value.

I have looked at the examples, and there are some arguments not available in the docs.

For example, first example:

# We can easily make a Lee-Mykland jump test.
LMtest <- intradayJumpTest(pData = sampleTData[, list(DT, PRICE)], 
                           volEstimator = "RM", driftEstimator = "none",
                           RM = "rBPCov", lookBackPeriod = 20,
                           alignBy = "minutes", alignPeriod = 5, marketOpen = "09:30:00", 
                           marketClose = "16:00:00")
plot(LMtest)

but in docs for intradayJumpTest function, there is information for the RM and lookBackPeriod argument?

Additionaly, I don't want to do look-ahead bias while detecting jumps at specific point in time. If I juset use all data to calculate z-scores, would the algorithm use whole period volatility to calculate z-scores or just volatility for specific date? That is, should I apply intradayJumpTest on whole data or on rolling window basis?

MislavSag commented 1 year ago

I think I have found the answer in the docs.

If I set volEstimator = "RM", the volatility is estimated using "trailing rolling window", and it uses lookback observations to calculate it. So I can just set whole data as pData and volatility will be estiamted on rolling basis.

An lookack i ... part...