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

7 Ansichten (letzte 30 Tage)
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.

Antworten (1)

Moksh
Moksh am 8 Nov. 2023
Bearbeitet: Moksh am 17 Nov. 2023
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

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by