asFreq#
- swordfish.function.asFreq()#
Convert X to specified frequency.
- Parameters:
X (Constant) – An indexed matrix or indexed series. The index must be of temporal type.
rule –
A string that can take the following values:
Value of rule
Corresponding DolphinDB function
B
businessDay
W
weekEnd
WOM
weekOfMonth
LWOM
lastWeekOfMonth
M
monthEnd
MS
monthBegin
BM
businessMonthEnd
BMS
businessMonthBegin
SM
semiMonthEnd
SMS
semiMonthBegin
Q
quarterEnd
QS
quarterBegin
BQ
businessQuarterEnd
BQS
businessQuarterBegin
REQ
FY5253Quarter
A
yearEnd
AS
yearBegin
BA
businessYearEnd
BAS
businessYearBegin
RE
FY5253
D
date
H
hourOfDay
min
minuteOfHour
S
secondOfMinute
L
millisecond
U
microsecond
N
nanosecond
SA
semiannualEnd
SAS
semiannualBegin
- closedConstant, optional
A string indicating which boundary of the interval is closed, by default DFLT.
The default value is ‘left’ for all values of rule except for ‘M’, ‘A’, ‘Q’, ‘BM’, ‘BA’, ‘BQ’, and ‘W’ which all have a default of ‘right’.
The default is ‘right’ if origin is ‘end’ or ‘end_day’.
- labelConstant, optional
A string indicating which boundary is used to label the interval, by default DFLT.
The default value is ‘left’ for all values of rule except for ‘M’, ‘A’, ‘Q’, ‘BM’, ‘BA’, ‘BQ’, and ‘W’ which all have a default of ‘right’.
The default is ‘right’ if origin is ‘end’ or ‘end_day’.
- originConstant, optional
A string or a scalar of the same data type as X indicating the timestamp where the intervals start, by default DFLT. It can be ‘epoch’, start’, ‘start_day’, ‘end’, ‘end_day’ or a user-defined time object. The default value is ‘start_day’.
‘epoch’: origin is 1970-01-01
‘start’: origin is the first value of the timeseries
‘start_day’: origin is 00:00 of the first day of the timeseries
‘end’: origin is the last value of the timeseries
‘end_day’: origin is 24:00 of the last day of the timeseries