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

Method init

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

Source from the content-addressed store, hash-verified

929 def test_SignalStrategy(self):
930 class S(SignalStrategy):
931 def init(self):
932 sma = self.data.Close.s.rolling(10).mean()
933 self.set_signal(self.data.Close > sma,
934 self.data.Close < sma)
935
936 stats = Backtest(GOOG, S).run()
937 self.assertIn(stats['# Trades'], (1179, 1180)) # varies on different archs?

Callers

nothing calls this directly

Calls 6

set_signalMethod · 0.80
set_atr_periodsMethod · 0.80
set_trailing_pctMethod · 0.80
set_trailing_slMethod · 0.80
IMethod · 0.80
initMethod · 0.45

Tested by

no test coverage detected