liaoch commited on
Commit
4bc0e33
·
1 Parent(s): b141331

Fix: Ensure sample portfolio paths are always generated

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -88,14 +88,14 @@ def run_simulation(
88
  if not simulation_failed_this_run:
89
  success_count += 1
90
 
91
- if swr == 0.035 and i < 100:
92
- current_swr_paths.append(path)
93
 
94
  success_probability = success_count / num_simulations
95
  all_results.append({'swr': swr, 'success_rate': success_probability})
96
 
97
- if swr == 0.035:
98
- portfolio_paths_for_plotting[swr] = current_swr_paths
99
 
100
  final_swr = 0.0
101
  initial_annual_withdrawal_amount = 0.0
 
88
  if not simulation_failed_this_run:
89
  success_count += 1
90
 
91
+ # Always append path, we'll select a sample later
92
+ current_swr_paths.append(path)
93
 
94
  success_probability = success_count / num_simulations
95
  all_results.append({'swr': swr, 'success_rate': success_probability})
96
 
97
+ # Store a sample of paths for this SWR
98
+ portfolio_paths_for_plotting[swr] = current_swr_paths[:100] # Store up to 100 paths
99
 
100
  final_swr = 0.0
101
  initial_annual_withdrawal_amount = 0.0