I'm very new to the platform and this is a pretty basic question but I can't seem to find a straightforward answer anywhere. Is it possible to switch which securities are long and short using alphalens? Lets say I had a factor similar to the size factor where I want to go long low values and short high values. How do I construct that in alphalens. I've started with these lines from the tutorial:
factor_data = al.utils.get_clean_factor_and_forward_returns(factor=size['mcap'],prices=asset_prices,quantiles=5, periods=(10,25,75),)
Display first 5 rows
factor_data.head(5)
mean_return_by_q, std_err_by_q = al.performance.mean_return_by_quantile(factor_data)
# Plot mean returns by quantile and holding period
# over evaluation time range
al.plotting.plot_quantile_returns_bar(
mean_return_by_q.apply(al.utils.rate_of_return, axis=0, args=('1D',) ) );
ls_factor_returns = al.performance.factor_returns(factor_data)
al.plotting.plot_cumulative_returns(ls_factor_returns['75D'], '75D')