For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
data class autoregister
-
hi
I dont understand how DataCls is autoregistered in backtrader.stores.IBStore.
The code in backtrader.stores.ibstore:class IBStore(with_metaclass(metasingleton,object)): ####### DataCls = None # DataCls will autoregister? @classmethed def getdata(##): return cls.DataCls(###)
When I create a Singleton of class IBStore by
store = backtrader.stores.IBStore(####)
and then I can get a ibdata instance by calling the store's method as your doc explained:
data = store.getdata(####)
so how it is done?
-
Because the data feed
IBData
registers itself in the store overwritingDataCls
. This would allow anyone to write a different version ofIBData
(call itMyIBData
), which would again overwrite the value ofDataCls
in the store.And consequently,
getdata
would return an instance ofMyIBData