zman35 commited on
Commit
e7780f0
Β·
verified Β·
1 Parent(s): 9a85080

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -38
app.py CHANGED
@@ -307,31 +307,20 @@ def equity_curve_plot(df, label="Equity Curve"):
307
 
308
  # 🎯 Preset Tab
309
 
310
- def run_preset_strategy(style, fatigue=0.0, trump_vol=0.0):
311
-
312
- if style not in strategy_presets:
313
-
314
- return pd.DataFrame(), {}, go.Figure(), "Please select a strategy to begin."
315
-
316
  config = strategy_presets[style]
 
 
317
 
318
  df, summary = simulate_tp_strategy_full(
319
-
320
  config["starting_balance"], config["trades_min"], config["trades_max"], config["weeks"],
321
-
322
  config["tp1_prob"], config["tp2_prob"], config["tp1_r"], config["tp2_r"],
323
-
324
- config["base_risk_pct"], config["profit_target"],
325
-
326
- fatigue=fatigue, trump_vol=trump_vol
327
-
328
  )
329
 
330
  return df, summary, equity_curve_plot(df, style), config["description"]
331
 
332
 
333
-
334
-
335
  # πŸ› οΈ Manual Tab
336
 
337
  def run_manual_sim(starting_balance, trades_min, trades_max, weeks,
@@ -351,8 +340,6 @@ def run_manual_sim(starting_balance, trades_min, trades_max, weeks,
351
  return df, summary, chart
352
 
353
 
354
-
355
-
356
  # βš”οΈ Manual Battle Mode (Dual Sim)
357
 
358
  def dual_manual_battle(
@@ -646,27 +633,17 @@ app = gr.TabbedInterface(
646
  # 🎯 Preset Mode
647
 
648
  gr.Interface(
649
-
650
- fn=run_preset_strategy,
651
-
652
- inputs=gr.Dropdown(
653
-
654
- choices=["None"] + list(strategy_presets.keys()),
655
-
656
- value="None",
657
-
658
- label="Select Strategy"
659
-
660
- ),
661
-
662
- outputs=["dataframe", "json", gr.Plot(), "text"],
663
-
664
- title="🎯 Preset Mode"
665
-
666
- ),
667
-
668
-
669
-
670
 
671
  # πŸ› οΈ Manual Config
672
 
 
307
 
308
  # 🎯 Preset Tab
309
 
310
+ def run_preset_strategy_with_toggle(style, enable_fatigue, fatigue, enable_trump, trump_vol):
 
 
 
 
 
311
  config = strategy_presets[style]
312
+ applied_fatigue = fatigue if enable_fatigue else 0.0
313
+ applied_trump = trump_vol if enable_trump else 0.0
314
 
315
  df, summary = simulate_tp_strategy_full(
 
316
  config["starting_balance"], config["trades_min"], config["trades_max"], config["weeks"],
 
317
  config["tp1_prob"], config["tp2_prob"], config["tp1_r"], config["tp2_r"],
318
+ config["base_risk_pct"], config["profit_target"], applied_fatigue, applied_trump
 
 
 
 
319
  )
320
 
321
  return df, summary, equity_curve_plot(df, style), config["description"]
322
 
323
 
 
 
324
  # πŸ› οΈ Manual Tab
325
 
326
  def run_manual_sim(starting_balance, trades_min, trades_max, weeks,
 
340
  return df, summary, chart
341
 
342
 
 
 
343
  # βš”οΈ Manual Battle Mode (Dual Sim)
344
 
345
  def dual_manual_battle(
 
633
  # 🎯 Preset Mode
634
 
635
  gr.Interface(
636
+ fn=run_preset_strategy_with_toggle,
637
+ inputs=[
638
+ gr.Dropdown(choices=list(strategy_presets.keys()), label="Select Strategy"),
639
+ gr.Checkbox(label="Enable Fatigue"),
640
+ gr.Slider(0, 1, 0.0, step=0.1, label="Fatigue Level"),
641
+ gr.Checkbox(label="Enable Trump Volatility"),
642
+ gr.Slider(0, 1, 0.0, step=0.1, label="Trump Volatility Index")
643
+ ],
644
+ outputs=["dataframe", "json", gr.Plot(), "text"],
645
+ title="🎯 Preset Mode"
646
+ )
 
 
 
 
 
 
 
 
 
 
647
 
648
  # πŸ› οΈ Manual Config
649