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/

    a problem AttributeError: 'Plot_OldSync' object has no attribute 'mpyplot

    General Code/Help
    1
    1
    120
    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.
    • A
      AIRA last edited by

      I am a newbie in backtrader When I imported the minute data, the programe show an error AttributeError: 'Plot_OldSync' object has no attribute 'mpyplot' My code is as follows

      import datetime
      import backtrader as bt 
      import backtrader.indicators as btind 
      import backtrader.feeds as btfeeds 
      
      class TestStrategy(bt.Strategy):
              pass
      
      cerebro = bt.Cerebro()
      data = btfeeds.GenericCSVData(
          dataname='../datas/JD.csv',
          fromdate=datetime.datetime(2014, 1, 1),
          todate=datetime.datetime(2015, 12, 31),
          # nullvalue=0.0,
          # dtformat=('%Y-%m-%d'),
          # tmformat=('%H:%M:%S'),
          # datetime=0,
          # time=1,
          # high=1,
          # low=2,
          # open=3,
          # close=4,
          # volume=5,
          # openinterest=-1
      )
      
      cerebro.adddata(data)
      cerebro.addstrategy(TestStrategy)
      cerebro.run()
      cerebro.plot()
      

      if I don’t use parameter below to truncate my csv data, the error will not appear.

      fromdate=datetime.datetime(2014, 1, 1),
      todate=datetime.datetime(2015, 12, 31)
      

      (The data format is as follows)
      0a84617b-3db8-47d2-a370-a707e77eb1ee-image.png

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