For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

How to check that an order is the parent of a bracket or the child?



  • I place only limit and bracket orders. I would like to know, for outstanding orders which is which.

    • Is this particular order part of a bracket order
      --the sort created by self.buy_bracket(limitprice=14.00, price=13.50, stopprice=13.00)

    and if so, is it child in a bracket or the parent?

    • or a plain vanilla limit order --the sort created by self.sell(exectype = backtrader.Order.Limit, ...--

    what I think should work is the following test:

                        if self.order:
                            for this_order in self.order:
                                if this_order.issell():
                                    if not isinstance(this_order.price, type(None)):
                                       #this is a parent order or a plain vanilla limit, not a child
    

    Can anyone confirm?



  • So just as self.order.issell() tells me whether the order is sell or buy, is there a way to querry self.order to know if it is the children or the parent of a bracket order?


Log in to reply
 

});