I read the code about backtrader/utils/autodict/AutoDict,but find something maybe wrong...
tianjixuetu last edited by
class AutoDict(dict): _closed = False def _close(self): self._closed = True for key, val in self.items(): if isinstance(val, (AutoDict, AutoOrderedDict)): val._close() def _open(self): self._closed = False def __missing__(self, key): if self._closed: raise KeyError value = self[key] = AutoDict() return value def __getattr__(self, key): if False and key.startswith('_'): raise AttributeError return self[key] def __setattr__(self, key, value): if False and key.startswith('_'): self.__dict__[key] = value return self[key] = value
your code about : if False and some_code: do something
I think ,it will never run do something.
mybe you just want write this code.
mybe,you should replace "False" with "self._closed", I guess.
I have used backtrader for more than one year to backtest my strategy, I also find many errors, so,I have to read the source code,to understand backtrader's framework and details.
Anyway, thank you！
It's code that was tested for development and considered, was left there but nullified.
I also find many errors
Which you of course duly reported.