MCPcopy Create free account
hub / github.com/kernc/backtesting.py / test_preview

Method test_preview

backtesting/test/_test.py:724–740  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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):

Callers

nothing calls this directly

Calls 4

runMethod · 0.95
plotMethod · 0.95
BacktestClass · 0.90
_tempfileFunction · 0.85

Tested by

no test coverage detected