famafrench.FamaFrench.kfLibrary¶
-
FamaFrench.kfLibrary(self, kfType, kfFreq, dt_start, dt_end, *args, printkfName=False)[source]¶ Generalized routine used to query datasets from Ken French’s online library at a given frequency and for a given sample period. See subroutines for more details.
- Parameters
kfType (str) –
Dataset type to query. Possible choices are:
ReturnsFactorsNumFirmsCharacs
kfFreq (str) –
Observation frequency of the portfolios. Possible choices are:
D: dailyW: weeklyM: monthlyQ: quarterly (3-months)A: annual
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.
kfDim (list, int, [optional]) – Dimensions for sorting on each element in the list
self.sortCharacsId.kfRetType (str, [optional]) –
Weighting-scheme for portfolios. Possible choices are:
vw: value-weightsew: equal-weights
printkfName (bool) – Flag for choosing whether to print or not print the specific name of Ken French’s data filename.
- Returns
dfkf – Cleaned dataset queried from Ken French’s online library containing Fama-French-style factors, portfolio returns, number of firms in each portfolio, or average anomaly portfolio characteristics observed at frequency
kfFreqover sample period fromdt_starttodt_endfor a given portfolio sorting strategy.- Return type