Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,25 +17,29 @@ def calculate_investment(initial_deposit, years, rate, contribution, freq):
|
|
| 17 |
return balance
|
| 18 |
|
| 19 |
# Streamlit UI
|
| 20 |
-
st.title("
|
| 21 |
|
| 22 |
# User Inputs
|
| 23 |
-
initial_deposit = st.number_input("
|
| 24 |
-
years = st.number_input("
|
| 25 |
-
estimated_rate = st.number_input("
|
| 26 |
-
contribution = st.number_input("
|
| 27 |
-
contribution_freq = st.radio("
|
| 28 |
|
| 29 |
-
if st.button("
|
| 30 |
balances = calculate_investment(initial_deposit, years, estimated_rate, contribution, contribution_freq)
|
| 31 |
|
| 32 |
# Plot results
|
| 33 |
plt.figure(figsize=(8,5))
|
| 34 |
-
plt.plot(range(len(balances)), balances, label="Total
|
| 35 |
-
plt.xlabel("
|
| 36 |
-
plt.ylabel("
|
| 37 |
-
plt.title("
|
| 38 |
plt.legend()
|
| 39 |
st.pyplot(plt)
|
| 40 |
|
| 41 |
-
st.success(f"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
return balance
|
| 18 |
|
| 19 |
# Streamlit UI
|
| 20 |
+
st.title("Kalkulator Investasi")
|
| 21 |
|
| 22 |
# User Inputs
|
| 23 |
+
initial_deposit = st.number_input("Deposit Awal (Rp)", min_value=1, value=1000000)
|
| 24 |
+
years = st.number_input("Lama Investasi (Tahun)", min_value=1, max_value=50, value=10)
|
| 25 |
+
estimated_rate = st.number_input("Estimasi Tingkat Pengembalian Tahunan (%)", min_value=0.0, value=5.0)
|
| 26 |
+
contribution = st.number_input("Jumlah Kontribusi (Rp)", min_value=0, value=100000)
|
| 27 |
+
contribution_freq = st.radio("Frekuensi Kontribusi", ("Bulanan", "Tahunan"))
|
| 28 |
|
| 29 |
+
if st.button("Hitung"):
|
| 30 |
balances = calculate_investment(initial_deposit, years, estimated_rate, contribution, contribution_freq)
|
| 31 |
|
| 32 |
# Plot results
|
| 33 |
plt.figure(figsize=(8,5))
|
| 34 |
+
plt.plot(range(len(balances)), balances, label="Total Saldo", color='green')
|
| 35 |
+
plt.xlabel("Bulan")
|
| 36 |
+
plt.ylabel("Saldo (Rp)")
|
| 37 |
+
plt.title("Pertumbuhan Investasi dari Waktu ke Waktu")
|
| 38 |
plt.legend()
|
| 39 |
st.pyplot(plt)
|
| 40 |
|
| 41 |
+
st.success(f"Saldo Akhir: Rp{balances[-1]:,.2f}")
|
| 42 |
+
|
| 43 |
+
|
| 44 |
+
#Sekarang kalkulator investasi menggunakan mata uang Rupiah (Rp) dengan bahasa Indonesia. Jika ada yang ingin diubah lagi, beri tahu saya!
|
| 45 |
+
|