code: def omega_ratio(returns, risk_free=0.0, required_return=0.0,
                  annualization=APPROX_BDAYS_PER_YEAR):
      
  
      if len(returns) < 2:
          return np.nan
  
      if annualization == 1:
          return_threshold = required_return
      elif required_return <= -1:
          return np.nan
      else:
          return_threshold = (1 + required_return) ** \
              (1. / annualization) - 1
  
      returns_less_thresh = returns - risk_free - return_threshold
  
      numer = sum(returns_less_thresh[returns_less_thresh > 0.0])
      denom = -1.0 * sum(returns_less_thresh[returns_less_thresh < 0.0])
  
      if denom > 0.0:
          return numer / denom
      else:
          return np.nan
docs: Determines the Omega ratio of a strategy.
  
      Parameters
      ----------
      returns : pd.Series or np.ndarray
          Daily returns of the strategy, noncumulative.
          - See full explanation in :func:`~empyrical.stats.cum_returns`.
      risk_free : int, float
          Constant risk-free return throughout the period
      required_return : float, optional
          Minimum acceptance return of the investor. Threshold over which to
          consider positive vs negative returns. It will be converted to a
          value appropriate for the period of the returns. E.g. An annual minimum
          acceptable return of 100 will translate to a minimum acceptable
          return of 0.018.
      annualization : int, optional
          Factor used to convert the required_return into a daily
          value. Enter 1 if no time period conversion is necessary.
  
      Returns
      -------
      omega_ratio : float
  
      Note
      -----
      See https://en.wikipedia.org/wiki/Omega_ratio for more details.