Hello there, I'm confused about quite a few things with how QuantConnect deals with futures. I've attached an example algorithm that's buying the the highest open interest ES Mini S&P 500 Future, with daily rebalancing.

  • What is SetHoldings doing? Here I'm setting it to a constant 0.1, however you can see in the Exposure graph that the exposure is close to 2. 
    • Why is exposure hovering near 2? S&P EMini are 50x leveraged exposure to the S&P index, so with a 0.1 argument to SetHoldings, I'd expect a position with net 5x leveraged exposure to the S&P index. So an exposure hovering near 5 would make sense to me
    • Why is there so much variance in exposure? I'd expect a little bit due to overnight swings in value of positions, but I'm having a hard time explaining why exposure isn't much closer to being a straight horizontal line. 
  • How is order size being computed? The first order was placed for 201 contracts at a price of $2,687.50. This represents exposure to the underlying index of 201 * 2,687.50 * 50 = $27M
    • $27M is 2.7x our margin at the time, which is close to what I'm seeing in the Exposure graph which makes me think exposure is “Exposure to underlying ÷ net portfolio value” — however not connecting the dots to how 0.1 SetHoldings got us here.

 

Separately two general questions about futures that I couldn't see the answers to:

  • I know that S&P EMini is 50x leveraged to underlying index, because I googled it… is there anyway to get this 50x value in the programming environment? Not seeing it in the docs, but obviously you need to know this value to compute P&L
  • Futures have a margin requirement that is not necessarily equal to the contract value, like right now Sept /ES is $4,479.75 but has a entry margin requirement of $6,600 and maintenance requirement of $6,000 per contract — are these values available in programming environment? I'd imagine you need them to accurately model margin calls, but not seeing them in the docs.