API reference
TimeFrames.TimeFrame — Type
TimeFrame(frequency::AbstractString; boundary=TimeFrames.UndefBoundary, firstdayofweek=nothing)
TimeFrame(period::Dates.Period; boundary=Begin)
TimeFrame(grouper::Function)
TimeFrame()Construct a time bucket from a frequency, a Dates period, or a custom grouping function. An empty string or no argument creates an identity frame.
Supported frequency units are A, AS, M, MS, W, D, H, T (or MIN), S, L (or lowercase ms), U (or US), and N (or NS). Units are case insensitive except that ms means milliseconds and MS means month start. Units may have a positive integer prefix. A and M default to End; other units default to Begin. Invalid strings throw ArgumentError. Business-month aliases BM and BMS exclude weekends, but not holidays. Weekly frames accept firstdayofweek from 1 (Monday) to 7 (Sunday).
TimeFrames.Boundary — Type
BoundaryTime bucket boundary policy, an alias for TimeFrames.BoundaryPolicy.T. Begin uses the start of a bucket; End uses the ceiling boundary minus one day for Date or one millisecond for DateTime.
TimeFrames.Begin — Constant
Select the beginning of a time bucket using Dates rounding.
TimeFrames.End — Constant
Select the ceiling boundary minus the input type's smallest step.
TimeFrames.NoTimeFrame — Type
An identity frame returned by TimeFrame() or TimeFrame("").
TimeFrames.YearBegin — Type
YearBegin(n=1) constructs a beginning-boundary frame of n years.
TimeFrames.YearEnd — Type
YearEnd(n=1) constructs an end-boundary frame of n years.
TimeFrames.MonthBegin — Type
MonthBegin(n=1) constructs a beginning-boundary frame of n months.
TimeFrames.MonthEnd — Type
MonthEnd(n=1) constructs an end-boundary frame of n months.
TimeFrames.BusinessMonthBegin — Type
BusinessMonthBegin(n=1)Group by the first weekday of each month bucket. Weekends are Saturday and Sunday; public holidays are not excluded.
TimeFrames.BusinessMonthEnd — Type
BusinessMonthEnd(n=1)Group by the last weekday of each month bucket. Weekends are Saturday and Sunday; public holidays are not excluded.
TimeFrames.apply — Function
apply(tf::TimeFrame, dt)Return the bucket boundary for dt. Beginning frames round down; end frames round up and subtract the input type's smallest supported step. Identity frames return dt unchanged. Custom frames call their grouping function.
TimeFrames.date_range — Function
date_range(start::T, tf::AbstractPeriodFrame, stop::T; normalize=false)Return a vector of time values in the inclusive interval start to stop. Month, year, week, business-month, and end-boundary frames align to bucket labels. Other frames preserve the start's offset unless normalize=true. DateTime end labels include the day's final millisecond. This is a bucket API, not a complete implementation of pandas offsets or holiday calendars.
TimeFrames.tonext — Function
TimeFrames.tonext(tf::AbstractPeriodFrame, dt::Dates.TimeType; same=false)Return the next bucket label after dt. Set same=true to include an existing label equal to dt. Calendar boundaries are recomputed for each bucket, so month ends do not drift. Use this qualified name to distinguish Dates.tonext.
Base.range — Method
range(start::Dates.TimeType, tf::AbstractPeriodFrame, stop::Dates.TimeType; apply_tf=true)
range(start::Dates.TimeType, tf::AbstractPeriodFrame, length::Integer)
range(tf::AbstractPeriodFrame, stop::Dates.TimeType, length::Integer)
range(start::Dates.TimeType, tf::AbstractPeriodFrame; stop, length, apply_tf=true)Construct a range with the frame's period as step. The two-endpoint form excludes stop and rounds endpoints by default. Set apply_tf=false to retain the starting offset. Length-based forms retain offsets; the backwards form excludes stop. The keyword form requires exactly one of stop or length. Its stop is inclusive and calendar frames align to bucket labels through date_range. Set apply_tf=false to use an inclusive Dates range without alignment.
TimeFrames.@tf_str — Macro
tf"15T" constructs a frame using the same syntax as TimeFrame("15T").