ret2tick
Convert return series to price series
Description
[
computes prices from the start prices of TickSeries
,TickTimes
] = ret2tick(Data
)NASSET
assets and
NUMOBS
return observations.
[
adds optional name-value pair arguments. TickSeries
,TickTimes
] = ret2tick(___,Name,Value
)
Examples
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 = 4×1 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 = 4×1 datetime
18-Dec-2000
18-Jun-2001
17-Sep-2001
18-Dec-2001
Input Arguments
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
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
This function supports input Data
that is specified as a tall
column vector, a tall table, or a tall timetable. For more information, see tall
and Tall Arrays.
Version History
Introduced before R2006aThe Data
input accepts negative prices.
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)