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/

    Problem with data clone

    General Code/Help
    1
    1
    71
    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.
    • weibudda
      weibudda last edited by

      When I use data1 = data.clone() method, it reports the following error:

      ...
              data = bt.feeds.PandasData(dataname=datas.loc[code], tz=tz_cn)
              data._name = code[0:6]
              data1 = data.clone()
              cerebro.adddata(data1)
      ...
      
        File "D:/Python/Jupyter/BackTrader/Test/Record/Order_History_C1.py", line 436, in runstrat
          cerebro.run()
        File "C:\Users\WEI\.conda\envs\backtrader37\lib\site-packages\backtrader\cerebro.py", line 1127, in run
          runstrat = self.runstrategies(iterstrat)
        File "C:\Users\WEI\.conda\envs\backtrader37\lib\site-packages\backtrader\cerebro.py", line 1210, in runstrategies
          data._start()
        File "C:\Users\WEI\.conda\envs\backtrader37\lib\site-packages\backtrader\feed.py", line 756, in _start
          self._tz = self.data._tz
        File "C:\Users\WEI\.conda\envs\backtrader37\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 '_tz'
      
      

      Any suggestions?

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