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.
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.
Is there any way to disable the margin calls feature?
For example, I have enconutered a situation when I am getting margin calls because of the bad data. In this situation it would be easier just to disable the feature instead of working around the bad data,
A specific example - reverse split adjusted prices are not always correct
Found this
Securities["XIV"].SetLeverage(1m);
We can disable margin calls by setting the margin call model to the NullMarginCallModel.
This can easily be done like this:
Securities["XIV"].MarginModel = MarginCallModel.Null;
Thanks
Securities["XIV"].MarginModel = MarginCallModel.Null;
This no longer seems to work. This returns an error saying you can't implicitly convert type IMarginCallModel to ISecurityMarginModel. Is there another way to disable margin calls?
Please try to disable margin calls at Portfolio level using:
// In Initialize
Portfolio.MarginCallModel = MarginCallModel.Null;
Are the MarginCallModel.Null overrides still applicable? Maybe I need a Python version of the code.
I've tried
Securities["XIV"].MarginModel = MarginCallModel.Null
and
Portfolio.MarginCallModel = MarginCallModel.Null
Both return errors, "global name 'Securities' is not defined" and "global name 'Portfolio' is not defined" respectively.
Thanks to anyone who can help me eliminate the Quantconnect 2x leverage limit. QC team, may I humbly suggest this should only apply to backtests, not live trading.
Did you not forget self. before both Securities and Portfolio?
Algo doesn't allow > 2x leverage with
self.Portfolio.MarginModel = MarginCallModel.Null
or
self.Portfolio.MarginModel = PatternDayTradingMarginModel()
The goal is to set 4x leverage intraday like a normal brokerage account... and ideally override QC limits completely to trade a portfolio margin account. Thanks!
From Docs:
self.Securities["AAPL"].MarginModel = PatternDayTradingMarginModel()
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.
Thanks guys! Both MarginCallModel.Null and PatternDayTradingMarginModel() working now. Had reversed them, and placed too early in the code sequence. Posted in backtest below for others. In list form looks like this:
# Add securities and indicators
self.bonds = ["SHY","IEF"]
for s in self.bonds:
self.AddEquity(s, Resolution.Minute)
self.Securities[s].MarginModel = PatternDayTradingMarginModel()
Can I relax overnight leverage constraints beyond 2x? A Portfolio Margin account (next level up from Reg-T) at IB and other prime brokers will allow more than 2x leverage, especially if you're holding bonds and forex, both of which have low volatility.
It would be great to have a way to opt out of QC leverage constraints, especially for live trading.
Hi Brett, the default is IB's 2x margin accounts. If you want 4x intraday margin limits, you can use the PatternDayTradingMarginModel, This documentation explains the margin model in greater details.
You can also set the leverage for each stock with self.Securities[symbol].SetLeverage()
Please see this example
https://github.com/QuantConnect/Lean/blob/master/Algorithm.Python/MarginCallEventsAlgorithm.py
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!