Spaces:
Running
Running
Upload app.py
Browse files
app.py
CHANGED
|
@@ -1305,7 +1305,7 @@ def display_summary_analytics(summary_df):
|
|
| 1305 |
st.metric("Strategy Score", f"{display_score:.2f}%")
|
| 1306 |
st.metric("Avg Profit per Trade (Active Tickers)", f"{avg_trade_profit:.2%}")
|
| 1307 |
net_return_pct = avg_trade_profit * total_trades * 100
|
| 1308 |
-
st.metric("
|
| 1309 |
|
| 1310 |
st.text(f"Profitable Tickers: {good_tickers}")
|
| 1311 |
st.text(f"Losing Tickers: {bad_tickers}")
|
|
@@ -3167,14 +3167,15 @@ def run_confidence_optimisation(optimise_for, find_mode, master_df, main_content
|
|
| 3167 |
st.session_state.worst_confidence_setups_list = []
|
| 3168 |
|
| 3169 |
# --- Display the table ---
|
| 3170 |
-
|
|
|
|
| 3171 |
|
| 3172 |
-
# [
|
| 3173 |
conf_formatters = {
|
| 3174 |
"Avg Profit/Trade": "{:.2%}",
|
| 3175 |
"Ticker G/B Ratio": "{:.2f}",
|
| 3176 |
"Trade G/B Ratio": "{:.2f}",
|
| 3177 |
-
"
|
| 3178 |
"Avg Entry Conf.": "{:.1f}%",
|
| 3179 |
"Good Score": "{:.4f}",
|
| 3180 |
"Bad Score": "{:.4f}",
|
|
@@ -3184,8 +3185,7 @@ def run_confidence_optimisation(optimise_for, find_mode, master_df, main_content
|
|
| 3184 |
if 'MA Slope' in display_df_conf.columns: conf_formatters['MA Slope'] = '{}'
|
| 3185 |
if 'Markov' in display_df_conf.columns: conf_formatters['Markov'] = '{}'
|
| 3186 |
|
| 3187 |
-
valid_conf_formatters = {k: (lambda val, fmt=v: fmt.format(val) if pd.notna(val) else '-')
|
| 3188 |
-
for k, v in conf_formatters.items() if k in display_df_conf.columns}
|
| 3189 |
st.dataframe(display_df_conf.style.format(valid_conf_formatters, na_rep='-'))
|
| 3190 |
|
| 3191 |
else:
|
|
@@ -4767,8 +4767,21 @@ def main():
|
|
| 4767 |
# 11. Display Confidence Optimisation Results
|
| 4768 |
elif st.session_state.get('confidence_results_df') is not None and not st.session_state.confidence_results_df.empty:
|
| 4769 |
st.subheader("📊 Confidence Setup Optimisation Results")
|
| 4770 |
-
|
| 4771 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4772 |
if 'MACD' in display_df_conf.columns: conf_formatters['MACD'] = '{}'
|
| 4773 |
if 'MA Slope' in display_df_conf.columns: conf_formatters['MA Slope'] = '{}'
|
| 4774 |
if 'Markov' in display_df_conf.columns: conf_formatters['Markov'] = '{}'
|
|
|
|
| 1305 |
st.metric("Strategy Score", f"{display_score:.2f}%")
|
| 1306 |
st.metric("Avg Profit per Trade (Active Tickers)", f"{avg_trade_profit:.2%}")
|
| 1307 |
net_return_pct = avg_trade_profit * total_trades * 100
|
| 1308 |
+
st.metric("Moneypile Score", f"{net_return_pct:.1f}", help="The total 'Pile of Money'. Sum of all trade percentages (Winners - Losers).")
|
| 1309 |
|
| 1310 |
st.text(f"Profitable Tickers: {good_tickers}")
|
| 1311 |
st.text(f"Losing Tickers: {bad_tickers}")
|
|
|
|
| 3167 |
st.session_state.worst_confidence_setups_list = []
|
| 3168 |
|
| 3169 |
# --- Display the table ---
|
| 3170 |
+
# [CHANGE] Rename the column for display purposes
|
| 3171 |
+
display_df_conf = results_df.head(60).rename(columns={'Net % Return': 'Moneypile Score'})
|
| 3172 |
|
| 3173 |
+
# [CHANGE] Update formatter key to 'Moneypile Score' and remove '%' from format string
|
| 3174 |
conf_formatters = {
|
| 3175 |
"Avg Profit/Trade": "{:.2%}",
|
| 3176 |
"Ticker G/B Ratio": "{:.2f}",
|
| 3177 |
"Trade G/B Ratio": "{:.2f}",
|
| 3178 |
+
"Moneypile Score": "{:.1f}",
|
| 3179 |
"Avg Entry Conf.": "{:.1f}%",
|
| 3180 |
"Good Score": "{:.4f}",
|
| 3181 |
"Bad Score": "{:.4f}",
|
|
|
|
| 3185 |
if 'MA Slope' in display_df_conf.columns: conf_formatters['MA Slope'] = '{}'
|
| 3186 |
if 'Markov' in display_df_conf.columns: conf_formatters['Markov'] = '{}'
|
| 3187 |
|
| 3188 |
+
valid_conf_formatters = {k: (lambda val, fmt=v: fmt.format(val) if pd.notna(val) else '-') for k, v in conf_formatters.items() if k in display_df_conf.columns}
|
|
|
|
| 3189 |
st.dataframe(display_df_conf.style.format(valid_conf_formatters, na_rep='-'))
|
| 3190 |
|
| 3191 |
else:
|
|
|
|
| 4767 |
# 11. Display Confidence Optimisation Results
|
| 4768 |
elif st.session_state.get('confidence_results_df') is not None and not st.session_state.confidence_results_df.empty:
|
| 4769 |
st.subheader("📊 Confidence Setup Optimisation Results")
|
| 4770 |
+
|
| 4771 |
+
# [CHANGE] Rename the column for display
|
| 4772 |
+
display_df_conf = st.session_state.confidence_results_df.head(60).rename(columns={'Net % Return': 'Moneypile Score'})
|
| 4773 |
+
|
| 4774 |
+
# [CHANGE] Update formatters to match
|
| 4775 |
+
conf_formatters = {
|
| 4776 |
+
"Avg Profit/Trade": "{:.2%}",
|
| 4777 |
+
"Ticker G/B Ratio": "{:.2f}",
|
| 4778 |
+
"Trade G/B Ratio": "{:.2f}",
|
| 4779 |
+
"Moneypile Score": "{:.1f}",
|
| 4780 |
+
"Avg Entry Conf.": "{:.1f}%",
|
| 4781 |
+
"Good Score": "{:.4f}",
|
| 4782 |
+
"Bad Score": "{:.4f}",
|
| 4783 |
+
"Norm. Score %": "{:.2f}%"
|
| 4784 |
+
}
|
| 4785 |
if 'MACD' in display_df_conf.columns: conf_formatters['MACD'] = '{}'
|
| 4786 |
if 'MA Slope' in display_df_conf.columns: conf_formatters['MA Slope'] = '{}'
|
| 4787 |
if 'Markov' in display_df_conf.columns: conf_formatters['Markov'] = '{}'
|