def plot(self, stock_list, amount_list, start_date, end_date):
        try:
            CI.IsInternetOn()
            portfolio = PC.Portfolio(stock_list, start_date, end_date,
                                     amount_list)
            if self.figure_type.get() == 'portfolio performance':
                portfolio.plot_portfolio()
            elif self.figure_type.get() == 'portfolio performance with market':
                portfolio.portfolio_value_change_compared_with_market()
            elif self.figure_type.get(
            ) == 'expected return V.S. risk of stocks':
                portfolio.return_vs_risk()
            elif self.figure_type.get(
            ) == 'moving average V.S. portfolio daily price':
                portfolio.moving_avg_50()
            else:
                portfolio.heat_map()

        except (StockNameInputException, DateInputException,
                EmptyInputException, ConnectInternetException,
                DateRangeException, TradeAmountException,
                EmptyPortfolioException) as error:
            tkMessageBox.showinfo(message=error)
        except:
            tkMessageBox.showinfo(
                message='Please restart the application, sorry about that!')
Exemplo n.º 2
0
	def plot(self, stock_list, start_date, end_date):
		try:
			CI.IsInternetOn()
			MSC.multistocks_percentchange(stock_list, start_date, end_date)
		except (StockNameInputException,DateInputException,EmptyInputException,ConnectInternetException,DateRangeException) as error:
			tkMessageBox.showinfo(message=error)
		except:
			tkMessageBox.showinfo(message='Please restart the application, sorry about that!')
Exemplo n.º 3
0
	def plot(self, stock_name, start_date, end_date):
		try:
			CI.IsInternetOn()
			stock = SC.Stock(stock_name, start_date, end_date)
			stock.plot_changeprice_comparison()
		except (StockNameInputException,DateInputException,EmptyInputException,ConnectInternetException,DateRangeException) as error:
			tkMessageBox.showinfo(message=error)
		except:
			tkMessageBox.showinfo(message='Please restart the application, sorry about that!')
Exemplo n.º 4
0
    def plot(self, stock_name, start_date, end_date):
        '''
		plot the stock closed prices and daily volume.
		'''
        try:
            CI.IsInternetOn()
            stock = SC.Stock(stock_name, start_date, end_date)
            stock.plot_close_price()
        except (StockNameInputException, DateInputException,
                EmptyInputException, ConnectInternetException,
                DateRangeException, EndDateException) as error:
            tkMessageBox.showinfo(message=error)
        except:
            tkMessageBox.showinfo(
                message='Please restart the application, sorry about that!')
    def analysis(self, stock_list, amount_list, start_date, end_date):
        try:
            CI.IsInternetOn()
            portfolio = PC.Portfolio(stock_list, start_date, end_date,
                                     amount_list)

            if self.analysis_type.get() == 'statistics of the portfolio':
                try:
                    self.label1.destroy()
                    self.label2.destroy()
                    self.label3.destroy()
                    self.label4.destroy()
                except:
                    pass
                self.label1 = ttk.Label(self.frame,
                                        text="Statistics of the portfolio.")
                self.label1.grid(column=1, row=5, sticky=W)
                text = portfolio.describe_portfolio()
                self.label2 = ttk.Label(self.frame, text=text)
                self.label2.grid(column=1, row=6, sticky=W)
            else:
                try:
                    self.label1.destroy()
                    self.label2.destroy()
                    self.label3.destroy()
                    self.label4.destroy()
                except:
                    pass
                self.label3 = ttk.Label(
                    self.frame, text="Correlation of the stocks changes.")
                self.label3.grid(column=1, row=5, sticky=W)
                self.label4 = ttk.Label(
                    self.frame, text=portfolio.stocks_value_change_corr())
                self.label4.grid(column=1, row=6, sticky=W)

        except (StockNameInputException, DateInputException,
                EmptyInputException, ConnectInternetException,
                DateRangeException, TradeAmountException,
                EmptyPortfolioException) as error:
            tkMessageBox.showinfo(message=error)
        except:
            tkMessageBox.showinfo(
                message='Please restart the application, sorry about that!')
Exemplo n.º 6
0
    def analysis(self, stock_name, start_date, end_date):
        '''
		analysis the data and display them in a dataframe
		'''
        try:
            CI.IsInternetOn()
            stock = SC.Stock(stock_name, start_date, end_date)
            self.analysistitle = ttk.Label(
                self.frame, text="The Close Price Analysis of the Stock ")
            self.analysistitle.grid(column=1, row=5, sticky=W)
            self.analysiscontent = ttk.Label(self.frame,
                                             text=stock.close_price_describe())
            self.analysiscontent.grid(column=1, row=6, sticky=W)
        except (StockNameInputException, DateInputException,
                EmptyInputException, ConnectInternetException,
                DateRangeException) as error:
            tkMessageBox.showinfo(message=error)
        except:
            tkMessageBox.showinfo(
                message='Please restart the application, sorry about that!')