MFE Financial toolbox related question

1 view (last 30 days)
Harsh Rob
Harsh Rob on 7 Dec 2019
Answered: Maadhav Akula on 13 Dec 2019
I am trying to use Realised variance from MFE Financial toolbox - Kevin Shephard.
The function is - function [rv,rvSS]=realized_variance(price,time,timeType,samplingType,samplingInterval,subsamples)
I have put the price matrix as 1*79, time matrix as 1*79, samplingType as 'CalendarTime' and subsamples as 5.
The price matrix is just the high frequency prices of the stock.
Time matrix is in the form of unix code and has many dates.
I want to calculate the realised variance at a sampling frequency of 5 min. I have created a function for the conversion of unix code to date/number format-
function dn = unixtime_to_datenum( unix_time )
dn = unix_time/86400 + 719529;
end
I am not able to convert these datenum into 'wall', 'seconds', 'unit' for different dates with different timings and then use it in this code. (Please refer attached excel sheet)
Could someone help me with this?

Answers (1)

Maadhav Akula
Maadhav Akula on 13 Dec 2019
From your question, I think the 'unit' format refers to Normalization of time, if that is the case you can use the unixtime format itself for Normalization as follows:
normalized_time = (unix_time - min(unix_time))/(max(unix_time) - min(unix_time));
Hope this helps!

Categories

Find more on Dates and Time in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!