Question #6:
This is more of an engineering question. I'm looking to place "combo" option orders, or "multi-leg" orders. Basically, you pay less commission for up to four simultaneous option orders. Below is an example of a two-leg order:
<FIXML xmlns="http://www.fixprotocol.org/FIXML-5-0-SP2">
<NewOrdMleg TmInForce="0" Px="-3.10" OrdTyp="2" Acct="12345678">
<Ord OrdQty="4" PosEfct="O">
<Leg Side="1" Strk="190" Mat="2014-01-18T00:00:00.000-05:00" MMY="201401" SecTyp="OPT" CFI="OC" Sym="IBM"/>
</Ord>
<Ord OrdQty="4" PosEfct="O">
<Leg Side="2" Strk="200" Mat="2014-01-18T00:00:00.000-05:00" MMY="201401" SecTyp="OPT" CFI="OC" Sym="IBM"/>
</Ord>
</NewOrdMleg>
</FIXML>
Here's an example of how I can currently perform a four-leg order from a zorro script:
brokerCommand(SET_COMBO_LEGS,4);
// buy leg 1 <-- plugin saves leg, BrokerBuy returns ID from counter
// buy leg 2 <-- plugin saves leg, BrokerBuy returns ID from counter
// buy leg 3 <-- plugin saves leg, BrokerBuy returns ID from counter
// buy leg 4 <-- plugin executes order, BrokerBuy returns ID from counter or 0 if failure
SET_COMBO_LEGS would be a new BrokerCommand that sets the number of legs in a trade. If it's 2, BC will return 1 and execute on the second trade. 3, return 1, third trade, etc.
The problem with this approach is that I have three legs returning a successful trade, with the last one returning the actual status. If the last one returns a trade failure, then Zorro will think the first three trades were fine.
Is there some way that I can delay the return of the first 1-3 legs until I receive all of the legs and get a response from the server?