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

Method next

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

Source from the content-addressed store, hash-verified

742 def test_wellknown(self):
743 class S(_S):
744 def next(self):
745 date = self.data.index[-1]
746 if date == pd.Timestamp('Thu 19 Oct 2006'):
747 self.buy(stop=484, limit=466, size=100)
748 elif date == pd.Timestamp('Thu 30 Oct 2007'):
749 self.position.close()
750 elif date == pd.Timestamp('Tue 11 Nov 2008'):
751 self.sell(stop=self.data.Low,
752 limit=324.90, # High from 14 Nov
753 size=200)
754
755 bt = Backtest(GOOG, S, margin=.1)
756 stats = bt.run()

Callers

nothing calls this directly

Calls 3

buyMethod · 0.80
sellMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected