Main Content


Convert prices to returns


[RetSeries,RetIntervals] = ...


[RetSeries,RetIntervals] = ...
computes asset returns for NUMOBS price observations of NUMASSETS assets.

Input Arguments


Time series of price data. TickSeries can be a column vector or a matrix:

  • As a vector, TickSeries represents a univariate price series. The length of the vector is the number of observations (NUMOBS). The first element contains the oldest observation, and the last element the most recent.

  • As a matrix, TickSeries represents a NUMOBS-by-number of assets (NUMASSETS) matrix of asset prices. Rows correspond to time indices. The first row contains the oldest observations and the last row the most recent. price2ret assumes that the observations across a given row occur at the same time for all columns, where each column is a price series of an individual asset.


A NUMOBS element vector of monotonically increasing observation times. Times are numeric and taken either as serial date numbers (day units), or as decimal numbers in arbitrary units (for example, yearly). If TickTimes is [] or unspecified, then price2ret assumes sequential observation times from 1, 2, ..., NUMOBS.


Character vector indicating the compounding method to compute asset returns. If Method is 'Continuous', [], or unspecified, then price2ret computes continuously compounded returns. If Method = 'Periodic', then price2ret assumes simple periodic returns. Method is case insensitive.

Output Arguments


Array of asset returns:

  • When TickSeries is a NUMOBS element column vector, RetSeries is a NUMOBS-1 column vector.

  • When TickSeries is a NUMOBS-by-NUMASSETS matrix, RetSeries is a (NUMOBS-1)-by-NUMASSETS matrix. price2ret quotes the ith return of an asset for the period TickTimes(i) to TickTimes(i+1). It then normalizes it by the time interval between successive price observations.

    Assuming that

    RetIntervals(i) = TickTimes(i+1) – TickTimes(i)

    then if Method is 'Continuous', [], or is unspecified, price2ret computes the continuously compounded returns as

    RetSeries(i) = log [TickSeries(i+1)/TickSeries(i)]/RetIntervals(i)

    If Method is 'Periodic', then price2ret computes the simple returns as

    RetSeries(i) = [TickSeries(i+1)/TickSeries(i)] – 1 /RetIntervals(i)


NUMOBS-1 element vector of times between observations. If TickTimes is [] or is unspecified, price2ret assumes that all intervals are 1.


collapse all

Create a stock price process continuously compounded at 10 percent:

S = 100*exp(0.10 * [0:19]'); 
    % Create the stock price series

Convert the price series to a 10 percent return series:

R = price2ret(S);   % Convert the price series to a 
                    % 10 percent return series
[S [R;NaN]]  % Pad the return series so vectors are of  
ans = 20×2

  100.0000    0.1000
  110.5171    0.1000
  122.1403    0.1000
  134.9859    0.1000
  149.1825    0.1000
  164.8721    0.1000
  182.2119    0.1000
  201.3753    0.1000
  222.5541    0.1000
  245.9603    0.1000

   % same length. price2ret computes the ith return from 
   % the ith and i+1th prices.
Introduced before R2006a