in this stepwe will extract the closing quotes every day for thisuse the following commandclosing_quotes np array([quote[ for quote in quotes]nowwe will extract the volume of shares traded every day for thisuse the following commandvolumes np array([quote[ for quote in quotes])[ :heretake the percentage difference of closing stock pricesusing the code shown belowdiff_percentages np diff(closing_quotesclosing_quotes[:-dates np array([quote[ for quote in quotes]dtype=np int)[ :training_data np column_stack([diff_percentagesvolumes]in this stepcreate and train the gaussian hmm for thisuse the following codehmm gaussianhmm(n_components= covariance_type='diag'n_iter= with warnings catch_warnings()warnings simplefilter('ignore'hmm fit(training_datanowgenerate data using the hmm modelusing the commands shownnum_samples samples_ hmm sample(num_samplesfinallyin this stepwe plot and visualize the difference percentage and volume of shares traded as output in the form of graph use the following code to plot and visualize the difference percentagesplt figure(plt title('difference percentages'plt plot(np arange(num_samples)samples[: ] ='black'use the following code to plot and visualize the volume of shares tradedplt figure(plt title('volume of shares'plt plot(np arange(num_samples)samples[: ] ='black'plt ylim(ymin=