フィルターのクリア

Calculate log return between the first and last observation in a day ?

1 回表示 (過去 30 日間)
NS
NS 2019 年 2 月 19 日
コメント済み: NS 2019 年 2 月 20 日
I have 1 min prices for each day begining 09:30 to 4:00pm and i need to calculate daily log return i.e. log(close price on the day / opening price on the day)?
Since its possible that some day may not have 09:30 or 4:00 , then i want it to take next time 9:31 if 9:30 is not there and 3:59 if 4:00 pm time is not there . How to do it ? If i split my data into days and wish to calculate log return i.e log(last observation in that day/first observation in that day). How to code this in matlab R2016a?
my data looks like
2014-02-03 09:30:00 10.450000
2014-02-03 09:31:00 10.450000
2014-02-03 09:32:00 10.326600
2014-02-03 09:33:00 10.290000
.
.
2014-02-03 04:00:00 10.326500
...
2014-07-31 09:30:00 15.8500
2014-07-31 09:31:00 15.8600
2014-07-31 09:32:00 15.8600
.
2014-07-31 03:50:00 15.9101
2014-07-31 04:00:00 15.9300
  2 件のコメント
NS
NS 2019 年 2 月 19 日
Any help on this ?
NS
NS 2019 年 2 月 20 日
any help on this ??

サインインしてコメントする。

採用された回答

KSSV
KSSV 2019 年 2 月 20 日
fid = fopen('data.txt','rt') ;
S = textscan(fid,'%s','delimiter','\n') ;
fclose(fid) ;
S = S{1} ;
firstline = S{1}
lastline = S{end}

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePrice and Analyze Financial Instruments についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by