Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +9 -9
src/streamlit_app.py
CHANGED
|
@@ -11,9 +11,9 @@ tabs = st.tabs(["Time Value of Money", "Consistent Cash Flow Investment", "Monte
|
|
| 11 |
# --- Time Value of Money ---
|
| 12 |
with tabs[0]:
|
| 13 |
st.header("Time Value of Money")
|
| 14 |
-
a = st.number_input("Base Amount (a)", min_value=0.0, value=1000.0)
|
| 15 |
-
r = st.number_input("Annual Return Rate (r)", min_value=0.0, value=0.05)
|
| 16 |
-
T = st.number_input("Number of Years (T)", min_value=0, value=10)
|
| 17 |
|
| 18 |
future_value = a * ((1 + r) ** T)
|
| 19 |
st.write(f"Future Value = {a} * (1 + {r})^{T} = **{future_value:,.2f}**")
|
|
@@ -21,9 +21,9 @@ with tabs[0]:
|
|
| 21 |
# --- Consistent Cash Flow Investment ---
|
| 22 |
with tabs[1]:
|
| 23 |
st.header("Consistent Cash Flow Investment")
|
| 24 |
-
a_cf = st.number_input("Annual Cash Flow (a)", min_value=0.0, value=1000.0)
|
| 25 |
-
r_cf = st.number_input("Annual Return Rate (r)", min_value=0.0, value=0.05)
|
| 26 |
-
T_cf = st.number_input("Number of Years (T)", min_value=0, value=10)
|
| 27 |
|
| 28 |
if r_cf > 0:
|
| 29 |
fv_cf = a_cf * (((1 + r_cf) ** T_cf - 1) / r_cf)
|
|
@@ -35,9 +35,9 @@ with tabs[1]:
|
|
| 35 |
# --- Monte Carlo Simulation ---
|
| 36 |
with tabs[2]:
|
| 37 |
st.header("Monte Carlo Simulation")
|
| 38 |
-
mean_return = st.number_input("Mean Annual Return", value=0.07)
|
| 39 |
-
std_dev = st.number_input("Standard Deviation", value=0.15)
|
| 40 |
-
years = st.slider("Number of Years", 1, 100, 30)
|
| 41 |
simulations = 50
|
| 42 |
|
| 43 |
# Simulate paths
|
|
|
|
| 11 |
# --- Time Value of Money ---
|
| 12 |
with tabs[0]:
|
| 13 |
st.header("Time Value of Money")
|
| 14 |
+
a = st.number_input("Base Amount (a)", min_value=0.0, value=1000.0, key="tv_a")
|
| 15 |
+
r = st.number_input("Annual Return Rate (r)", min_value=0.0, value=0.05, key="tv_r")
|
| 16 |
+
T = st.number_input("Number of Years (T)", min_value=0, value=10, key="tv_T")
|
| 17 |
|
| 18 |
future_value = a * ((1 + r) ** T)
|
| 19 |
st.write(f"Future Value = {a} * (1 + {r})^{T} = **{future_value:,.2f}**")
|
|
|
|
| 21 |
# --- Consistent Cash Flow Investment ---
|
| 22 |
with tabs[1]:
|
| 23 |
st.header("Consistent Cash Flow Investment")
|
| 24 |
+
a_cf = st.number_input("Annual Cash Flow (a)", min_value=0.0, value=1000.0, key="cf_a")
|
| 25 |
+
r_cf = st.number_input("Annual Return Rate (r)", min_value=0.0, value=0.05, key="cf_r")
|
| 26 |
+
T_cf = st.number_input("Number of Years (T)", min_value=0, value=10, key="cf_T")
|
| 27 |
|
| 28 |
if r_cf > 0:
|
| 29 |
fv_cf = a_cf * (((1 + r_cf) ** T_cf - 1) / r_cf)
|
|
|
|
| 35 |
# --- Monte Carlo Simulation ---
|
| 36 |
with tabs[2]:
|
| 37 |
st.header("Monte Carlo Simulation")
|
| 38 |
+
mean_return = st.number_input("Mean Annual Return", value=0.07, key="mc_mean")
|
| 39 |
+
std_dev = st.number_input("Standard Deviation", value=0.15, key="mc_std")
|
| 40 |
+
years = st.slider("Number of Years", 1, 100, 30, key="mc_years")
|
| 41 |
simulations = 50
|
| 42 |
|
| 43 |
# Simulate paths
|