prasanth.thangavel
commited on
Commit
·
2b4eab3
1
Parent(s):
2aaf2a2
Update app to support log scale
Browse files
app.py
CHANGED
@@ -16,6 +16,7 @@ st.set_page_config(page_title="Asset Class Comparison", layout="wide")
|
|
16 |
# Title and description
|
17 |
st.title("Asset Class Performance Comparison")
|
18 |
st.write("Compare the performance of different asset classes over time")
|
|
|
19 |
|
20 |
# Sidebar for user inputs
|
21 |
st.sidebar.header("Investment Parameters")
|
@@ -24,6 +25,7 @@ initial_investment = st.sidebar.number_input(f"Initial Investment Amount ({curre
|
|
24 |
start_date = st.sidebar.date_input("Start Date", value=datetime.now() - timedelta(days=365*10))
|
25 |
user_end_date = st.sidebar.date_input("End Date", value=datetime.now())
|
26 |
fd_rate = st.sidebar.number_input("Fixed Deposit Rate (%)", min_value=0.0, value=2.9, step=0.1) / 100
|
|
|
27 |
|
28 |
# Asset selection
|
29 |
selected_assets = st.sidebar.multiselect(
|
@@ -46,6 +48,7 @@ selected_assets = st.sidebar.multiselect(
|
|
46 |
"Tesla",
|
47 |
"Netflix",
|
48 |
"Meta",
|
|
|
49 |
],
|
50 |
default=["Fixed Deposit", "Microsoft", "Google", "Nvidia"]
|
51 |
)
|
@@ -74,6 +77,7 @@ tickers = {
|
|
74 |
"Tesla": "TSLA",
|
75 |
"Netflix": "NFLX",
|
76 |
"Meta": "META",
|
|
|
77 |
}
|
78 |
|
79 |
# Determine the effective end date for each asset
|
@@ -152,7 +156,8 @@ fig.update_layout(
|
|
152 |
xaxis_title="Date",
|
153 |
yaxis_title=f"Investment Value ({currency_symbol})",
|
154 |
hovermode="x unified",
|
155 |
-
height=600
|
|
|
156 |
)
|
157 |
|
158 |
# Display the plot
|
|
|
16 |
# Title and description
|
17 |
st.title("Asset Class Performance Comparison")
|
18 |
st.write("Compare the performance of different asset classes over time")
|
19 |
+
st.write("Note: Bitcoin (BTC) is highly volatile and should be considered a high-risk investment")
|
20 |
|
21 |
# Sidebar for user inputs
|
22 |
st.sidebar.header("Investment Parameters")
|
|
|
25 |
start_date = st.sidebar.date_input("Start Date", value=datetime.now() - timedelta(days=365*10))
|
26 |
user_end_date = st.sidebar.date_input("End Date", value=datetime.now())
|
27 |
fd_rate = st.sidebar.number_input("Fixed Deposit Rate (%)", min_value=0.0, value=2.9, step=0.1) / 100
|
28 |
+
use_log_scale = st.sidebar.checkbox("Use Log Scale", value=False)
|
29 |
|
30 |
# Asset selection
|
31 |
selected_assets = st.sidebar.multiselect(
|
|
|
48 |
"Tesla",
|
49 |
"Netflix",
|
50 |
"Meta",
|
51 |
+
"Bitcoin",
|
52 |
],
|
53 |
default=["Fixed Deposit", "Microsoft", "Google", "Nvidia"]
|
54 |
)
|
|
|
77 |
"Tesla": "TSLA",
|
78 |
"Netflix": "NFLX",
|
79 |
"Meta": "META",
|
80 |
+
"Bitcoin": "BTC-USD",
|
81 |
}
|
82 |
|
83 |
# Determine the effective end date for each asset
|
|
|
156 |
xaxis_title="Date",
|
157 |
yaxis_title=f"Investment Value ({currency_symbol})",
|
158 |
hovermode="x unified",
|
159 |
+
height=600,
|
160 |
+
yaxis_type="log" if use_log_scale else "linear"
|
161 |
)
|
162 |
|
163 |
# Display the plot
|