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'
-
version:
Backtrader 1.9.76.123I think it should redesign the logic of this part of the code:
The logic of calculating value in the program is independent.
After thenext()
, the code jump to cerebro.py line 1688self._brokernotify()
.
And than, jump to line 1355def _brokernotify(self)
.
And than, jump to file brokers/bbroker.py & line 1176def next(self)
.
And than, jump to line 422def _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.