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

Method test_plot_heatmaps

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

Source from the content-addressed store, hash-verified

894 self.assertIsInstance(res3, pd.DataFrame)
895
896 def test_plot_heatmaps(self):
897 bt = Backtest(GOOG, SmaCross)
898 stats, heatmap = bt.optimize(fast=range(2, 7, 2),
899 slow=range(7, 15, 2),
900 return_heatmap=True)
901 with _tempfile() as f:
902 for agg in ('mean',
903 lambda x: np.percentile(x, 75)):
904 plot_heatmaps(heatmap, agg, filename=f, open_browser=False)
905
906 # Preview
907 plot_heatmaps(heatmap, filename=f)
908 time.sleep(5)
909
910 def test_random_ohlc_data(self):
911 generator = random_ohlc_data(GOOG, frac=1)

Callers

nothing calls this directly

Calls 4

optimizeMethod · 0.95
BacktestClass · 0.90
plot_heatmapsFunction · 0.90
_tempfileFunction · 0.85

Tested by

no test coverage detected