code: def testInvestopedia(self):
      # http://www.investopedia.com/exam-guide/cfa-level-1/quantitative-methods/discounted-cash-flow-time-weighted-return.asp
      retTracker = returns.TimeWeightedReturns(200000)
      retTracker.update(196500)  # March 31, 2004
      self.assertEquals(
          round(retTracker.getLastPeriodReturns(), 4), -0.0175
      )
      retTracker.update(200000)  # June 30, 2004
      self.assertEquals(
          round(retTracker.getLastPeriodReturns(), 4), 0.0178
      )
      retTracker.deposit(20000)
      retTracker.update(222000)  # July 30, 2004
      self.assertEquals(
          round(retTracker.getLastPeriodReturns(), 2), 0.01
      )
      retTracker.update(243000)  # Sept. 30, 2004
      self.assertEquals(
          round(retTracker.getLastPeriodReturns(), 4), 0.0946
      )
      retTracker.deposit(2000)
      retTracker.update(250000)  # Dec. 31, 2004
      self.assertEquals(
          round(retTracker.getLastPeriodReturns(), 4), 0.0206
      )
      self.assertEquals(
          round(retTracker.getCumulativeReturns(), 6), 0.128288
      )
  
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 3 for calling the TimeWeightedReturnsTestCase obj's underlying member method code with example usage: obj.testInvestopedia() without return types