We will use over 50 features that cover a broad range of factors based on market, fundamental, and alternative data. The notebook also includes custom transformations to convert fundamental data that is typically available in quarterly reporting frequency to rolling annual totals or averages to avoid excessive season fluctuations.
Once the factors have been computed through the various pipelines outlined in Chapter 4, Alpha Factors Research, we combine them using pd.concat(), assign index names, and create a categorical variable that identifies the asset for each data point:
data = pd.concat([returns, value_factors, momentum_factors,
quality_factors, payout_factors, growth_factors,
efficiency_factors, risk_factors], axis=1).sortlevel()
data.index.names = ['date', 'asset']
data['stock'] = data.index.get_level_values('asset').map(lambda x: x.asset_name)