AttributeError: 'Lines_LineSeries_DataSeries_OHLC_OHLCDateTime_Abst' object has no attribute 'contractdetails'



  • 1.when i tried the oandatest and i set data0 as EUR_USD and my account and token , the error happened and this is the error.

    File "oandatest.py", line 498, in <module>
        runstrategy()
      File "oandatest.py", line 310, in runstrategy
        cerebro.run(exactbars=args.exactbars)
      File "C:\Users\jingjue\AppData\Local\Programs\Python\Python35\lib\site-packages\backtrader\cerebro.py", line 1142, in run
        runstrat = self.runstrategies(iterstrat)
      File "C:\Users\jingjue\AppData\Local\Programs\Python\Python35\lib\site-packages\backtrader\cerebro.py", line 1276, in runstrategies
        strat._start()
      File "C:\Users\jingjue\AppData\Local\Programs\Python\Python35\lib\site-packages\backtrader\strategy.py", line 391, in _start
        self.start()
      File "oandatest.py", line 180, in start
        if self.data0.contractdetails is not None:
      File "C:\Users\jingjue\AppData\Local\Programs\Python\Python35\lib\site-packages\backtrader\lineseries.py", line 461, in __getattr__
        return getattr(self.lines, name)
    AttributeError: 'Lines_LineSeries_DataSeries_OHLC_OHLCDateTime_Abst' object has no attribute 'contractdetails'
    

    Is my input wrong ?

    1. where can i put my strateygy in ? and what's the relation between data0 and data1?

  • administrators

    You probably have a 2.0 account and the code is failing to receive the contractdetails from the server. You need a legacy account.

    See Community - Oandatest no attribute 'contractdetails'

    @Wei-Jingjue said in AttributeError: 'Lines_LineSeries_DataSeries_OHLC_OHLCDateTime_Abst' object has no attribute 'contractdetails':

    1. where can i put my strateygy in ?

    See the Docs - Quickstart or any of the hundreds of samples.

    Using a live broker is just a matter of replacing the broker or store instances and there are specific documentations on how to do it.

    For Oanda for example

    and what's the relation between data0 and data1?.

    Any relation between data0 and data1 is defined by you. Those are the data feeds you add to the system.


Log in to reply
 

Looks like your connection to Backtrader Community was lost, please wait while we try to reconnect.