Skip to Main Content Skip to Search
Product Documentation

tosemi - Convert to semiannual

Syntax

newfts = tosemi(oldfts)
newfts = tosemi(oldfts, 'ParameterName', ParameterValue, ...)

Arguments

oldfts

Financial time series object.

Description

newfts = tosemi(oldfts) converts a financial time series of any frequency to a semiannual frequency. The default semiannual days are the last business day of June and December.

newfts = tosemi(oldfts, 'ParameterName', ParameterValue, ...) accepts parameter name/parameter value pairs as input, as specified in the following table.

Parameter Name

Parameter Value

Description

CalcMethod

CumSum

Returns the cumulative sum of the values within each semiannual period. Data for missing dates are given the value 0.

Exact

Returns the exact value at the end-of-period date. No data manipulation occurs.

Nearest

(Default) Returns the values located at the end-of-period date. If there is missing data, Nearest returns the nearest data point preceding the end-of-period date.

SimpAvg

Returns an averaged semiannual value that only takes into account dates with data (nonNaN) within each semiannual period.

v21x

This mode is compatible with previous versions of this function (Version 2.1.x and earlier). It returns an averaged end-of-period value using a previous tosemi algorithm. This algorithm takes into account all dates and data. For dates that do not contain any data, the data is assumed to be 0.

    Note   If you set CalcMethod to v21x, settings for all of the following parameter name/parameter value pairs are not supported.

BusDays

0

Generates a financial time series that ranges from (or between) the first date to the last date in oldfts (includes NYSE nonbusiness days and holidays).

1

(Default) Generates a financial time series that ranges from the first date to the last date in oldfts (excludes NYSE nonbusiness days and holidays and weekends based on AltHolidays and Weekend). If an end-of-quarter date falls on a nonbusiness day or NYSE holiday, returns the last business day of the quarter.

NYSE market closures, holidays, and weekends are observed if AltHolidays and Weekend are not supplied or empty ([]).

DateFilter

Absolute

(Default) Returns all semiannual dates between the start and end dates of oldfts. Some dates may be disregarded if BusDays = 1.

    Note   The default is to create a time series with every date at the specified periodicity, which is with DateFilter = Absolute. If you use DateFilter = Relative, the endpoint effects do not apply since only your data defines which dates will appear in the output time series object.

Relative

Returns only semiannual dates that exist in oldfts. Some dates may be disregarded if BusDays = 1.

ED

0

(Default) The end-of-period date is the last day (or last business day) of the semiannual period.

1 - 31

Specifies a particular end-of-period day. Months that do not contain the specified end-of-period day return the last day of the semiannual period instead (for example, ED = 31 does not exist for February).

EM

1 - 12

End month of the first semiannual period. All subsequent period dates are based on this month. The default end of period months are June (6) and December (12).

EndPtTol

[Begin, End]

Denotes the minimum number of days that constitute an odd semiannual period at the endpoints of the time series (before the first whole period and after the last whole period).

Begin and End must be -1 or any positive integer greater than or equal to 0.

A single value input for EndPtTol is the same as specifying that single value for Begin and End.

-1   Do not include odd period dates and data in calculations.

0    (Default) Include all odd period dates and data in calculations.

n   Number of days (any positive integer) that constitute an odd period. If there are insufficient days for a complete semiannual period, the odd period dates and data are ignored.

The following diagram is a general depiction of the factors involved in the determination of endpoints for this function.

TimeSpec

First

Returns only the observation that occurs at the first (earliest) time for a specific date.

Last

(Default) Returns only the observation that occurs at the last (latest) time for a specific date.

AltHolidays

Vector of dates specifying an alternate set of market closure dates.

-1

Excludes all holidays.

Weekend

Vector of length 7 containing 0's and 1's. The value 1 indicates a weekend day. The first element of this vector corresponds to Sunday. For example, when Saturday and Sunday are weekend days (default) then Weekend = [1 0 0 0 0 0 1].

See Also

convertto | toannual | todaily | tomonthly | toquarterly | toweekly

  


Free Interactive Computational Finance CD

View demos and recorded presentations led by industry experts.

Now On Demand
Network with industry peers and learn the latest applications of the leading software product for computational finance.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS