Main Content

ret2tick

Convert return series to price series

Description

[TickSeries,TickTimes] = ret2tick(Data) computes prices from the start prices of NASSET assets and NUMOBS return observations.

example

[TickSeries,TickTimes] = ret2tick(___,Name,Value) adds optional name-value pair arguments.

example

Examples

collapse all

Compute the price increase of two stocks over a year's time based on three incremental return observations.

RetSeries = [0.10 0.12
             0.05 0.04
            -0.05 0.05];

RetIntervals = [182 
                 91
                 92];

StartTime = datetime('18-Dec-2000','Locale','en_US');

[TickSeries,TickTimes] = ret2tick(RetSeries,'ReturnIntervals',RetIntervals,... 
    'StartTime',StartTime)
TickSeries = 4×2

    1.0000    1.0000
    1.1000    1.1200
    1.1550    1.1648
    1.0973    1.2230

TickTimes = 4x1 datetime
   18-Dec-2000
   18-Jun-2001
   17-Sep-2001
   18-Dec-2001

Use timetable input to convert a price series to a return series, given periodic returns of two stocks observed in the first, second, third, and fourth quarters.

RetSeries = [0.10 0.12
             0.05 0.04
            -0.05 0.05];

RetTimes = datetime({'6/18/2001','9/17/2001','12/18/2001'},'InputFormat','MM/dd/uuuu','Locale','en_US');
RetSeries = array2timetable(RetSeries,'RowTimes',RetTimes);
StartTime = datetime('12/18/2000','InputFormat','MM/dd/uuuu','Locale','en_US');


[TickSeries,TickTimes] = ret2tick(RetSeries,'StartTime',StartTime)
TickSeries=4×2 timetable
       Time        RetSeries1    RetSeries2
    ___________    __________    __________

    18-Dec-2000           1             1  
    18-Jun-2001         1.1          1.12  
    17-Sep-2001       1.155        1.1648  
    18-Dec-2001      1.0973         1.223  

TickTimes = 4x1 datetime
   18-Dec-2000
   18-Jun-2001
   17-Sep-2001
   18-Dec-2001

Input Arguments

collapse all

Data for asset returns, specified as a NUMOBSNASSETS matrix, table, or timetable. The returns are not normalized by the time increments between successive price observations.

Data Types: double | table | timetable

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Example: [TickSeries,TickTimes] = ret2tick(RetSeries,'StartTime',StartTime)

Initial prices for each asset, specified as the comma-separated pair consisting of 'StartPrice' and a NASSETS-by-1 vector indicating initial prices for each asset, or a single scalar initial price applied to all assets.

Data Types: double

Return interval between prices, specified as the comma-separated pair consisting of 'ReturnIntervals' and a scalar return interval applied to all returns, or a vector of length NUMOBS return intervals between successive returns. ReturnIntervals is defined as:

ReturnIntervals(t) = TickTimes(t) - TickTimes(t-1).

Note

If the type of Data is a timetable, ReturnIntervals is ignored.

Data Types: double

Starting time for first observation applied to the price series of all assets, specified as the comma-separated pair consisting of 'StartTime' and a scalar string, character vector, double, or datetime.

Note

If ReturnIntervals is a duration or calendar duration value, the default for StartTime is datetime('today').

If Data is a timetable and StartTime is not specified, the resulting asset prices in the first period are not reported.

Data Types: double | string | char | datetime

Method to convert asset returns to prices, specified as the comma-separated pair consisting of 'Method' and a string or character vector indicating the method to convert asset prices to returns.

If the method is 'Simple', then simple periodic returns are used:

TTickSeries(t) = TickSeries(t-1)*(1 + ReturnSeries(t)).

If the method is 'Continuous', then continuous returns are used:

TickSeries(t) = TickSeries(t-1)*exp(ReturnSeries(t)).

Data Types: char | string

Output Arguments

collapse all

Time series array of asset prices, returned as NUMBOBS+1-by-NASSETS time series of asset prices of the same type (matrix, table, or timetable) as the input Data. The first row contains the oldest prices and the last row contains the most recent. Prices across a given row are assumed to occur at the same time for all columns, and each column is a price series of an individual asset.

Observation times associated with the prices in TickSeries, returned as a NUMBOBS+1 length column vector of monotonically increasing observation times associated with the prices in TickSeries. The initial time is StartTime. For matrix and table Data, sequential observations occur at increments specified in ReturnIntervals and for Data timetables, sequential observations are derived from times and dates in Data.

Extended Capabilities

Version History

Introduced before R2006a

expand all