Hi,
I completed Boot Camp 103 futures lesson by Jared set the available cash to $10k. I then set the end date past the expiration of the first contract (to 2014-05-01) in order to see a couple of orders go through.
The first trade on 2013-12-20 displays $10,000 correctly as remaining margin with the self.Portfolio.MarginRemaining method but for some strange reason the available margin jumps to $56,363 after the first trade is liquidated automatically on 2014-02-27, so I get successive margin calls.
Why is the margin wrong and does it have to do with the automatic delisting liquidation? I don't think it is a bug.
Here is the log output where I'm printing the remaining margin before the market order:
2013-12-20 00:00:00 : Launching analysis for 9bf5f7007929551d137abbf06a2b3f3e with LEAN Engine v2.5.0.0.13573
2013-12-20 02:07:00 : 2013-12-20 02:07:00 NEW CONTRACT Symbol:GC VOFJUCDY9XNH Expiry:2014-02-26 00:00:00 LastPrice:1192.80 OpenInterest:246184 Multiplier:100 MarginReq:$7,975 RemMargin:$10,000
2013-12-20 02:07:00 : 2013-12-20 02:07:00 InitialMargin:7975.0 Contracts:1.0 RemMargin:2736.3
2014-02-27 00:00:00 : 2014-02-27 00:00:00 NEW CONTRACT Symbol:GC VQ3M41P8XYFX Expiry:2014-04-28 00:00:00 LastPrice:1327.70 OpenInterest:235111 Multiplier:100 MarginReq:$7,975 RemMargin:$56,363
Cheers,
Andres
Fred Painchaud
Hi Andres,
Can't the augmented remaining margin come from liquidation of the contract with capital gain?
Fred
Andres Arizpe
Hi Fred,
No, I'm only trading one contract because I set the available cash to $10,000 and the margin requirement on Futures.Metals.Gold is $7,975 so and the gain is only $463.65.
After the first trade, the self.Portfolio.MarginRemaining seems to increase $56,363 for every contract I trade. Pretty weird I must say.
Cheers,
AA
Andres Arizpe
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!