|
pip install seaborn |
|
|
|
import streamlit as st |
|
import numpy as np |
|
import pandas as pd |
|
import matplotlib.pyplot as plt |
|
import seaborn as sns |
|
|
|
|
|
sns.set_style("whitegrid") |
|
|
|
st.title('App de prueba') |
|
|
|
A = st.number_input("Escribe la cantidad que ahorrar谩s ($): ") |
|
T = st.number_input("Escribe cuantos meses quieres ver: ", step=1) |
|
|
|
tasas = [] |
|
for i in range(int(T)): |
|
tasa = st.number_input(f"Tasa de inter茅s nominal para el mes {i+1} (%): ") |
|
tasas.append(tasa) |
|
|
|
if T > 0: |
|
z = np.arange(T) |
|
|
|
r_d = A * (1 + np.array(tasas) / (12 * 100)) ** z |
|
r_c = A * np.exp(np.array(tasas) * z / (12 * 100)) |
|
|
|
new_dict = {"Mes": np.arange(1, T+1), |
|
"Retorno discreto": r_d, |
|
"Retorno continuo": r_c} |
|
|
|
df = pd.DataFrame(new_dict) |
|
st.dataframe(df) |
|
|
|
st.write(f"En {int(T)} meses tendr谩s: $ {r_c[-1]}") |
|
|
|
|
|
plt.figure(figsize=(10, 6)) |
|
plt.plot(np.arange(1, T+1), r_c, label='Retorno continuo', marker='o', linestyle='-', color='blue') |
|
plt.xlabel('Mes') |
|
plt.ylabel('Inversi贸n ($)') |
|
plt.title('Crecimiento de la inversi贸n a lo largo de los meses') |
|
plt.grid(True, linestyle='--', alpha=0.7) |
|
plt.legend() |
|
plt.tight_layout() |
|
st.pyplot(plt) |
|
|
|
else: |
|
st.write("Por favor, ingresa un valor de T mayor que 0.") |
|
|
|
|
|
|
|
|