Back to Community
How can opt.FactorExposure possibly limit beta exposure?

Is the Optimize Api open source? I haven't found it. Also I couldn't interpret what's on the help page. So asking here:

opt.FactorExposure(loadings=context.pipe[['beta']],min_exposures={'beta':-MAX_BETA}, max_exposures={'beta':MAX_BETA})

How does this determine that in the factor-ranked list stock A hits the exposure limit, but the next-best stock B won't?
Doesn't it need a time window to determine "exposure" between two time series? How large is that window?

Since we don't know the forward daily return of SPY (no peeping into the future), there is no way to determine for the next day that stock A will indeed breach the limit but B won't.

2 responses

Hi Attila,

That's a good question. Ultimately, you have to define the values for "exposure" that should be passed to FactorExposure. In the example you pasted, context.pipe[['beta']] is likely a column from a pipeline output. SimpleBeta is a built-in factor that you can use to compute historical beta. That said, you make a valid point that there isn't really any way to guarantee low portfolio beta in the future simply by adding a constraint to the optimizer that is based on historical beta values. This lesson of the Contest Tutorial cautions against relying on past betas. Generally speaking, you are probably better off looking for an alpha factor that is inherently market neutral (and that you expect to stay market neutral in the future). I don't really have a single of line of code to help you with that, but it's worth noting that you are probably better off trying to address exposure concerns when researching your alpha factor as opposed to trying to constrain your portfolio in the optimizer later on.

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.

Understood, thank you!

Yes okay, it's now kind of obvious that simply adding factor constraints in the optimizer doesn't automagically help with not hitting exposure limits in the backtest evaluation (where factors don't lag)