famafrench.FamaFrench.getNumFirms¶
-
FamaFrench.
getNumFirms
(self, factorsBool, dt_start, dt_end, *args)[source]¶ Construct dataset w/ number of firms in each portfolio at a given frequency and for a given sample period.
- Parameters
factorsBool (bool) – Flag for choosing whether to construct Fama-French-style factors or not.
dt_start (datetime.date) – Starting date for the dataset queried or locally retrieved.
dt_end (datetime.date) – Ending date for the dataset queried or locally retrieved.
pDim (list, int, [optional]) – Dimensions for sorting on each element in the list
self.sortCharacsId
.
- Returns
portNFirmsTable – Dataset w/ number of firms in each portfolio observed at frequency
self.freqType
over sample period fromdt_start
todt_end
for a given portfolio sorting strategy.- Return type
Note
If
factorsBool = True
, then the number of firms for the following anomaly/risk-based factors is defined as follows:MKT
: total number of firms (each period) in the market portfolio.SMB
,HML
,RMW
,RMWc
,CMA
,MOM
,ST_Rev
,LT_Rev
: total number of firms (each period) in all portfolios used to construct the factors.
Note
Portfolios require anomaly characteristics from the last fiscal year. To get non-missing observations starting on date
dt_start
, we construct portfolios using a startdate that is two/three years prior todt_start
. We then slice the resulting pandas.DataFrames starting w/dt_start
.