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/

    The reason for broker.get_value() is 'nan'

    General Discussion
    1
    1
    18
    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.
    • Demeen Ma
      Demeen Ma last edited by

      version:
      Backtrader 1.9.76.123

      I think it should redesign the logic of this part of the code:

      The logic of calculating value in the program is independent.
      After the next(), the code jump to cerebro.py line 1688 self._brokernotify().
      And than, jump to line 1355 def _brokernotify(self).
      And than, jump to file brokers/bbroker.py & line 1176 def next(self).
      And than, jump to line 422 def _get_value(self, datas=None, lever=False)

      In this function, the program calculates the cash and value. If broker.get_value() is 'nan', debugging the code here can find the cause of the problem.

      Generally speaking, the missing closing price will cause the order price to be 'nan'. Since then, the function get_value() will lose its meaning of existence.

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