Updated interface, benchmark option added (**MUST EDIT OTHER FILES FOR FULL CHANGES TO TAKE EFFECT**)
Browse filesUpdated interface and added benchmark option - must update passing of variables in other arguments in other python files for this change to take full effect
app.py
CHANGED
@@ -57,23 +57,50 @@ def get_choices():
|
|
57 |
An object of choices and an object of combined dataframes.
|
58 |
"""
|
59 |
choices = {}
|
|
|
60 |
|
61 |
-
tickers = st.sidebar.text_input('Enter 4 stock symbols.', 'GOOG,A,AA,AMD')
|
62 |
|
63 |
-
# Set the weights
|
64 |
-
weights_str = st.sidebar.text_input('Enter The Investment Quantities', '50,30,25,25')
|
65 |
-
# Set Initial Investment
|
66 |
-
investment = st.sidebar.number_input('Enter The Initial Investment', min_value=5000, max_value=25000, value=5000)
|
67 |
|
68 |
-
|
69 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
70 |
#A_coef_map =
|
71 |
-
|
72 |
-
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
|
75 |
# Every form must have a submit button.
|
76 |
-
submitted = st.
|
77 |
|
78 |
symbols = []
|
79 |
reset = False
|
@@ -85,6 +112,9 @@ def get_choices():
|
|
85 |
# reset = st.sidebar.button("RESET APP")
|
86 |
|
87 |
if submitted:
|
|
|
|
|
|
|
88 |
# convert strings to lists
|
89 |
tickers_list = tickers.split(",")
|
90 |
weights_list = weights_str.split(",")
|
@@ -99,9 +129,9 @@ def get_choices():
|
|
99 |
|
100 |
if reset:
|
101 |
# # Clears all singleton caches:
|
102 |
-
tickers = st.sidebar.selectbox('Enter 11 stock symbols.', ('GOOG','D','AAP','BLK'))
|
103 |
# crypto_symbols = st.sidebar.text_input('Enter 2 crypto symbols only as below', 'BTC-USD,ETH-USD')
|
104 |
-
weights_str = st.sidebar.text_input('Enter The Investment Weights', '0.3,0.3 ,0.3')
|
105 |
|
106 |
st.experimental_singleton.clear()
|
107 |
|
@@ -112,7 +142,8 @@ def get_choices():
|
|
112 |
|
113 |
'symbols': symbols,
|
114 |
'weights': weights,
|
115 |
-
'
|
|
|
116 |
'risk-free-rate': rf,
|
117 |
'A-coef': A_coef
|
118 |
|
|
|
57 |
An object of choices and an object of combined dataframes.
|
58 |
"""
|
59 |
choices = {}
|
60 |
+
tab1, tab2, tab3, tab4, tab5 = st.tabs(["Tickers", "Quantity", "Benchmark","Risk Free Return","Risk Aversion"])
|
61 |
|
|
|
62 |
|
|
|
|
|
|
|
|
|
63 |
|
64 |
+
with tab1:
|
65 |
+
|
66 |
+
tickers = st.text_input('Enter stock tickers.', 'GOOG,A,AVOG,AMD')
|
67 |
+
|
68 |
+
with tab2:
|
69 |
+
# Set the weights
|
70 |
+
weights_str = st.text_input('Enter the investment quantities', '50,30,25,25')
|
71 |
+
|
72 |
+
with tab3:
|
73 |
+
benchmark = st.selectbox(
|
74 |
+
'Select your ideal benchmark of return',
|
75 |
+
('SP500', 'AOK', 'IXIC'))
|
76 |
+
if benchmark == 'IXIC':
|
77 |
+
st.warning("You have selected a volatile benchmark.")
|
78 |
+
elif benchmark == 'SP500':
|
79 |
+
st.success('You have selected a balanced benchmark')
|
80 |
+
elif benchmark == 'AOK':
|
81 |
+
st.success('You have selected a conservative benchmark')
|
82 |
+
|
83 |
+
with tab4:
|
84 |
+
### koi
|
85 |
+
rf = st.number_input('Enter current rate of risk free return', min_value=0.001, max_value=1.00, value=0.041)
|
86 |
+
|
87 |
+
|
88 |
#A_coef_map =
|
89 |
+
with tab5:
|
90 |
+
A_coef = st.slider('Enter The Coefficient of Risk Aversion', min_value=5, max_value=35, value=30, step=5)
|
91 |
+
|
92 |
+
if A_coef > 20:
|
93 |
+
st.success("You have selected a "+ risk_str(A_coef) +" investing style")
|
94 |
+
investing_style = 'Conservative'
|
95 |
+
elif A_coef >10 and A_coef <= 20:
|
96 |
+
st.success("You have selected a "+risk_str(A_coef) +" investing style")
|
97 |
+
investing_style = 'Balanced'
|
98 |
+
elif A_coef <= 10:
|
99 |
+
st.warning("You have selected a "+ risk_str(A_coef) +" investing style")
|
100 |
+
investing_style = 'Risky'
|
101 |
|
102 |
# Every form must have a submit button.
|
103 |
+
submitted = st.button("Calculate")
|
104 |
|
105 |
symbols = []
|
106 |
reset = False
|
|
|
112 |
# reset = st.sidebar.button("RESET APP")
|
113 |
|
114 |
if submitted:
|
115 |
+
with st.spinner('Running the calculations...'):
|
116 |
+
time.sleep(8)
|
117 |
+
st.success('Done!')
|
118 |
# convert strings to lists
|
119 |
tickers_list = tickers.split(",")
|
120 |
weights_list = weights_str.split(",")
|
|
|
129 |
|
130 |
if reset:
|
131 |
# # Clears all singleton caches:
|
132 |
+
#tickers = st.sidebar.selectbox('Enter 11 stock symbols.', ('GOOG','D','AAP','BLK'))
|
133 |
# crypto_symbols = st.sidebar.text_input('Enter 2 crypto symbols only as below', 'BTC-USD,ETH-USD')
|
134 |
+
#weights_str = st.sidebar.text_input('Enter The Investment Weights', '0.3,0.3 ,0.3')
|
135 |
|
136 |
st.experimental_singleton.clear()
|
137 |
|
|
|
142 |
|
143 |
'symbols': symbols,
|
144 |
'weights': weights,
|
145 |
+
'benchmark': benchmark,
|
146 |
+
'investing_style': investing_style,
|
147 |
'risk-free-rate': rf,
|
148 |
'A-coef': A_coef
|
149 |
|