MFE Financial toolbox related question

1 次查看(过去 30 天)
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?

回答(1 个)

Maadhav Akula
Maadhav Akula 2019-12-13
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!

类别

Help CenterFile Exchange 中查找有关 Dates and Time 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by