def send_email(message): try: sg = SendGridAPIClient(os.environ.get('SENDGRID_API_KEY')) response = sg.send(message) print(response.status_code) except Exception as e: print("Deu erro na hora de enviar o email", str(e)) try: if __name__ == '__main__': from waitingbar import WaitingBar THE_BAR = WaitingBar('[*] Downloading...') lista = get_data() THE_BAR.stop() # print("Get all stocks data") #Transform em uma lista, agora preciso passar para formato JSON array_format = list(lista.items()) # print(array_format, len(array_format)) hashes_list = [] # First include the list of all hashes for i in range(0, len(array_format)): hashes_list.append(array_format[i][1])
Se os indicadores forem menores, menos pontos(ou subtraem). Levar em conta também critérios universais como muito endividamento. """ if __name__ == '__main__': # noinspection PyUnresolvedReferences from waitingbar import WaitingBar # filename = 'fundamentus_' + str(date.today()) # infile = open(filename, 'rb') # reade = pickle.load(infile) # infile.close() progress_bar = WaitingBar('[*] Downloading...') result = get_data() progress_bar.stop() print('get_cotacao(result)') for j, i in get_cotacao(result, 1).items(): print(j, i) # print('get_pl(result)') # for j, i in get_pl(result, 1).items(): # print(j, i) # print('get_pvp(result)') # for j, i in get_pvp(result, 1).items(): # print(j, i) # print('get_psr(result)') # for j, i in get_psr(result, 1).items():
columns.extend(['P/L', 'ROE']) if formula in ('ROIC', None): columns.extend(['EV/EBIT', 'ROIC']) return shares[columns + [col for col in shares.columns if col not in tuple(columns)]] # Chame a função main de acordo com qual formula você quer aplicar: roe OU roic # Formula ROE: Utiliza ROE e P/L # Formula ROIC: Utiliza ROIC e EV/EBIT (EV/EBITDA não tem no fundamentus) # ================ Exemplos ================ # python3 greenblatt.py "{ 'formula': 'ROE', 'year': 2013 }" if __name__ == '__main__': from waitingbar import WaitingBar progress_bar = WaitingBar('[*] Calculating...') year = None formula = None if len(sys.argv) > 1: arguments = eval(sys.argv[1]) year = int(arguments.get('year', None)) formula = arguments.get('formula', None) if year == None: shares = bovespa.shares() else: shares = fundamentus.get_data(year) shares = setup(shares, formula, year)
def output(lst): ranked = rank(lst) print('{0:<7} {1:<10} {2:<7} {3:<10} {4:<10} {5:<10}'.format( 'Papel', 'EV/EBIT', 'ROIC', 'EV/EBIT Rank', 'ROIC Rank', 'Final Rank' )) for item in ranked: print('{0:<7} {1:<10} {2:<7} {3:<10} {4:<10} {5:<10}'.format( item['name'], item['ev_ebit'], item['roic'], item['ev_ebit_rank'], item['roic_rank'], item['final_rank'], )) if __name__ == '__main__': from waitingbar import WaitingBar THE_BAR = WaitingBar('[*] Downloading...') lst = get_data() THE_BAR.stop() output(lst)