code: def testTwoBarReturns_CloseOpen(self):
      initialCash = 15.9
      barFeed = yahoofeed.Feed()
      barFeed.setBarFilter(
          csvfeed.DateRangeFilter(
              datetime.datetime(2001, 12, 6),
              datetime.datetime(2001, 12, 7),
          )
      )
      barFeed.addBarsFromCSV(
          AnalyzerTestCase.TestInstrument,
          common.get_data_file_path("orcl-2001-yahoofinance.csv"),
      )
      strat = strategy_test.TestStrategy(barFeed, initialCash)
  
      # 2001-12-06,15.61,16.03,15.50,15.90,66944900,15.55
      # 2001-12-07,15.74,15.95,15.55,15.91,42463200,15.56
      # Manually place the entry order, to get it filled on the first bar.
      order = strat.getBroker().createMarketOrder(
          broker.Order.Action.BUY,
          AnalyzerTestCase.TestInstrument,
          1,
          True,
      )  # Close: 15.90
      strat.getBroker().submitOrder(order)
      strat.addOrder(
          datetime.datetime(2001, 12, 6),
          strat.getBroker().createMarketOrder,
          broker.Order.Action.SELL,
          AnalyzerTestCase.TestInstrument,
          1,
          False,
      )  # Open: 15.74
  
      stratAnalyzer = returns.Returns()
      strat.attachAnalyzer(stratAnalyzer)
      strat.run()
      self.assertTrue(
          strat.getBroker().getCash() == initialCash + (15.74 - 15.90)
      )
      # First day returns: 0
      self.assertTrue(stratAnalyzer.getReturns()[0] == 0)
      # Second day returns: Open vs Prev. day's close
      self.assertTrue(
          stratAnalyzer.getReturns()[1] == (15.74 - 15.90) / 15.90
      )
  
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 4 for calling the AnalyzerTestCase obj's underlying member method code with example usage: obj.testTwoBarReturns_CloseOpen() without return types