James McCool commited on
Commit
c7464dc
·
1 Parent(s): 8e96a8e

Refactor trimming options in app.py: enhance user interface by organizing input fields into columns for better clarity and usability, and update threshold inputs to allow for minimum and maximum values, improving the portfolio trimming process.

Browse files
Files changed (1) hide show
  1. app.py +23 -7
app.py CHANGED
@@ -910,13 +910,29 @@ with tab2:
910
  with st.expander('Trimming Options'):
911
  st.info("Make sure you filter before trimming if you want to filter, trimming before a filter will reset your portfolio")
912
  with st.form(key='trim_form'):
913
- performance_type = st.selectbox("Select Sorting variable", ['median', 'Finish_percentile'])
914
- own_type = st.selectbox("Select trimming variable", ['Own', 'Geomean', 'Weighted Own'])
915
- trim_slack_var = st.number_input("Select trim slack (percentile addition to trimming variable ceiling)", value=0.0, min_value=0.0, max_value=1.0, step=0.1)
916
- performance_threshold_high = st.number_input("Select performance threshold (will only trim if sorting variable is lower than this)", value=st.session_state['portfolio'][performance_type].max(), min_value=0.0, step=1.0)
917
- performance_threshold_low = st.number_input("Select performance threshold (will only trim if sorting variable is higher than this)", value=0.0, min_value=0.0, step=1.0)
918
- own_threshold_high = st.number_input("Select own threshold (will only trim if trimming variable is lower than this)", value=st.session_state['portfolio'][own_type].max(), min_value=0.0, step=1.0)
919
- own_threshold_low = st.number_input("Select own threshold (will only trim if trimming variable is higher than this)", value=0.0, min_value=0.0, step=1.0)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
920
  submitted = st.form_submit_button("Trim")
921
  if submitted:
922
  st.write('initiated')
 
910
  with st.expander('Trimming Options'):
911
  st.info("Make sure you filter before trimming if you want to filter, trimming before a filter will reset your portfolio")
912
  with st.form(key='trim_form'):
913
+ st.write("Sorting and trimming variables:")
914
+ perf_var, own_var = st.columns(2)
915
+ with perf_var:
916
+ performance_type = st.selectbox("Sorting variable", ['median', 'Finish_percentile'])
917
+ with own_var:
918
+ own_type = st.selectbox("Trimming variable", ['Own', 'Geomean', 'Weighted Own'])
919
+
920
+ trim_slack_var = st.number_input("Trim slack (percentile addition to trimming variable ceiling)", value=0.0, min_value=0.0, max_value=1.0, step=0.1)
921
+
922
+ st.write("Sorting threshold range:")
923
+ min_sort, max_sort = st.columns(2)
924
+ with min_sort:
925
+ performance_threshold_low = st.number_input("Min", value=0.0, min_value=0.0, step=1.0)
926
+ with max_sort:
927
+ performance_threshold_high = st.number_input("Max", value=st.session_state['portfolio'][performance_type].max(), min_value=0.0, step=1.0)
928
+
929
+ st.write("Trimming threshold range:")
930
+ min_trim, max_trim = st.columns(2)
931
+ with min_trim:
932
+ own_threshold_low = st.number_input("Min", value=0.0, min_value=0.0, step=1.0)
933
+ with max_trim:
934
+ own_threshold_high = st.number_input("Max", value=st.session_state['portfolio'][own_type].max(), min_value=0.0, step=1.0)
935
+
936
  submitted = st.form_submit_button("Trim")
937
  if submitted:
938
  st.write('initiated')