Can you please explain how are following metrics calculated in report:
- Asset Allocation
- Rolling Portfolio Beta (6 Months)
- Leverage
- Long-Short Exposure
I have successfully replicated other graphs. But I can't figure out how do you calculate above variables from backtest json object?
Mislav Sagovac
I don't know why I don't see the answer here I got on e-mail:
Hi Mislav
Metrics are logged during the course of the backtest.
2. daily return of yur portfolio and benchmark return series are logged in a given length to run for their correlation, then multiply by your portfolio's standard deviation / benchmark's standard deviation for same length to obtain a rolling beta series. Please refer to this code.
3. sum(self.Portfolio[symbol].AbsoluteHoldingsValue of all symbol) / self.Portfolio.TotalPortfolioValue as time series
4. Its calcaulation is similar to 1., but logging as time-series-tuple consists of long/short direction separately without averaging.
Best,
Louis Szeto
Reffering to 2 and linked code, I don't understand why do you compare returns of the strategy and cumulative returns of the banchmark? I don't use C#, but it seems to me that this code do just that:
Louis Szeto
Hi Mislav
The equity curve one is not return, but percent change. They're basically the same measurement but the benchmark one is using .CumulativeReturns() as it is the divisor, so we want to make sure it is not indivisible (code).
Best
Louis Szeto
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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Mislav Sagovac
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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!