Back to Community
Re calibrating portfolio ?

Hi guys,

Reference from the tutorials:

Many trading algorithms have the following structure:
(1)For each asset in a known (large) set, compute N scalar values for the asset based on a trailing window of data.

(2)Select a smaller tradeable set of assets based on the values
computed in (1).

(3)Calculate desired portfolio weights on the set of assets selected
in (2).

(4)Place orders to move the algorithm’s current portfolio allocations
to the desired weights computed in (3).

First of all I'll come out and say I'm new to this :).
I have difficulty understanding the concept of calibrating your portfolio which happens at "every" step sort to speak?

So let's say I'm going long in stock L1 and L2 and short in stock S3 and S4, which is my current portfolio.
The algorithm spots 3 new potential investments, how does it go from there?

It invests in all of them?
I assume not as the idea of the portfolio is to keep all your money in it, so it has to potentially go out of a position early?
At that point it checks then which of your current positions has the "least potential" to still make more money?

It does something in the line of: For all current investments compare expected expected returns vs expected return new assets.
And then swap out the one where the "new" investment has the biggest delta for?

Ofc taking into account transaction costs etc.

Thanks in advance! :)

1 response

First off Welcome! Excellent question(s) and observations.

I'll add a few comments to the statement:

It [the algo] does something in the line of: For all current investments compare expected returns vs expected return new assets.
And then swap out the one where the "new" investment has the biggest delta for?

This works for simple portfolios where there is a single objective (eg maximize returns) and a minimal number of constraints (maybe just keep leverage ~1). However, large portfolios and certainly the Quantopian fund have many constraints. These are pretty well encapsulated in the contest overview / criteria (, but typically include keeping a number of metrics with given ranges:

  • leverage
  • long/short exposure
  • long / short exposure within each sector
  • sector exposure
  • momentum exposure
  • market cap exposure
  • position concentration
  • turnover

The complexity of meeting all these constraints, while maximizing expected return, is typically handled with mathematical optimization techniques. Trying to code procedural or heuristic rules or processes to ensure constraints are met would be daunting. Without constraints the process could be rather binary. Sell the losers and buy the winners. However, with constraints, the process becomes much less discrete. More in line with sell some of the losers and buy some of the winners. For this reason the problem is often framed as "calculate desired portfolio weights" and "move the algorithm’s to the desired weight".

So yes, fundamentally an algorithm compares expected returns of current assets vs expected returns of new assets and places trades to maximize those expected returns. However, it's the myriad of constraints which cause the language to shift from 'open and close' positions to 'desired weight' within the portfolio.


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.