Broker.getvalue() = nan?
-
Hi There,
I have a strange case where when I run a multi-stock strategy which different stocks, after a while the
broker.getvalue()
returnsnan
. Could this be because some stock dataframes (which have additional LINES columns) have no values in the additional LINES colums? Would this cause the broker to error?I don't think any of the data has missing OHLC values, but could that also cause this error?
Thanks!
-
The broker only uses the
close
price to make value calculations. Any other thing in the data feeds is not considered (high
,low
andopen
are used for order execution but not for value calculations) -
@backtrader OK cool - so a missing value would cause the broker to error?
Even if that stock wasn't held at the time (position = 0)?
-
If the definition of missing value is
NaN
, then it will probably set everything toNaN
: Python arithmetic rules. But without any code, data sample, etc ... it's impossible to say what, when, how and why. -
Alright thanks. I filled all NaNs with '0' and issue seems to have resolved
-
I also ran into the the same bizarre situation today. Have you figured out something?