Proper way to pass args to next() method
I want following procedure inside next() method to be executed:
def next(): compute some indicators and other <statistic> ...... connect remote server via <socket>, send <statistic> wait for remote to respond with <signal> execute by/sell/hold, based on received <signal>
The question is: how to pass <socket> details , which will be available right before I call cerebro.run()?
Generally, question is about passing to .next() any arguments, dynamically computed for the specific run()
Seems the easy way is to reinstantiate bt.Cerebro() before each run and pass everything as parameters:
class TestStrategy(bt.Strategy): params = (('socket', None),) ... <Loop over multiple strategy runs>: <check RemoteServer, get updated socket details> cerebro = bt.Cerebro() cerebro.addstrategy(TestStrategy, socket=<FreshSocket>) < add data, etc.> cerbro.run()
You were faster that the coming answer.
params(for parameters) is the standard way to pass things that will get to the strategy and that you can later address as
self.params.myparamor with the shorthand
There is no need for that indentation. See at the top of the page. Use 2 lines with 3-backticks marks to enclose the code block.
Or go directly (also at the top) to: http://commonmark.org/help/
Yup, pure "read manual first" case. Fixed.