code: def testIGE_BrokerWithCommission(self):
      commision = 0.5
      initialCash = 42.09 + commision
      # This testcase is based on an example from Ernie Chan's book:
      # 'Quantitative Trading: How to Build Your Own Algorithmic Trading Business'
      barFeed = yahoofeed.Feed()
      barFeed.addBarsFromCSV(
          "ige", common.get_data_file_path("sharpe-ratio-test-ige.csv")
      )
      strat = strategy_test.TestStrategy(barFeed, initialCash)
      strat.getBroker().setCommission(
          backtesting.FixedPerTrade(commision)
      )
      strat.setUseAdjustedValues(True)
      strat.setBrokerOrdersGTC(True)
      stratAnalyzer = sharpe.SharpeRatio()
      strat.attachAnalyzer(stratAnalyzer)
  
      # Disable volume checks to match book results.
      strat.getBroker().getFillStrategy().setVolumeLimit(None)
  
      # Manually place the order to get it filled on the first bar.
      order = strat.getBroker().createMarketOrder(
          broker.Order.Action.BUY, "ige", 1, True
      )  # Adj. Close: 42.09
      order.setGoodTillCanceled(True)
      strat.getBroker().submitOrder(order)
      strat.addOrder(
          datetime.datetime(2007, 11, 13),
          strat.getBroker().createMarketOrder,
          broker.Order.Action.SELL,
          "ige",
          1,
          True,
      )  # Adj. Close: 127.64
  
      strat.run()
      self.assertTrue(
          round(strat.getBroker().getCash(), 2)
          == initialCash + (127.64 - 42.09 - commision * 2)
      )
      self.assertEqual(strat.orderUpdatedCalls, 6)
      # The results are slightly different only because I'm taking into account the first bar as well,
      # and I'm also adding commissions.
      self.assertEqual(
          round(stratAnalyzer.getSharpeRatio(0.04, True), 6), 0.776443
      )
  
file_path: pyalgotrade/testcases/sharpe_analyzer_test.py
imports: import datetime
  from .None import common
  from .None import strategy_test
  from pyalgotrade.barfeed import yahoofeed
  from pyalgotrade.barfeed import ninjatraderfeed
  from pyalgotrade.barfeed import csvfeed
  from pyalgotrade.stratanalyzer import sharpe
  from pyalgotrade.broker import backtesting
  from pyalgotrade import broker
  from pyalgotrade import marketsession
label_desc: Use image node_id 6 for calling the SharpeRatioTestCase obj's underlying member method code with example usage: obj.testIGE_BrokerWithCommission() without return types