Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

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

    General Code/Help
    2
    2
    2499
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      Wei Jingjue last edited by

      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 ?
      2. where can i put my strateygy in ? and what's the relation between data0 and data1?

      1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors