Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Question on the optimize api

Hi,

I am just wondering a bit how the optimize api works when one use maximize_alpha as objective.

How it decide to short or long a given asset? Does it depend on the sign of the alpha, I mean negative alpha-> short, positive alpha -> long?

Then a second question, I see that most of my weight are very close to the PositionConcentration constrain I set, so how the weights are computed?

Thanks in advance.

1 response

Hi David,

Regarding maximize_alpha, the sign shouldn't matter, only the value in relation to the other values in the series. The values could be all negative or all positive, but the Optimize API would still short the bottom values and long the top values. Have a look at the details in the documentation:

MaximizeAlpha is used by algorithms that try to predict expected
returns. MaximizeAlpha takes a Series mapping assets to “alpha” values
for each asset, and it finds an array of new portfolio weights that
maximizes the sum of each asset’s weight times its alpha value.

As for Position Concentration, if you're using maximize_alpha, the optimizer will assign more weight to stocks with higher/lower alpha value score for longs/shorts respectively.

class MaximizeAlpha(alphas) Objective that maximizes
weights.dot(alphas) for an alpha vector.

Ideally, alphas should contain coefficients such that alphas[asset] is
proportional to the expected return of asset for the time horizon over
which the target portfolio will be held.

In the special case that alphas is an estimate of expected returns for
each asset, this objective simply maximizes the expected return of the
total portfolio.

Parameters: alphas (pd.Series[Asset -> float] or dict[Asset -> float])
– Map from assets to alpha coefficients for those assets. Notes

This objective should almost always be used with a MaxGrossExposure
constraint, and should usually be used with a PositionConcentration
constraint.

Without a constraint on gross exposure, this objective will raise an
error attempting to allocate an unbounded amount of capital to every
asset with a nonzero alpha.

Without a constraint on individual position size, this objective will
allocate all of its capital in the single asset with the largest
expected return.

That's my understanding at least. :)