src/django/shared/Monte.py
def plot_pdf(self):
        """
        Function that plots the distribution of simulated prices of a given time step into the future.
        This histogram is fit to a Probability Density Function with the mean and standard deviation
        listed in the title.

        :returns: plot_pdf_str which is a string which contains the html for the graphical output.
        :rtype: str
        """
    
        # Histogram for the price frequencies, number of bins can be adjusted'
        fig = plt.figure(figsize=(self.width, self.height))
        plt.hist(self.monte_sims[self.time_steps - 2], bins=10, density=True)

        # Probability Density Function
        sim_mu, sim_sig = norm.fit(self.monte_sims[self.time_steps - 2]) # Simulation mean and standard deviation values
        xmin, xmax = plt.xlim() # set the xmin and xmax along the x-axis for the pdf
        x = np.linspace(xmin, xmax)
        p = norm.pdf(x, sim_mu, sim_sig)

        # Plots frequencies of the Monte Carle simulations fit to normal distribution
        plt.plot(x, p, 'k') # normal distribution fit
        plt.xlabel('Adjusted Closing Price')
        plt.ylabel('Probability Density')
        title = "Simulated Prices %d Days into the Future\n(PDF fit results: μ = %.4f,  σ = %.4f)" % (self.time_steps - 1, sim_mu, sim_sig)
        plt.title(title)

        plot_pdf_str = mpld3.fig_to_html(fig) # saves figure to string of html
        #plot_pdf_dict = mpld3.fig_to_dict(fig)
        return plot_pdf_str

        Function that plots the distribution of simulated prices of a given time step into the future.
        This histogram is fit to a Probability Density Function with the mean and standard deviation
        listed in the title.

        :returns: plot_pdf_str which is a string which contains the html for the graphical output.
        :rtype: str
        
Function that plots the distribution of simulated prices of a given time step into the future.
This histogram is fit to a Probability Density Function with the mean and standard deviation
listed in the title.
Function that plots the distribution of simulated prices of a given time step into the future . This histogram is fit to a Probability Density Function with the mean and standard deviation listed in the title .
def plot_pdf(self):
        fig = plt.figure(figsize=(self.width, self.height))
        plt.hist(self.monte_sims[self.time_steps - 2], bins=10, density=True)
        sim_mu, sim_sig = norm.fit(self.monte_sims[self.time_steps - 2]) 
        xmin, xmax = plt.xlim() 
        x = np.linspace(xmin, xmax)
        p = norm.pdf(x, sim_mu, sim_sig)
        plt.plot(x, p, 'k') 
        plt.xlabel('Adjusted Closing Price')
        plt.ylabel('Probability Density')
        title = "Simulated Prices %d Days into the Future\n(PDF fit results: μ = %.4f,  σ = %.4f)" % (self.time_steps - 1, sim_mu, sim_sig)
        plt.title(title)
        plot_pdf_str = mpld3.fig_to_html(fig) 
        return plot_pdf_str
def plot_pdf ( self ) : fig = plt . figure ( figsize = ( self . width , self . height ) ) plt . hist ( self . monte_sims [ self . time_steps - 2 ] , bins = 10 , density = True ) sim_mu , sim_sig = norm . fit ( self . monte_sims [ self . time_steps - 2 ] ) xmin , xmax = plt . xlim ( ) x = np . linspace ( xmin , xmax ) p = norm . pdf ( x , sim_mu , sim_sig ) plt . plot ( x , p , 'k' ) plt . xlabel ( 'Adjusted Closing Price' ) plt . ylabel ( 'Probability Density' ) title = "Simulated Prices %d Days into the Future\n(PDF fit results: μ = %.4f,  σ = %.4f)" % ( e lf.t i me_steps - 1 s m_mu,  s m_sig) plt . title ( title ) plot_pdf_str = mpld3 . fig_to_html ( fig ) return plot_pdf_str
Function that plots the distribution of simulated prices of a given time step into the future.
Function that plots the distribution of simulated prices of a given time step into the future .
"""
        Function that plots the distribution of simulated prices of a given time step into the future.
        This histogram is fit to a Probability Density Function with the mean and standard deviation
        listed in the title.

        :returns: plot_pdf_str which is a string which contains the html for the graphical output.
        :rtype: str
        """ # Histogram for the price frequencies, number of bins can be adjusted' # Probability Density Function # Simulation mean and standard deviation values # set the xmin and xmax along the x-axis for the pdf # Plots frequencies of the Monte Carle simulations fit to normal distribution # normal distribution fit # saves figure to string of html #plot_pdf_dict = mpld3.fig_to_dict(fig)
plot_pdf_str which is a string which contains the html for the graphical output.
plot_pdf_str which is a string which contains the html for the graphical output .
str
self