Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -315,7 +315,33 @@ app = gr.TabbedInterface(
|
|
| 315 |
outputs=["dataframe", "json", gr.Plot()],
|
| 316 |
title="🛠️ Manual Config Mode"
|
| 317 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 318 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 319 |
# 🧪 Manual Battle Mode (Dual Sliders + Histogram)
|
| 320 |
get_manual_battle_interface(),
|
| 321 |
|
|
|
|
| 315 |
outputs=["dataframe", "json", gr.Plot()],
|
| 316 |
title="🛠️ Manual Config Mode"
|
| 317 |
),
|
| 318 |
+
def dual_manual_battle(
|
| 319 |
+
sb1, tmin1, tmax1, w1, tp1a, tp2a, r1a, r2a, risk1, pt1, fat1, trump1,
|
| 320 |
+
sb2, tmin2, tmax2, w2, tp1b, tp2b, r1b, r2b, risk2, pt2, fat2, trump2
|
| 321 |
+
):
|
| 322 |
+
df1, s1 = simulate_tp_strategy_full(sb1, tmin1, tmax1, w1, tp1a, tp2a, r1a, r2a, risk1, pt1, fat1, trump1)
|
| 323 |
+
df2, s2 = simulate_tp_strategy_full(sb2, tmin2, tmax2, w2, tp1b, tp2b, r1b, r2b, risk2, pt2, fat2, trump2)
|
| 324 |
|
| 325 |
+
s1["Strategy"] = "Manual A"
|
| 326 |
+
s2["Strategy"] = "Manual B"
|
| 327 |
+
|
| 328 |
+
comparison_df = pd.DataFrame([s1, s2])
|
| 329 |
+
comparison_df = comparison_df[["Strategy", "Final Balance", "Sharpe Ratio", "EdgeCast Score", "Max Drawdown %"]]
|
| 330 |
+
|
| 331 |
+
for col in ["Final Balance", "Sharpe Ratio", "EdgeCast Score"]:
|
| 332 |
+
best_val = comparison_df[col].astype(float).max()
|
| 333 |
+
comparison_df[col] = [
|
| 334 |
+
f"{val} 🏆" if float(val) == best_val else val for val in comparison_df[col]
|
| 335 |
+
]
|
| 336 |
+
|
| 337 |
+
fig = go.Figure()
|
| 338 |
+
fig.add_trace(go.Scatter(x=df1["Week"], y=df1["End Balance"], name="Manual A"))
|
| 339 |
+
fig.add_trace(go.Scatter(x=df2["Week"], y=df2["End Balance"], name="Manual B"))
|
| 340 |
+
fig.update_layout(title="⚔️ Manual Strategy Battle", xaxis_title="Week", yaxis_title="Balance")
|
| 341 |
+
|
| 342 |
+
return comparison_df, fig
|
| 343 |
+
|
| 344 |
+
|
| 345 |
# 🧪 Manual Battle Mode (Dual Sliders + Histogram)
|
| 346 |
get_manual_battle_interface(),
|
| 347 |
|