Questions/comments/improvements/criticisms welcome.
Questions/comments/improvements/criticisms welcome.
Here's a variant. I just changed from equal weights to ranks. I'm not sure if it's any "smarter" or not, and I'm still not clear on the definition of Smart Beta and how one would measure Smart-Beta-ness of an investment portfolio.
def rebalance(context, data):
alpha = pipeline_output('factor_pipeline').sum(axis=1).dropna()
alpha = normalize(pd.Series().append(alpha.nlargest(N_STOCKS)).rank())
objective = opt.TargetWeights(alpha)
order_optimal_portfolio(objective=objective,
constraints=[]
)