[R-SIG-Finance] IBrokers : quotes from futures combo and reqIds (omerle)

Lloyd Spencer lloyd.b.spencer at gmail.com
Thu Jul 26 16:13:26 CEST 2012


First time posting a reply so apologies in advance if this is the wrong way
to do it / format etc.  Regarding futures combos, I trade calendar spreads
on commodity futures and finally got this working on IB with the plan to
migrate to this platform.  It is possible to get quotes for the exchange
traded spread trade (as opposed to the combination of the two outrights).
However you have to play around with the exchange parameters you send on
each leg of the combo trade.  In my case for example with NG spreads on
NYMEX/Globex I have to use Exchange="NYMEX" on both the individual comboLegs
as well as the spread itself.

Here is my code in C# (I am using the Krs.Ats.IBNet.dll).  First I get the
set of all underlying contracts and then here I create the spreads:

ComboLeg leg1 = new ComboLeg(allContracts[ii].ContractId, 1, ActionSide.Buy,
"NYMEX", ComboOpenClose.Unknown, ShortSaleSlot.Unapplicable, "");
ComboLeg leg2 = new ComboLeg(allContracts[jj].ContractId, 1,
ActionSide.Sell, "NYMEX", ComboOpenClose.Unknown,
ShortSaleSlot.Unapplicable, "");
Contract spread = new Contract();
spread.Symbol = "NG";
spread.Exchange = "NYMEX";
spread.Currency = "USD";
spread.SecIdType = SecurityIdType.None;
spread.SecurityType = SecurityType.Bag;

This works, it gets market data for the correct exchange traded spread
contract rather than the "combo" of the two underlyings.  I have cross
checked it all against my other futures trading platform, which is better
than IB but more expensive of course.

I think this means I will pay more in brokerage since the spreads are
directed rather than "SMART" (with an emphasis on the "")... but it is much
cheaper than paying 10 more ticks trading the two outrights!

Let me know if this helps.

Lloyd Spencer.

Lloyd.spencer at kahutrading.com

More information about the R-SIG-Finance mailing list