famafrench.FamaFrench.getCrspDailyRollVar¶
-
FamaFrench.
getCrspDailyRollVar
(self, roll_window, min_periods, freq, dt_start, dt_end)[source]¶ Calculate rolling daily variance of stock returns for all CRSP stocks queried from wrds-cloud.
- Parameters
roll_window (int) – Fixed size of the rolling (moving) window. This is the number of observations used for calculating the realized daily variance. Similar to parameter
window
in pandas methodpandas.DataFrame.rolling()
.min_periods (int) – Minimum number of observations in each window necessary to have an estimated value. Similar to parameter
min_periods
in pandas methodpandas.DataFrame.rolling()
.freq (str) –
Observation frequency. 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.
- Returns
dfcrsprollvar – Dataset w/ panel of rolling daily variances calculated using
roll_window
days of lagged returns (w/ minimum ofmin_periods
days).- Return type
Note
For a short description of how Fama and French construct portfolios formed on the variance of daily returns, see Detail for Portfolios Formed Monthly on Variance.
Note
Depending on a user’s WRDS subscription, data variables will be queried from the most frequently updated CRSP datafiles. CRSP offers monthly, quarterly, and annually updated files for daily observations. The default datafiles are updated annually. See wrds-cloud SAS Library Names below:
crspm
: dataset CRSP Monthly Updatecrspq
: dataset CRSP Quarterly Updatecrspa
: default dataset CRSP Annual Update