Borrar filtros
Borrar filtros

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 visualizaciones (últimos 30 días)
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.

Respuestas (1)

Moksh
Moksh el 8 de Nov. de 2023
Editada: Moksh el 17 de Nov. de 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

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by