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/

    Order fill and size 0

    General Code/Help
    1
    2
    531
    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.
    • D
      dasch last edited by dasch

      When filling an order which has a size for example of 1 with -1 will generate an division by zero Exception

       File "../../libs/backtrader/order.py", line 199, in addbit
         self.price = (oldvalue + newvalue) / self.size
      ZeroDivisionError: float division by zero
      

      i am trying to update exisiting orders when creating new orders. I am using oanda. When sending a new order, this may affect existing trades (tradesClosed, tradeReduced). Everything is working except setting the order to a size of zero, when it gets closed.

      Is this a bug in backtrader or should i close trades in a different way?

      1 Reply Last reply Reply Quote 0
      • D
        dasch last edited by

        Nevermind, it was some obscure error in my code.

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