class_docstr: An object to perform a Monte Carlo run/simulation for finding
  optimised financial portfolios.
  
  Inherits from `MonteCarlo`.
class_docstr_tok: ["An","object","to","perform","a","Monte","Carlo","run\/simulation","for","finding","optimised","financial","portfolios",".","Inherits","from","`","MonteCarlo","`","."]
docstr: :param returns: DataFrame of returns of stocks
       Note: If applicable, the given returns should be computed with the same risk free rate
       and time window/frequency (arguments ``risk_free_rate`` and ``freq`` as passed in here.
  :param num_trials: Number of portfolios to be computed,
      each with a random distribution of weights/allocation in each stock, default: 1000
  :param risk_free_rate: Risk free rate as required for the Sharpe Ratio, default: 0.005
  :param freq: Number of trading days in a year, default: 252
  :param initial_weights: Weights of initial/given portfolio, only used to plot a marker for the
       initial portfolio in the optimisation plot, default: ``None``
docstr_tok: [":","param","returns",":","DataFrame","of","returns","of","stocks","Note",":","If","applicable",",","the","given","returns","should","be","computed","with","the","same","risk","free","rate","and","time","window\/frequency","(","arguments","``","risk_free_rate","``","and","``","freq","``","as","passed","in","here",".",":","param","num_trials",":","Number","of","portfolios","to","be","computed",",","each","with","a","random","distribution","of","weights\/allocation","in","each","stock",",","default",":","1000",":","param","risk_free_rate",":","Risk","free","rate","as","required","for","the","Sharpe","Ratio",",","default",":","0.005",":","param","freq",":","Number","of","trading","days","in","a","year",",","default",":","252",":","param","initial_weights",":","Weights","of","initial\/given","portfolio",",","only","used","to","plot","a","marker","for","the","initial","portfolio","in","the","optimisation","plot",",","default",":","``","None","``"]
code: def __init__(
      self,
      returns: pd.DataFrame,
      num_trials: int = 1000,
      risk_free_rate: FLOAT = 0.005,
      freq: INT = 252,
      initial_weights: Optional[np.ndarray[np.float64, Any]] = None,
  ) -> None:
      """
      :param returns: DataFrame of returns of stocks
           Note: If applicable, the given returns should be computed with the same risk free rate
           and time window/frequency (arguments ``risk_free_rate`` and ``freq`` as passed in here.
      :param num_trials: Number of portfolios to be computed,
          each with a random distribution of weights/allocation in each stock, default: 1000
      :param risk_free_rate: Risk free rate as required for the Sharpe Ratio, default: 0.005
      :param freq: Number of trading days in a year, default: 252
      :param initial_weights: Weights of initial/given portfolio, only used to plot a marker for the
           initial portfolio in the optimisation plot, default: ``None``
      """
      # Type validations:
      type_validation(
          returns_df=returns,
          num_trials=num_trials,
          risk_free_rate=risk_free_rate,
          freq=freq,
          initial_weights=initial_weights,
      )
      self.returns = returns
      self.num_trials = num_trials
      self.risk_free_rate = risk_free_rate
      self.freq = freq
      self.initial_weights: np.ndarray[float, Any] = initial_weights
      # initiate super class
      super().__init__(num_trials=self.num_trials)
      # setting additional variables
      self.num_stocks = len(self.returns.columns)
      self.return_means = self.returns.mean()
      self.cov_matrix = self.returns.cov()
      # setting up variables for results
      self.df_weights = None
      self.df_results = None
      self.opt_weights = None
      self.opt_results = None
  
file_path: FinQuant/finquant/monte_carlo.py
imports: from typing import Any, Callable, Dict, Optional, Tuple
  import matplotlib.pylab
  import numpy
  import pandas
  from finquant.data_types import FLOAT, INT
  from finquant.quants import annualised_portfolio_quantities
  from finquant.type_utilities import type_validation
label_desc: Use image node_id 1 to create a new MonteCarloOpt object from inherited base classes: MonteCarlo with example: obj = MonteCarloOpt(returns, num_trials, risk_free_rate, freq, initial_weights)