Unary arithmetic functions
The standard unary functions Abs, Acos, Asin, Atan, Cos, Exp, Logn, Negate, Positive, Round, Sin, Sqrt, and Tan are extended to operate on time series.
Syntax
Function(ts TimeSeries)
returns TimeSeries;
- ts
- The time series to act on.
Description
The resulting time series has the same regularity, calendar, and sequence of time stamps as the input time series. It is derived by applying the function to each element of the input time series.
If there is a variant of the function that operates directly on the input element type, then that variant is applied to each element. Otherwise, the function is applied to each non-time stamp column of the input time series.
Returns
The same type of time series as the input; unless it is cast, then it returns the type of time series to which it is cast.
Example
The following query converts the
daily stock price and volume data into log space:
create table log_stock (stock_id int, data TimeSeries(stock_bar));
insert into log_stock
select stock_id, Logn(stock_data)
from daily_stocks;