#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Nov 2 10:06:46 2021 @author: benjaminull """ import pybase64 as base64 import io import streamlit as st from plotly import graph_objs as go def formatnum_0(numero): ''' Esta funciĆ³n permite dar formato a los montos de saldo y valor cuota en las cartolas. ''' return '{:,.0f}'.format(numero).replace(",", "@").replace(".", ",").replace("@", ".") def formatnum_2(numero): return '{:,.2f}'.format(numero).replace(",", "@").replace(".", ",").replace("@", ".") def macro_plot(col, data, color, prefijo, ancho, largo): fig = go.Figure() close_ = go.Scatter(x=data.index, y=data['Close'], name="stock_close", line=dict(color=color), fill='tonexty') fig.add_trace(close_) fig.layout.update(title_text="", xaxis_rangeslider_visible=True, width=ancho, height=largo, margin_b=0, margin_t=0, margin_r=0, margin_l=0) fig.update_yaxes(range=[min(data['Close'])/1.05, max(data['Close'])*1.05], tickprefix=prefijo) col.plotly_chart(fig, use_container_width=True) def get_table_excel_link(df, name): towrite = io.BytesIO() downloaded_file = df.to_excel(towrite, encoding='utf-8', index=False, header=True) towrite.seek(0) # reset pointer file_name = 'Data' + name + '.xlsx' style = 'style="color:black;text-decoration: none; font-size:18px;"' name_mark = "Descargar " + name + ".xlsx" b64 = base64.b64encode(towrite.read()).decode() # some strings linko= f'