class_docstr: An object designed to perform optimisations based on minimising a cost/objective function.
  It can find parameters for portfolios with
  
  - minimum volatility
  - maximum Sharpe ratio
  - minimum volatility for a given target return
  - maximum Sharpe ratio for a given target volatility
  
  It also provides functions to compute the Efficient Frontier between a range
  of Returns, plot the Efficient Frontier, plot the optimal portfolios
  (minimum Volatility and maximum Sharpe Ratio).
class_docstr_tok: ["An","object","designed","to","perform","optimisations","based","on","minimising","a","cost\/objective","function",".","It","can","find","parameters","for","portfolios","with","-","minimum","volatility","-","maximum","Sharpe","ratio","-","minimum","volatility","for","a","given","target","return","-","maximum","Sharpe","ratio","for","a","given","target","volatility","It","also","provides","functions","to","compute","the","Efficient","Frontier","between","a","range","of","Returns",",","plot","the","Efficient","Frontier",",","plot","the","optimal","portfolios","(","minimum","Volatility","and","maximum","Sharpe","Ratio",")","."]
docstr: Gets portfolios for a range of given target returns.
  If no targets were provided, the algorithm will find the minimum
  and maximum returns of the portfolio's individual stocks, and set
  the target range according to those values.
  Results in the Efficient Frontier.
  
  :param targets: A list/array: range of target returns, default: ``None``
  
  :return: Array of (volatility, return) values
docstr_tok: ["Gets","portfolios","for","a","range","of","given","target","returns",".","If","no","targets","were","provided",",","the","algorithm","will","find","the","minimum","and","maximum","returns","of","the","portfolio","'s","individual","stocks",",","and","set","the","target","range","according","to","those","values",".","Results","in","the","Efficient","Frontier",".",":","param","targets",":","A","list\/array",":","range","of","target","returns",",","default",":","``","None","``",":","return",":","Array","of","(","volatility",",","return",")","values"]
code: def efficient_frontier(
      self, targets: Optional[ARRAY_OR_LIST[FLOAT]] = None
  ) -> np.ndarray[np.float64, Any]:
      """Gets portfolios for a range of given target returns.
      If no targets were provided, the algorithm will find the minimum
      and maximum returns of the portfolio's individual stocks, and set
      the target range according to those values.
      Results in the Efficient Frontier.
  
      :param targets: A list/array: range of target returns, default: ``None``
  
      :return: Array of (volatility, return) values
      """
      # Type validations:
      if targets is not None and not isinstance(
          targets, (list, np.ndarray)
      ):
          raise ValueError(
              "targets is expected to be a list or numpy.ndarray"
          )
      if targets is not None:
          for target in targets:
              type_validation(target=target)
      if targets is None:
          # set range of target returns from the individual expected
          # returns of the stocks in the portfolio.
          min_return = self.mean_returns.min() * self.freq
          max_return = self.mean_returns.max() * self.freq
          targets = np.linspace(
              round(min_return, 3), round(max_return, 3), 100
          )
      # compute the efficient frontier
      efrontier = []
      for target in targets:
          weights = self.efficient_return(target, save_weights=False)
          efrontier.append(
              [
                  annualised_portfolio_quantities(
                      weights,
                      self.mean_returns,
                      self.cov_matrix,
                      freq=self.freq,
                  )[1],
                  target,
              ]
          )
      self.efrontier: np.ndarray[np.float64, Any] = np.array(
          efrontier, dtype=np.float64
      )
      if self.efrontier.size == 0 or self.efrontier.ndim != 2:
          raise ValueError(
              "Error: Efficient frontier could not be computed."
          )
      return self.efrontier
  
imports: from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import matplotlib.pylab
  import numpy
  import pandas
  import scipy.optimize
  import finquant.minimise_fun
  from finquant.data_types import ARRAY_OR_DATAFRAME, ARRAY_OR_LIST, FLOAT, INT, NUMERIC
  from finquant.quants import annualised_portfolio_quantities
  from finquant.type_utilities import type_validation
label_desc: Use image node_id 6 for calling the EfficientFrontier obj's underlying member method code with example usage: obj.efficient_frontier(targets) and returns: self