We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a8082f1 commit 84066deCopy full SHA for 84066de
backtesting/test/_test.py
@@ -506,6 +506,18 @@ def coroutine(self):
506
stats = self._Backtest(coroutine).run()
507
self.assertEqual(len(stats._trades), 1)
508
509
+ def test_order_tag(self):
510
+ def coroutine(self):
511
+ yield self.buy(size=2, tag=1)
512
+ yield self.sell(size=1, tag='s')
513
+ yield self.sell(size=1)
514
+
515
+ yield self.buy(tag=2)
516
+ yield self.position.close()
517
518
+ stats = self._Backtest(coroutine).run()
519
+ self.assertEqual(list(stats._trades.Tag), [1, 1, 2])
520
521
522
class TestOptimize(TestCase):
523
def test_optimize(self):
0 commit comments