code: def testIntraDay(self):
      barFeed = ninjatraderfeed.Feed(
          ninjatraderfeed.Frequency.MINUTE,
          marketsession.USEquities.getTimezone(),
      )
      barFeed.setBarFilter(csvfeed.USEquitiesRTH())
      barFeed.addBarsFromCSV(
          "spy", common.get_data_file_path("nt-spy-minute-2011.csv")
      )
      strat = strategy_test.TestStrategy(barFeed, 1000)
      stratAnalyzer = sharpe.SharpeRatio(False)
      strat.attachAnalyzer(stratAnalyzer)
      strat.marketOrder("spy", 1)
  
      strat.run()
  
      tradingPeriods = 252 * 6.5 * 60
      manualAnnualized = sharpe.sharpe_ratio(
          stratAnalyzer.getReturns(), 0.04, tradingPeriods, True
      )
      manualNotAnnualized = sharpe.sharpe_ratio(
          stratAnalyzer.getReturns(), 0.04, tradingPeriods, False
      )
      analyzerAnnualized = stratAnalyzer.getSharpeRatio(0.04)
      analyzerNotAnnualized = stratAnalyzer.getSharpeRatio(0.04, False)
  
      self.assertEqual(round(analyzerAnnualized, 10), -1.1814830854)
      self.assertEqual(round(analyzerNotAnnualized, 10), -0.0037659686)
      # They should be similar, but not identical because the analyzer uses 365 days/year
      # when useDailyReturns is set to False.
      self.assertEqual(
          round(analyzerAnnualized, 1), round(manualAnnualized, 1)
      )
      self.assertEqual(
          round(analyzerNotAnnualized, 3), round(manualNotAnnualized, 3)
      )
  
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 7 for calling the SharpeRatioTestCase obj's underlying member method code with example usage: obj.testIntraDay() without return types