i have been learning QuantConnect for a week’s now, and came a cross odd behaver attached is the back test with account type Margin, next post all attach the back test with account type Cash, Interactive Brokers as the broker,
all other settings are 100% the same,
but the discrepancy I am seeing is 30 less insight and 15% less return when cash (best i can tell 0% margin being used no short selling)
Ian McDougall
Here is the Cash backtest
Douglas Stridsberg
Hi Ian,
Given that your SetHoldings doesn't depend on anything to do with your account (i.e. it's purely determined by the data, which is obviously identical between the two account types), I would think that your cash backtest should produce some errors/warnings in the logs that can shed light on what's going on.
My best bet is that there are a few orders that don't go through due to lack of margin, and the path dependency then means these failed errors cascade into greater discrepancies between the two backtests.
But, again, please check your logs - I suspect the answer will be in there.
Link Liang
Hi Ian,
We could log more information about order events by following:
public override void OnOrderEvent(OrderEvent orderEvent)
{
Log(orderEvent.ToString());
}
With this logging statement, we can find that for cash account, there are many invalid messages: Invalid Message: Insufficient buying power to complete order. And this is why you see the difference between the two types of accounts.
The fundamental reason is here: for an IB cash account, "Securities settlement generally takes place on the third business day following the sale transaction." You could find more information here. There is a similar post in the community.
Hope it helps.
Ian McDougall
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!