For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See:

how to get commission info in a strategy,for example,mult,margin,leverage

  • Re: get_leverage() calls

    you can use this code:
    self.log('info: {},mult:{},margin:{},commission:{}'.format(

  • Dude, I tried to solve this problem by creating a function that receives the parameters you want, feed them to the strategy sub class, then the function returns the instance created. Example:

    def AssignStrategy(mult, margin,commission):
          Class MyStrategy(bt.Strategy):
                ## Some Code
          return MyStrategy

    Hope it works for you!

Log in to reply