code: def sortino_ratio(rets, rfr_ann=0, mar=0, full=0, expanding=0):
      
      annrets = returns_annualized(rets, expanding=expanding) - rfr_ann
      return annrets / downside_deviation(rets, mar=mar, expanding=expanding, full=full, ann=1)
docs: Compute the sortino ratio as (Ann Rets - Risk Free Rate) / Downside Deviation Ann
  
      :param rets: period return series
      :param rfr_ann: annualized risk free rate
      :param mar: minimum acceptable rate of return (MAR)
      :param full: If True, use the lenght of full series. If False, use only values below MAR
      :param expanding:
      :return: