Current Quarter
In dashboards or charts it may be desirable to focus on a single ongoing quarter.
The current_quarter
function uses data from FactSet to determine the ongoing quarter. The ongoing quarter
is a period relative to today, which always starts on an actual fiscal period (afp) start date, and ends on the afp end
date or report publication date, depending on the alignment
argument. When to switch the ongoing quarter from one
quarter to the next is given by the ‘crossover’ argument, which can either be afp
or pd
.
Usage
- current_quarter(alignment='pd', crossover='pd', days_after=0)
Get a constant series which has the value 1 on every day in the current quarter.
- Parameters
alignment – Alignment of the quarter end. Either
pd
(publication date) to get a constant series from fiscal period start to report publication date (inclusive) orafp
(actual fiscal period) to get a constant series from fiscal period start until fiscal period end (inclusive). Default ispd
.crossover – When the current quarter should switch to the next quarter. Either
pd
, to switch the day after the report publication date orafp
to switch the day after the fiscal period end. Note that days_after can be used to add some delay to the crossover. Default ispd
.days_after – Number of days after the crossover for which to still consider the previous quarter as the current quarter. Default is
0
.
Example
Get close price only for days in the current unpublished quarter:
close_price.reindex_like(current_quarter(), fill_method=None)