Back

Live trading with portfolio margin vs QC's margin model

Hi,

I'm getting ready to take my algorithm live on an IB portfolio margin account. I've setup a backtest which simulates IB's portfolio margin by setting each security's MarginModel to a custom SecurityMarginModel with estimated initial and maintenance margin requirements.

I'm trying to understand how QC's margin model will behave when trading live.

  1. Does Portfolio.MarginRemaining get "Excess Liquidity" from IB or by using QC's model?
  2. If QC's model is in effect when trading live, does that mean that QC will issue margin calls when the broker might not?
  3. Do the OnMarginCall and OnMarginCallWarning methods trigger when trading live?
  4. Does OnMarginCall[Warning] trigger when QC's model determines that margin is low?
  5. Does OnMarginCall[Warning] trigger when the broker determines that margin is low?
  6. Should I use MarginCallModel.Null when trading live to disable QC's margin model?
  7. If I'm using MarginCallModel.Null, is there any way for my algorithm to observe IB's "Excess Liquidity"?
  8. If I'm using MarginCallModel.Null, is there any way for my algorithm to react to margin calls/warnings from IB?

Thanks!

Update Backtest







0

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.


Hi Mirza,

In live-trading, the brokerage model is set to the brokerage used for live deployment, so any brokerage model/settings in the algorithm will be overridden.

  1. It will use margin information from IB
  2. No, see first sentence
  3. Yes, those methods are called
  4. No, see first sentence
  5. It depends on the brokerage
  6. No, see first sentence
  7. The algorithm will automatically use IB’s margin settings/information
  8. The algorithm will automatically use IB’s margin settings/information

Best,
Shile Wen

0

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 for that encouraging info! I signed up for a researcher seat with a live node to try it out. I created an algorithm which just gathers stats from my live (non paper) account using SetRuntimeStatistic() / Debug().

I can see that Portfolio.TotalPortfolioValue and Portfolio.TotalHoldingsValue match what I see on IB's site/app.

When I log Portfolio.MarginRemaining, I see a number that doesn't match IB's "Excess Liquidity".

If I use IB's margin calculator to compare Portfolio Margin vs Reg-T Margin, it looks like QuantConnect is actually showing me Reg-T Margin when I query Portfolio.MarginRemaining, even though my IB account is using Portfolio Margin.

Am I using the wrong API or doing something wrong?

0

Hi Mirza,

Please use the support tab of the IDE to submit the live algorithm logs for support. The full logs will help us diagnose the issue, as it depends heavily on IB and your account.

The Private Support tab is the 5th tab in the IDE’s sidebar. Private support can also be accessed by contacting support@quantconnect.com.

Please see this video for reference on submitting a support request.

Best,
Gahl Goziker

0

Update Backtest





0

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.


Loading...

This discussion is closed