How do I calculate log returns for prices series? i.e. what is the syntax to use the continuous method with the "tick2ret" function?

조회 수: 9 (최근 30일)
The help documentation for tick2ret suggests that there are two methods (simple and continuous), however it doesn't provide the syntax for choosing the method used. I would like to compute returns using both methods.

답변 (1개)

Moksh
Moksh 2023년 11월 8일
편집: Moksh 2023년 11월 17일
Hi Brindha,
I understand that you are trying to use the “tick2ret” function in MATLAB for getting return for price series using “continuous” approach.
You can specify the “Method” parameter as “continuous” in the function argument while passing the input to get the required results.
Here is an example code for this:
% Example tick data
tickData = [1; 2; 3; 4; 5];
% Compute returns using the simple method
returns_simple = tick2ret(tickData);
% Compute returns using the continuous method
returns_continuous = tick2ret(tickData, 'Method', 'continuous');
display(returns_continuous);
returns_continuous = 4×1
0.6931 0.4055 0.2877 0.2231
For more information about the “tick2ret” function please refer to the following MATLAB documentation:
Hope this information helps resolve the query.
Best Regards,
Moksh Aggarwal

카테고리

Help CenterFile Exchange에서 Time Series Events에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by