yan365 / yaneli-trader

3 stars 1 forks source link

Daily plot error #23

Closed elidioxg closed 5 years ago

elidioxg commented 5 years ago

File: fadesystem.py line 390, plt.savefig(title+'.png')

Error message: ValueError: view limit minimum -36864.15759475 is less than 1 and is an invalid Matplotlib date value. This often happens if you pass a non-datetime value to an axis that has datetime units

elidioxg commented 5 years ago

Complete error message:

Traceback (most recent call last): File "../source/fadesystemcsv.py", line 103, in run_strategy() File "../source/fadesystemcsv.py", line 83, in run_strategy result = cerebro.run() File "/home/debian9/.local/lib/python3.7/site-packages/backtrader/cerebro.py", line 1127, in run runstrat = self.runstrategies(iterstrat) File "/home/debian9/.local/lib/python3.7/site-packages/backtrader/cerebro.py", line 1298, in runstrategies self._runnext(runstrats) File "/home/debian9/.local/lib/python3.7/site-packages/backtrader/cerebro.py", line 1630, in _runnext strat._next() File "/home/debian9/.local/lib/python3.7/site-packages/backtrader/strategy.py", line 347, in _next super(Strategy, self)._next() File "/home/debian9/.local/lib/python3.7/site-packages/backtrader/lineiterator.py", line 271, in _next self.next() File "/home/debian9/Desenvolvimento/temp/yaneli-trader/source/strategies/fadesystem.py", line 229, in next self.daily_plot(data, self._daily_orders) File "/home/debian9/Desenvolvimento/temp/yaneli-trader/source/strategies/fadesystem.py", line 390, in daily_plot plt.savefig(title+'.png') File "/home/debian9/.local/lib/python3.7/site-packages/matplotlib/pyplot.py", line 722, in savefig res = fig.savefig(args, kwargs) File "/home/debian9/.local/lib/python3.7/site-packages/matplotlib/figure.py", line 2180, in savefig self.canvas.print_figure(fname, kwargs) File "/home/debian9/.local/lib/python3.7/site-packages/matplotlib/backends/backend_qt5agg.py", line 88, in print_figure super().print_figure(args, kwargs) File "/home/debian9/.local/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 2082, in print_figure kwargs) File "/home/debian9/.local/lib/python3.7/site-packages/matplotlib/backends/backend_agg.py", line 527, in print_png FigureCanvasAgg.draw(self) File "/home/debian9/.local/lib/python3.7/site-packages/matplotlib/backends/backend_agg.py", line 388, in draw self.figure.draw(self.renderer) File "/home/debian9/.local/lib/python3.7/site-packages/matplotlib/artist.py", line 38, in draw_wrapper return draw(artist, renderer, *args, kwargs) File "/home/debian9/.local/lib/python3.7/site-packages/matplotlib/figure.py", line 1709, in draw renderer, self, artists, self.suppressComposite) File "/home/debian9/.local/lib/python3.7/site-packages/matplotlib/image.py", line 135, in _draw_list_compositing_images a.draw(renderer) File "/home/debian9/.local/lib/python3.7/site-packages/matplotlib/artist.py", line 38, in draw_wrapper return draw(artist, renderer, *args, *kwargs) File "/home/debian9/.local/lib/python3.7/site-packages/matplotlib/axes/_base.py", line 2647, in draw mimage._draw_list_compositing_images(renderer, self, artists) File "/home/debian9/.local/lib/python3.7/site-packages/matplotlib/image.py", line 135, in _draw_list_compositing_images a.draw(renderer) File "/home/debian9/.local/lib/python3.7/site-packages/matplotlib/artist.py", line 38, in draw_wrapper return draw(artist, renderer, args, kwargs) File "/home/debian9/.local/lib/python3.7/site-packages/matplotlib/axis.py", line 1203, in draw ticks_to_draw = self._update_ticks() File "/home/debian9/.local/lib/python3.7/site-packages/matplotlib/axis.py", line 1079, in _update_ticks major_locs = self.get_majorticklocs() File "/home/debian9/.local/lib/python3.7/site-packages/matplotlib/axis.py", line 1324, in get_majorticklocs return self.major.locator() File "/home/debian9/.local/lib/python3.7/site-packages/matplotlib/dates.py", line 1431, in call self.refresh() File "/home/debian9/.local/lib/python3.7/site-packages/matplotlib/dates.py", line 1451, in refresh dmin, dmax = self.viewlim_to_dt() File "/home/debian9/.local/lib/python3.7/site-packages/matplotlib/dates.py", line 1202, in viewlim_to_dt .format(vmin)) ValueError: view limit minimum -36864.15759475 is less than 1 and is an invalid Matplotlib date value. This often happens if you pass a non-datetime value to an axis that has datetime units