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/

    cerebro.plot() error

    General Discussion
    6
    7
    525
    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.
    • L
      lavenderfish last edited by

      I've got below errors when trying to do cerebro.plot().
      My data files is normal csv with date/high/low/open/close.
      cerebro.plot()
      File "C:\ProgramData\Anaconda3\envs\Yiqin\lib\site-packages\backtrader\cerebro.py", line 991, in plot
      start=start, end=end, use=use)
      File "C:\ProgramData\Anaconda3\envs\Yiqin\lib\site-packages\backtrader\plot\plot.py", line 262, in plot
      self.mpyplot.setp(ax.get_xticklabels(), visible=False)
      File "C:\ProgramData\Anaconda3\envs\Yiqin\lib\site-packages\matplotlib\axes_base.py", line 63, in wrapper
      return get_method(self)(*args, **kwargs)
      File "C:\ProgramData\Anaconda3\envs\Yiqin\lib\site-packages\matplotlib\axis.py", line 1255, in get_ticklabels
      return self.get_majorticklabels()
      File "C:\ProgramData\Anaconda3\envs\Yiqin\lib\site-packages\matplotlib\axis.py", line 1207, in get_majorticklabels
      ticks = self.get_major_ticks()
      File "C:\ProgramData\Anaconda3\envs\Yiqin\lib\site-packages\matplotlib\axis.py", line 1378, in get_major_ticks
      numticks = len(self.get_majorticklocs())
      File "C:\ProgramData\Anaconda3\envs\Yiqin\lib\site-packages\matplotlib\axis.py", line 1283, in get_majorticklocs
      return self.major.locator()
      File "C:\ProgramData\Anaconda3\envs\Yiqin\lib\site-packages\matplotlib\dates.py", line 1320, in call
      return locator()
      File "C:\ProgramData\Anaconda3\envs\Yiqin\lib\site-packages\matplotlib\dates.py", line 1731, in call
      return self.tick_values(dmin, dmax)
      File "C:\ProgramData\Anaconda3\envs\Yiqin\lib\site-packages\matplotlib\dates.py", line 1741, in tick_values
      ticks = self._wrapped_locator.tick_values(nmin, nmax)
      File "C:\ProgramData\Anaconda3\envs\Yiqin\lib\site-packages\matplotlib\ticker.py", line 2009, in tick_values
      locs = vmin - step + np.arange(n + 3) * step
      MemoryError: Unable to allocate 70.8 GiB for an array with shape (9504000003,) and data type float64

      1 Reply Last reply Reply Quote 0
      • A
        ab_trader last edited by

        Not enough memory for the operations you want to make. I doubt that this is related to bt, you may want to google this error and check out what are the recommendations.

        1 Reply Last reply Reply Quote -2
        • TXY
          TXY last edited by

          I encountered the exact same error. Any solutions here?

          1 Reply Last reply Reply Quote 0
          • TXY
            TXY last edited by

            Okay so I solved this. This is due to the new version of matplotlib, which is 3.3.0 currently. I pip installed an older version which is 3.2.2, and the graph was printed out successfully.

            L 1 Reply Last reply Reply Quote 5
            • L
              laclanthony @TXY last edited by

              @TXY Thank you, I had this same problem and your method worked.

              1 Reply Last reply Reply Quote 2
              • R
                RandomTrader88 last edited by

                anybody was able to solve it without installing older version of mathplotlib? maybe it should be an issue on backtrader.

                i have the newest version, and it crashes with the same error ("MemoryError: Unable to allocate 70.8 GiB") only when there was no buy/sell, for example if i don't add any strategy or the strategy did not create a buy/sell order.

                Z 1 Reply Last reply Reply Quote 0
                • Z
                  zuj @RandomTrader88 last edited by

                  @RandomTrader88 Exactly this happened with me. I tried to run a strategy with no buy/sell signal and got this error.

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post
                  Copyright © 2016, 2017, 2018 NodeBB Forums | Contributors
                  $(document).ready(function () { app.coldLoad(); }); }