Drift uses a Monte Carlo simulation engine to run 100,000 parallel scenarios of your financial future. Instead of giving you a single prediction, it shows you a probability distribution of possible outcomes—from worst-case to best-case scenarios.
Monte Carlo simulation is a computational technique that runs thousands of randomized scenarios to model uncertainty. Each scenario simulates your financial journey month-by-month, applying random variations to:
Income fluctuations (±5% monthly variance)
Spending volatility (±15% based on your patterns)
Market returns (7% annual mean, 15% standard deviation)
Career growth (3% annual raises, 15% promotion chance every 6 months)
By default, Drift runs 100,000 simulations to ensure statistical accuracy. This provides confidence intervals from the 10th percentile (worst likely case) to the 90th percentile (best likely case).
Drift uses NumPy vectorization to simulate all 100,000 scenarios simultaneously rather than looping through them individually. This provides a 50-100x speedup compared to naive Python loops.From monte_carlo.py:46-61, random numbers are pre-generated for all simulations:
For large simulations (50,000+), Drift splits work across multiple CPU cores using Python’s multiprocessing.From monte_carlo.py:237-262:
if n_workers is None: n_workers = min(cpu_count(), 4) # Cap at 4 for demo# Split work across workersbatches = np.array_split(seeds, n_workers)batch_args = [(request, batch, i) for i, batch in enumerate(batches)]# Run parallel simulations with progress reportingif n_workers > 1: results_list = [] completed = 0 with Pool(n_workers) as pool: for balances, batch_id in pool.imap_unordered(run_simulation_batch, batch_args): results_list.append(balances) completed += len(balances) if progress_callback: progress_callback({ "type": "progress", "completed": int(completed), "total": int(n_simulations), "worker": int(batch_id), "percentage": round(completed / n_simulations * 100, 2) }) final_balances = np.concatenate(results_list)
On a 4-core machine, a 100,000 simulation run completes in under 5 seconds. The TypeScript API calls the Python engine via subprocess for optimal performance.
Drift supports per-account modeling for credit cards and loans. When enabled (via Plaid integration), the simulation tracks:
Credit card interest accrual at card-specific APRs (monthly compounding)
Minimum payments reducing balances
Loan amortization with principal and interest
From monte_carlo.py:158-176:
# Credit card interest accrual and paymentsif card_balances is not None: for i in range(len(params.credit_cards)): # Monthly interest on outstanding balance monthly_rate = card_aprs[i] / 12 interest = card_balances[:, i] * monthly_rate credit_interest += interest # Add interest to balance card_balances[:, i] += interest # Minimum payment reduces balance payment = np.minimum(card_min_payments[i], card_balances[:, i]) card_balances[:, i] -= payment credit_payments += payment
Credit card debt at 18-25% APR can significantly reduce your success probability. The simulation models compound interest month-by-month to show the true cost of carrying balances.