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

following the docs

  • I'm trying to follow the docs but I can't get the output that docs shows .
    what's the problem?

    My DataFrame

     class PandasData(bt.feed.DataBase):
     parmas = (
    ('datetime', None),
    ('open', -1),
    ('high', -1),
    ('low', -1),
    ('close', -1),
    ('volume', -1),
    ('openinterest', None),)
    class TestStrategy(bt.Strategy):
    def log(self, txt, dt=None):
        df = dt or self.datas[0]
        print('%s, %s' %(dt.isoformat(), txt))
    def __init__(self):
        self.dataclose = self.datas[0].close
    def next(self):
        self.log('Close, %.2f' % self.dataclose[0])
        if self.dataclose[0] < self.dataclose[-1]:
            if self.dataclose[-1] < self.dataclose[-2]:
                self.log('BUY CREATE, %.2f' % self.dataclose[0])
    def runstrat():
    cerebro = bt.Cerebro()
    dataframe = df_price
    data = PandasData(dataname=dataframe, timeframe=bt.TimeFrame.Days)
    print('Starting Portfolio Value: %.2f' %
    print('Final Portfolio Value: %.2f' %
     Starting Portfolio Value: 1000000.00
     Final Portfolio Value: 1000000.00

  • Maybe the reason is that it should be params and you have parmas?

  • fixed it but the output didn't changed

  • administrators

    It's obvious then: you didn't fix it. Or else your code would raise an exception.

    You are not following the docs. There is no single example like that one in the docs.

    Your custom PandasData class is doing absolutely nothing. Use the PandasData which is part of the framework and at least your data will be read.