From 81f2137c505b955bfb91f3556c4ea033b4f39a68 Mon Sep 17 00:00:00 2001 From: "Extremis@22" Date: Mon, 16 Jan 2023 21:24:27 -0300 Subject: [PATCH] =?UTF-8?q?DEV:=20refact=20dos=20coment=C3=A1rios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- myTicker_Monitor.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/myTicker_Monitor.py b/myTicker_Monitor.py index 6c16e29..0bca5e4 100644 --- a/myTicker_Monitor.py +++ b/myTicker_Monitor.py @@ -12,23 +12,29 @@ print(Panel.fit("Desenvolvido por: Vinícius Azevedo")) while True: - ############################################## - # FUNDOS IMOB - ############################################## + # Ticker de FII e Ações tickers = ["MXRF11.SA", "MCCI11.SA", "HGRU11.SA", "DEVA11.SA", "PETR4.SA", "TAEE11.SA", "BBAS3.SA"] current_price = web.get_quote_yahoo(tickers) + ############################################## + # FUNDOS IMOB + ############################################## table_fii = Table(title="Fundos Imobiliários + Ações") table_fii.add_column(" ", justify="right", style="blue") table_fii.add_column("MXRF11", justify="center", style="cyan") table_fii.add_column("MCCI11", justify="center", style="magenta") table_fii.add_column("HGRU11", justify="center", style="green") table_fii.add_column("DEVA11", justify="center", style="yellow") + + ############################################## + # AÇÕES + ############################################## table_fii.add_column("PETR4", justify="center", style="white") table_fii.add_column("TAEE11", justify="center", style="white") table_fii.add_column("BBAS3", justify="center", style="white") + # Funções para monitoramento dos valores def current_price(tickers): current_price = web.get_quote_yahoo(tickers)["price"] return current_price @@ -48,11 +54,13 @@ def regular_market_low(tickers): market_low = web.get_quote_yahoo(tickers)["regularMarketDayLow"] return market_low + # Chamando as funções preços = current_price(tickers) mud_reg_merc = regular_market_change(tickers) high = regular_market_high(tickers) low = regular_market_low(tickers) + # Input de dados na linha da tabela table_fii.add_row("Preço Atual (R$)", str(preços[0]), str(preços[1]), str(preços[2]), str(preços[3]), str(preços[4]), str(preços[5]), str(preços[6])) table_fii.add_row("Variação +-", str(round(mud_reg_merc[0],2)), str(round(mud_reg_merc[1],2)), str(round(mud_reg_merc[2],2)), str(round(mud_reg_merc[3],2)), str(round(mud_reg_merc[4],2)), str(round(mud_reg_merc[5],2)), str(round(mud_reg_merc[6],2))) table_fii.add_row("Maior Preço ⬆", str(high[0]), str(high[1]), str(high[2]), str(high[3]), str(high[4]), str(high[5]), str(high[6])) @@ -72,12 +80,14 @@ def regular_market_low(tickers): table_div.add_column("TAEE11", justify="center", style="white") table_div.add_column("BBAS3", justify="center", style="white") + # Iteração dos valores dos dividendos referente ao último mes dividends =[] for i in tickers: div_data = get_dividends(i, "2022/12/28") data = div_data.values dividends.append(data) + # Input de dados na linha da tabela table_div.add_row( "Último Div. (R$)", str(dividends[0][0][0]),