code: 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(), -10 / 30.0)
  
      posTracker.buy(10, 1)
      self.assertEqual(posTracker.getPnL(), -10)
      self.assertEqual(posTracker.getAvgPrice(), 1)
  
imports: import datetime
  from .None import common
  from .None import strategy_test
  from .None import position_test
  from testcases import test_strategy
  from pyalgotrade.barfeed import yahoofeed
  from pyalgotrade.barfeed import csvfeed
  from pyalgotrade.stratanalyzer import returns
  from pyalgotrade import broker
  from pyalgotrade import marketsession
label_desc: Use image node_id 12 for calling the PosTrackerTestCase obj's underlying member method code with example usage: obj.testProfitReturnsAndCost() without return types