Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    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?

    General Code/Help
    1
    2
    89
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      kav last edited by

      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?

      1 Reply Last reply Reply Quote 0
      • K
        kav last edited by

        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?

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors