def testProfitReturnsAndCost(self):
        posTracker = returns.PositionTracker(broker.IntegerTraits())
        posTracker.buy(10, 1)
        self.assertEqual(posTracker.getPnL(), 0)
        self.assertEqual(posTracker.getAvgPrice(), 1)
        self.assertEqual(posTracker.getCommissions(), 0)
        # self.assertEqual(posTracker.getCash(), -10)

        posTracker.buy(20, 1, 10)
        self.assertEqual(posTracker.getPnL(), -10)
        self.assertEqual(posTracker.getAvgPrice(), 1)
        self.assertEqual(posTracker.getCommissions(), 10)
        # self.assertEqual(posTracker.getCash(), -40)

        posTracker.sell(30, 1)
        self.assertEqual(posTracker.getAvgPrice(), 0)
        self.assertEqual(posTracker.getPnL(), -10)
        # self.assertEqual(posTracker.getCash(), -10)
        self.assertEqual(posTracker.getCommissions(), 10)
        self.assertEqual(posTracker.getReturn(), 30.0/-10)

        posTracker.buy(10, 1)
        self.assertEqual(posTracker.getPnL(), -10)
        self.assertEqual(posTracker.getAvgPrice(), 1)
dataset/ETHPy150Open gbeced/pyalgotrade/testcases/returns_analyzer_test.py/PosTrackerTestCase.testProfitReturnsAndCost/swapped operands of `/`