MFE Financial toolbox related question

1 回表示 (過去 30 日間)
Harsh Rob
Harsh Rob 2019 年 12 月 7 日
回答済み: Maadhav Akula 2019 年 12 月 13 日
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 Center および File ExchangeDates and Time についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by