For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
Most elegant way to access Strategy Object from Cerebro
-
Hi,
I've been using BT for a week now, must say I'm enjoying using it compared to other platforms I've tried.
How should I access the strategy object from Cerebro?
I've looked through the source code but cannot find any methods to do so.
I've been usingc=bt.Cerebro() c.add.. data and strategy (..etc etc..) c.run() # To access the Strategy object c.runstrats[0][0]. # I can now get to Strategy object I just added..
Or should there be no reason why I need to access individual Strategy object?
Thanks -
Cerebro.run
does actually return the final strategies. The returned value is different depending on whether you optimized or not.It is documented under: Docs - Cerebro
- For No Optimization: a list contanining instances of the Strategy classes added with addstrategy
- For Optimization: a list of lists which contain instances of the Strategy classes added with addstrategy
-
Ahh.. that makes total sense.. surprised I missed in the docs, I was looking in different places for e.g. 'get_strategy()'.. e.t.c.
Your quick replies are really appreciated and help with speedy development.