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

Bracket orders - am I supposed to only have one open at a time?

  • In the documentation:

    There is code like:

    def next(self):
            if self.orefs:
                return  # pending orders do nothing
    def notify_order(self, order):
            if order.status == order.Completed:
                self.holdstart = len(self)
            if not order.alive() and order.ref in self.orefs:
     self.orefs = [o.ref for o in os]
            else:  # in the market
                if (len(self) - self.holdstart) >= self.p.hold:
                    pass  # do nothing in this case

    I am wondering what the point of all this is? It makes it look like it's not a good idea to have multiple brackets open at a time. I am indeed running into issues with duplicates/bracket orders hanging around. Can someone clarify if I should be using this template of "pending orders do nothing"?

  • @booboothefool
    Indeed with one data there should only be one bracket open. However, when using multiple datas, then you need a dictionary to manage the orders. See the article here and the code at the bottom.

Log in to reply