Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 36 additions & 12 deletions myFII_Monitor.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

import pandas_datareader as web
import time
# argumentos
import sys, getopt
from rich.console import Console
from rich.table import Table
from rich.panel import Panel
Expand All @@ -11,19 +12,26 @@
logo("MyFII-MONITOR")
print(Panel.fit("Desenvolvido por: Vinícius Azevedo"))

# pass arguments from the terminal python only works for real states funds
tickers = sys.argv[1:]
tickers = [item.upper() for item in tickers]




while True:
##############################################
# FUNDOS IMOB
##############################################
tickers = ["MXRF11.SA", "MCCI11.SA", "HGRU11.SA", "DEVA11.SA"]
#tickers = ["MXRF11.SA", "MCCI11.SA", "HGRU11.SA", "DEVA11.SA"]
current_price = web.get_quote_yahoo(tickers)

table_fii = Table(title="Fundos Imobiliários")
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")
table_fii.add_column(f"{tickers[0]}", justify="center", style="cyan")
table_fii.add_column(f"{tickers[1]}", justify="center", style="magenta")
table_fii.add_column(f"{tickers[2]}", justify="center", style="green")
table_fii.add_column(f"{tickers[3]}", justify="center", style="yellow")


def current_price(tickers):
Expand Down Expand Up @@ -60,18 +68,34 @@ def regular_market_low(tickers):
##############################################
table_div = Table(title="Dividendos")
table_div.add_column(" ", justify="right", style="blue")
table_div.add_column("MXRF11", justify="center", style="cyan")
table_div.add_column("MCCI11", justify="center", style="magenta")
table_div.add_column("HGRU11", justify="center", style="green")
table_div.add_column("DEVA11", justify="center", style="yellow")
table_div.add_column(f"{tickers[0]}", justify="center", style="cyan")
table_div.add_column(f"{tickers[1]}", justify="center", style="magenta")
table_div.add_column(f"{tickers[2]}", justify="center", style="green")
table_div.add_column(f"{tickers[3]}", justify="center", style="yellow")

dividends =[]
for i in tickers:
div_data = get_dividends(i, "2022/12/28")
data = div_data.values
dividends.append(data)

table_div.add_row("Último Div. (R$)", str(dividends[0][0][0]), str(dividends[1][0][0]), str(dividends[2][0][0]), str(dividends[3]))

# lista vazia para pegar os valores de dividends
values = []
# loop de verificação para saber se existe divididendo ou não
for i in range(len(dividends)):
if len(dividends[i]) > 0 and len(dividends[i][0]) > 0:
if dividends[i][0][0] > 0:
values.append(str(dividends[i][0][0]))
#table_div.add_row(f"Último Div. {tickers[i]} (R$)", str(dividends[i][0][0]))
else:
#table_div.add_row(f"Último Div. {tickers[i]} (R$)", '0')
values.append('0')
else:
#table_div.add_row(f"Último Div. {tickers[i]} (R$)", '0')
values.append('0')

# insere os valores na tabela dividendos
table_div.add_row(f"Último Div. (R$)",values[0], values[1], values[2], values[3])

console = Console()
console.print(table_fii)
Expand Down