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

Method coroutine

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

Source from the content-addressed store, hash-verified

480
481 def test_position(self):
482 def coroutine(self):
483 yield self.buy()
484
485 assert self.position
486 assert self.position.is_long
487 assert not self.position.is_short
488 assert self.position.size > 0
489 assert self.position.pl
490 assert self.position.pl_pct
491
492 yield self.position.close()
493
494 assert not self.position
495 assert not self.position.is_long
496 assert not self.position.is_short
497 assert not self.position.size
498 assert not self.position.pl
499 assert not self.position.pl_pct
500
501 self._Backtest(coroutine).run()
502

Callers

nothing calls this directly

Calls 3

buyMethod · 0.80
sellMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected