Fill Multiple Orders at the Same Time or None

Hi all.
when ordering target amount or value, the order either gets filled completely or remains on the book.
I'm doing a pairs strategy and would like to have both orders filled or none, now the situation is that sometimes only one of the orders gets filled, and I would like them both to fill or both to remain on the order book.
Thank you!

3 responses

Look for 'Sold' in http://quantopian.com/posts/track-orders
At that point:

if o.amount < 0:
# sell its pair
#     or if partial fill, the same value perhaps


Thank you very much!

Hi Blue and all. I don't want to sell after buying, because then I los the commission twice... I'd rather have it give up on a transaction for one pair if it can't find one for the other. Is there anything like that around?