Bhanu Prasanna commited on
Commit
7f81147
·
1 Parent(s): 50215fb

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +22 -5
main.py CHANGED
@@ -4,6 +4,14 @@ import yfinance as yf
4
  import streamlit as st
5
  import plotly.graph_objects as go
6
 
 
 
 
 
 
 
 
 
7
  list_df = pd.read_csv("Data/Company List.csv")
8
 
9
  company_name = list_df["Name"].to_list()
@@ -62,7 +70,9 @@ if num_tick > 1:
62
  'rebalance_weights': rebal_weig
63
  })
64
 
65
- st.write('PORTFOLIO WEIGHTS:')
 
 
66
  st.dataframe(weights_df, use_container_width=True)
67
 
68
 
@@ -73,9 +83,11 @@ if num_tick > 1:
73
  'Portfolio Sharpe Ratio': sharpe_ratio
74
  }, index=[0])
75
 
76
- st.write('PORTFOLIO METRICS:')
77
  st.dataframe(metrics_df, use_container_width=True)
78
 
 
 
79
  ## Let's get started with Monte Carlo Simulations
80
 
81
  ## How many times should we run Monte Carlo
@@ -132,7 +144,8 @@ if num_tick > 1:
132
  sim_df = sim_df.infer_objects()
133
 
134
  # Print out the results.
135
- st.write('SIMULATIONS RESULT:')
 
136
  st.dataframe(sim_df.head(), use_container_width=True)
137
 
138
  # Return the Max Sharpe Ratio from the run.
@@ -146,7 +159,7 @@ if num_tick > 1:
146
  'random_weights': max_sharpe_ratio["Portfolio Weights"],
147
  })
148
 
149
- st.write('MAX SHARPE RATIO:')
150
  st.dataframe(max_sharpe_ratio, use_container_width=True)
151
  st.dataframe(max_sharpe_weights_df, use_container_width=True)
152
 
@@ -155,10 +168,14 @@ if num_tick > 1:
155
  'random_weights': min_volatility["Portfolio Weights"],
156
  })
157
 
158
- st.write('MIN VOLATILITY:')
159
  st.dataframe(min_volatility, use_container_width=True)
160
  st.dataframe(min_volatility_weights_df, use_container_width=True)
161
 
 
 
 
 
162
  fig = go.Figure(data=go.Scatter(
163
  x=sim_df['Volatility'],
164
  y=sim_df['Returns'],
 
4
  import streamlit as st
5
  import plotly.graph_objects as go
6
 
7
+ st.set_page_config(layout="wide")
8
+
9
+ st.markdown("<h1 style='text-align: center;'><u>CapiPort</u></h1>", unsafe_allow_html=True)
10
+ st.markdown("<h5 style='text-align: center; color: gray;'>Your Portfolio Optimisation Tool</h5>", unsafe_allow_html=True)
11
+ st.divider()
12
+
13
+
14
+
15
  list_df = pd.read_csv("Data/Company List.csv")
16
 
17
  company_name = list_df["Name"].to_list()
 
70
  'rebalance_weights': rebal_weig
71
  })
72
 
73
+ st.divider()
74
+
75
+ st.markdown("<h5 style='text-align: center;'>Random Portfolio Weights</h5>", unsafe_allow_html=True)
76
  st.dataframe(weights_df, use_container_width=True)
77
 
78
 
 
83
  'Portfolio Sharpe Ratio': sharpe_ratio
84
  }, index=[0])
85
 
86
+ st.markdown("<h5 style='text-align: center;'>Random Weights Metrics</h5>", unsafe_allow_html=True)
87
  st.dataframe(metrics_df, use_container_width=True)
88
 
89
+ st.divider()
90
+
91
  ## Let's get started with Monte Carlo Simulations
92
 
93
  ## How many times should we run Monte Carlo
 
144
  sim_df = sim_df.infer_objects()
145
 
146
  # Print out the results.
147
+ st.write("\n\n")
148
+ st.markdown("<h4 style='text-align: center;'>Simulation Results</h4>", unsafe_allow_html=True)
149
  st.dataframe(sim_df.head(), use_container_width=True)
150
 
151
  # Return the Max Sharpe Ratio from the run.
 
159
  'random_weights': max_sharpe_ratio["Portfolio Weights"],
160
  })
161
 
162
+ st.markdown("<h5 style='text-align: center;'>Portfolio with Max Sharpe Ratio</h5>", unsafe_allow_html=True)
163
  st.dataframe(max_sharpe_ratio, use_container_width=True)
164
  st.dataframe(max_sharpe_weights_df, use_container_width=True)
165
 
 
168
  'random_weights': min_volatility["Portfolio Weights"],
169
  })
170
 
171
+ st.markdown("<h5 style='text-align: center;'>Portfolio with Min Volatility</h5>", unsafe_allow_html=True)
172
  st.dataframe(min_volatility, use_container_width=True)
173
  st.dataframe(min_volatility_weights_df, use_container_width=True)
174
 
175
+ st.divider()
176
+
177
+ st.markdown("<h1 style='text-align: center;'>Plotting</h1>", unsafe_allow_html=True)
178
+
179
  fig = go.Figure(data=go.Scatter(
180
  x=sim_df['Volatility'],
181
  y=sim_df['Returns'],