Hi QuantConnect team, I was playing around with a Pairs Trading strategy available in the Strategy Library and in one backtest the capacity turned out to be less than 1 cent!!! The strategy is not trading the most liquid assets but I think there is something wrong with the calculations. Would you mind looking into it?
Link to the strategy: https://www.quantconnect.com/tutorials/strategy-library/pairs-trading-with-country-etfs
PokerWinner
Continuation.
I spent a bit more time on this and I found a number of interesting cases.
I am simply buying 10 SPY at tick resolution, it is then claimed that this strategy has $0 capacity
PokerWinner
The next two backtests at seconds resolution show that
and
yield very different capacities. Observe how orders are placed at the same price
$374.142332375552 USDand at the same time
2021-01-04 09:30:01I do not expect returns, Sharpe ratio, and other statistics to be the same, however, capacity should not change because regardless of whether I buy 10 SPY once or 1 SPY ten times I end up with 10 SPY.
PokerWinner
Second backtest. I would have used tick resolution but that yields $0 capacity regardless.
PokerWinner
ignore this. cannot delete post for some reason
Louis Szeto
Hi Pietro
As per my understanding, the capcity at that moment is caculated by the sum of 20% * Bar Volume / ( your order value / your whole account value ) for each order. So your bar resolution and order size do matter to your capacity.
For the first algorithm, ADRU is indeed a very illiquid asset, only around 50k dollar volume on average for whole day, even less on seperate bars. There exists some time with very low volume when your trades executed with some illquid assets also. So the capacity is low for a reason.
For the second algorithm, maybe the single tick that your trade simulated is really like trade only 1 share, so the capacity is 0.
So my suggestion would be widening the resolution into minute or hour, excluding illquid equities by coarse universe selection or your manual selection process, using an execution model that is volume-oriented as well as check on spread.
Cheers
Louis
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.
Louis Szeto
Also I missed one point, your order value = your order size * Ask price (long) or Bid price (short). So if the spread is extreme (like $0.1 vs $9999999), which is very likely for illiquid stocks as we always see market makers usually aren't placing their actual desire price on deck but fill up only when orders come in in actual cases, your order value will also become extreme and dragging the capacity.
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.
Asdas
Hi Louis,
I am also confused by this metric. Am I right to assume that tick resolution has no volume, in which case, does mean that ALL strategies at tick resolution have $0 capacity? This seems like a strange metric to use.
Furthermore, can you explain the difference in the capacities
and
20% * Bar Volume / ( your order value / your whole account value )
This formula suggests that buying 1 SPY shares 10 times would produce a higher capacity, however this not what I observe.
Best,
Asdas
Louis Szeto
Hi Asdas
Please if any staff could point out if this is valid.
Cheers
Louis
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.
Asdas
Hi Louis,
Thank you for your responses. Genuinely appreciated!
I am still confused.
Help from staff would be very welcomed.
Best,
Asdas
Vladimir
Pietro Petitti,
The Major mistake is not in QC Capacity calculations but in your code which has
Compounding Annual Return 0.769% and Drawdown 35.000%.
If you will use simple Buy and Hold SPY strategy you will get at different resolution
Estimated Strategy Capacity
Daily $1100000000.00
Hour $120000000.00
Minute $89000000.00
Second, $380000000.00
Second, VWAP $380000000.00
Tick, VWAP $380000000.00
PokerWinner
Asdas
Hi Vlad
I agree that lower resolution has lower capacity, however, I do not understand why buying 10 SPY once has higher capacity than buying 1 SPY ten times (at the same resolution), $5.2 Billion vs $120 Million.
Fill price, bar volume stay the same (according to the info tab), and the only thing at changes is the order value. Can you explain this please?
Best
Asdas
Jared Broad
Thanks for the feedback. There is a discount applied for “fast trading” to reduce the capacity of HFT strategies. This should only be applied when the direction “changes” (buy to sell) not repeated buy orders. We'll review and see if there's a good way to make it possible.
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.
Asdas
Hey Jared, Louis mentioned a formula to compute the capacity in a comment. Can you confirm it?
Jared Broad
We'll write up a blog/documentation piece on it soon, but for now please answer these questions with a detailed understanding based on the underlying source code. I can't provide a simple Yes-No answer - capacity is more like an art than a science and we made an intelligent stab based on our best abilities and then open-sourced the work.
CapacityEstimate.cs
SymbolCapacity.cs
I welcome informed debate and review of the source, without being informed is not constructive. We made these capacity estimates to help value alphas in the marketplace, and ensure investors were not diluted as alphas scaled. We'll continue improving the estimates over time.
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.
PokerWinner
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!