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

24/7 trading period #64

Closed waynelapierre closed 2 years ago

waynelapierre commented 3 years ago

For markets like FX, people trade 24/7. In such cases, how should marketOpen & marketClose be set?

emilsjoerup commented 3 years ago

Dear Wayne, can you be more specific? What is your problem? Which function(s) are you having trouble with, and what does your dataset look like? If you provide a little more information, we will have a much easier time helping you.

waynelapierre commented 3 years ago

My data contain tick-by-tick foreign exchange quotes. I am trying to use the aggregatePrice function. Since the foreign exchange market trade 24/7, is it OK to set the marketOpen to be "00:00:00" and marketClose to be "24:00:00"?

emilsjoerup commented 3 years ago

You can try it! Otherwise just set it to "23:59:59.99999", or something like that. This should give you your desired results and also show that your data still belongs to that day ("00:00:00" would be next day). I am actually not sure if the "24:00:00" input is valid.

waynelapierre commented 3 years ago

OK. I will try "00:00:00.001" and "23:59:59.999". Thanks for the suggestion.