class_docstr: A :class:`pyalgotrade.stratanalyzer.StrategyAnalyzer` that calculates
  Sharpe ratio for the whole portfolio.
  
  :param useDailyReturns: True if daily returns should be used instead of the returns for each bar.
  :type useDailyReturns: boolean.
docstr: Returns the Sharpe ratio for the strategy execution. If the volatility is 0, 0 is returned.
  
  :param riskFreeRate: The risk free rate per annum.
  :type riskFreeRate: int/float.
  :param annualized: True if the sharpe ratio should be annualized.
  :type annualized: boolean.
docstr_tok: ["Returns","the","Sharpe","ratio","for","the","strategy","execution",".","If","the","volatility","is","0",",","0","is","returned",".",":","param","riskFreeRate",":","The","risk","free","rate","per","annum",".",":","type","riskFreeRate",":","int\/float",".",":","param","annualized",":","True","if","the","sharpe","ratio","should","be","annualized",".",":","type","annualized",":","boolean","."]
code: def getSharpeRatio(self, riskFreeRate, annualized=True):
      """
      Returns the Sharpe ratio for the strategy execution. If the volatility is 0, 0 is returned.
  
      :param riskFreeRate: The risk free rate per annum.
      :type riskFreeRate: int/float.
      :param annualized: True if the sharpe ratio should be annualized.
      :type annualized: boolean.
      """
  
      if not isinstance(annualized, bool):
          raise Exception(
              "tradingPeriods parameter is not supported anymore."
          )
  
      if self.__useDailyReturns:
          ret = sharpe_ratio(
              self.__returns, riskFreeRate, 252, annualized
          )
      else:
          ret = sharpe_ratio_2(
              self.__returns,
              riskFreeRate,
              self.__firstDateTime,
              self.__lastDateTime,
              annualized,
          )
      return ret
  
file_path: pyalgotrade/pyalgotrade/stratanalyzer/sharpe.py
imports: from pyalgotrade import stratanalyzer
  from pyalgotrade.stratanalyzer import returns
  from pyalgotrade.utils import stats
  import math
label_desc: Use image node_id 5 for calling the SharpeRatio obj's underlying member method code with example usage: obj.getSharpeRatio(riskFreeRate, annualized) and returns: ret