| 722 | bt.plot(filename=f, open_browser=False) |
| 723 | |
| 724 | def test_preview(self): |
| 725 | class Strategy(SmaCross): |
| 726 | def init(self): |
| 727 | super().init() |
| 728 | |
| 729 | def ok(x): |
| 730 | return x |
| 731 | |
| 732 | self.a = self.I(SMA, self.data.Open, 5, overlay=False, name='ok') |
| 733 | self.b = self.I(ok, np.random.random(len(self.data.Open))) |
| 734 | |
| 735 | bt = Backtest(GOOG, Strategy) |
| 736 | bt.run() |
| 737 | with _tempfile() as f: |
| 738 | bt.plot(filename=f, plot_drawdown=True, smooth_equity=True) |
| 739 | # Give browser time to open before tempfile is removed |
| 740 | time.sleep(5) |
| 741 | |
| 742 | def test_wellknown(self): |
| 743 | class S(_S): |