'use client' import { useEffect, useState } from 'react' interface ProjectionMonth { month: number date: string startCapital: number profit: number withdrawal: number btcSweep: number endCapital: number btcHoldings: number totalCashOut: number netWorth: number } interface ScenarioResult { monthlyRate: number label: string finalNetWorth: number finalTrading: number finalBTC: number totalCashOut: number color: string } interface TradingStats { totalPnL: number totalTrades: number winners: number losers: number winRate: number monthlyPnL: { month: string; pnl: number; trades: number }[] } export default function ProjectionPage() { const [currentCapital, setCurrentCapital] = useState(0) const [loading, setLoading] = useState(true) const [selectedScenario, setSelectedScenario] = useState(70) const [tradingStats, setTradingStats] = useState(null) const [totalDeposits, setTotalDeposits] = useState(0) const [btcPrice, setBtcPrice] = useState(100000) // Default, will be fetched // Strategy Parameters (Jan 2026) const STARTING_CAPITAL = 1437 // Actual starting balance when v11.2 went live const TRADING_CAP = 50000 const BTC_MONTHLY_GROWTH = 0.05 // 5% per month (60% annual) const START_DATE = new Date('2026-01-06') // When v11.2 went live // Tiered Withdrawal Rules const getWithdrawal = (capital: number): number => { if (capital >= 30000) return 1200 if (capital >= 10000) return 600 if (capital >= 3000) return 300 if (capital >= 1500) return 100 return 0 } useEffect(() => { async function fetchData() { try { // Fetch current BTC price from CoinGecko try { const btcResponse = await fetch('https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd') const btcData = await btcResponse.json() if (btcData.bitcoin?.usd) { setBtcPrice(btcData.bitcoin.usd) } } catch (btcError) { console.error('Failed to fetch BTC price, using default:', btcError) } // Fetch account summary const accountResponse = await fetch('/api/drift/account-summary') const accountData = await accountResponse.json() if (accountData.success) { setCurrentCapital(accountData.drift?.freeCollateral || accountData.freeCollateral || 0) // Total deposits from Drift if (accountData.spotPositions?.usdc?.cumulativeDeposits) { setTotalDeposits(parseInt(accountData.spotPositions.usdc.cumulativeDeposits) / 1e6) } } // Fetch trading stats (all time, not just 30 days) const statsResponse = await fetch('/api/analytics/stats?days=365') const statsData = await statsResponse.json() if (statsData.success && statsData.stats) { const stats = statsData.stats.realTrades setTradingStats({ totalPnL: parseFloat(stats.totalPnL?.replace('$', '') || '0'), totalTrades: stats.total || 0, winners: stats.winning || 0, losers: stats.losing || 0, winRate: parseFloat(stats.winRate?.replace('%', '') || '0'), monthlyPnL: [] // Would need separate endpoint for monthly breakdown }) } } catch (error) { console.error('Failed to fetch data:', error) } finally { setLoading(false) } } fetchData() }, []) // Generate projection for a given monthly rate const generateProjection = (monthlyRate: number): ProjectionMonth[] => { const months: ProjectionMonth[] = [] let tradingCapital = STARTING_CAPITAL let btcHoldings = 0 let totalCashOut = 0 for (let month = 1; month <= 12; month++) { const monthDate = new Date(START_DATE) monthDate.setMonth(START_DATE.getMonth() + month - 1) const startCapital = tradingCapital const profit = tradingCapital * monthlyRate tradingCapital += profit // Tiered withdrawal const withdrawal = getWithdrawal(tradingCapital) tradingCapital -= withdrawal totalCashOut += withdrawal // BTC sweep (excess over $50k) let btcSweep = 0 if (tradingCapital > TRADING_CAP) { btcSweep = tradingCapital - TRADING_CAP tradingCapital = TRADING_CAP } // BTC holdings grow + new sweep btcHoldings = btcHoldings * (1 + BTC_MONTHLY_GROWTH) + btcSweep const netWorth = tradingCapital + btcHoldings + totalCashOut months.push({ month, date: monthDate.toLocaleDateString('en-US', { month: 'short', year: 'numeric' }), startCapital, profit, withdrawal, btcSweep, endCapital: tradingCapital, btcHoldings, totalCashOut, netWorth }) } return months } // Calculate current actual monthly rate const daysElapsed = Math.max(1, Math.floor((new Date().getTime() - START_DATE.getTime()) / (1000 * 60 * 60 * 24))) const actualMonthlyRate = currentCapital > STARTING_CAPITAL && daysElapsed >= 1 ? Math.round((Math.pow(currentCapital / STARTING_CAPITAL, 30 / daysElapsed) - 1) * 100) / 100 : 0 // Pre-calculate all scenarios (including current rate if positive) const baseScenarios: ScenarioResult[] = [ { monthlyRate: 0.50, label: '50%/mo (Very Conservative)', finalNetWorth: 0, finalTrading: 0, finalBTC: 0, totalCashOut: 0, color: 'text-gray-400' }, { monthlyRate: 0.70, label: '70%/mo (Base Case)', finalNetWorth: 0, finalTrading: 0, finalBTC: 0, totalCashOut: 0, color: 'text-green-400' }, { monthlyRate: 0.90, label: '90%/mo (Optimistic)', finalNetWorth: 0, finalTrading: 0, finalBTC: 0, totalCashOut: 0, color: 'text-blue-400' }, { monthlyRate: 1.10, label: '110%/mo (Strong)', finalNetWorth: 0, finalTrading: 0, finalBTC: 0, totalCashOut: 0, color: 'text-purple-400' }, { monthlyRate: 1.50, label: '150%/mo (Exceptional)', finalNetWorth: 0, finalTrading: 0, finalBTC: 0, totalCashOut: 0, color: 'text-yellow-400' }, ] // Add current rate as first scenario if it's a valid positive rate if (actualMonthlyRate > 0 && !loading) { baseScenarios.unshift({ monthlyRate: actualMonthlyRate, label: `⚡ ${Math.round(actualMonthlyRate * 100)}%/mo (Current Actual)`, finalNetWorth: 0, finalTrading: 0, finalBTC: 0, totalCashOut: 0, color: 'text-cyan-400' }) } const scenarios = baseScenarios.map(scenario => { const projection = generateProjection(scenario.monthlyRate) const final = projection[projection.length - 1] return { ...scenario, finalNetWorth: final.netWorth, finalTrading: final.endCapital, finalBTC: final.btcHoldings, totalCashOut: final.totalCashOut } }) const currentProjection = generateProjection(selectedScenario / 100) const finalMonth = currentProjection[currentProjection.length - 1] const formatCurrency = (value: number) => { return new Intl.NumberFormat('en-US', { style: 'currency', currency: 'USD', minimumFractionDigits: 0, maximumFractionDigits: 0 }).format(value) } // Format BTC values with both USD and BTC quantity const formatBTC = (usdValue: number) => { const btcAmount = usdValue / btcPrice return `${formatCurrency(usdValue)} / ${btcAmount.toFixed(2)} BTC` } return (
{/* Header */}

📈 Financial Projection

12-Month Strategy: Tiered Withdrawals + $50k Cap + BTC Sweep

{/* Strategy Rules Card */}

⚡ Strategy Rules

Trading Cap
$50,000
Max active trading capital
Excess Strategy
→ BTC
Monthly sweep to Bitcoin
BTC Growth
5%/mo
60% annual appreciation
Withdrawals
Tiered
$100→$300→$600→$1,200
{/* Tiered Withdrawal Rules */}

💸 Tiered Withdrawal Schedule

Capital < $3k
$100/mo
Capital < $10k
$300/mo
Capital < $30k
$600/mo
Capital ≥ $30k
$1,200/mo
{/* Current Status */}

📊 Current Status

Starting Capital
{formatCurrency(STARTING_CAPITAL)}
Live Capital
{loading ? '...' : formatCurrency(currentCapital)}
Strategy
ML v11.2
Pyramiding
7x + 7x
{/* ACTUAL PROGRESS vs PLAN */}

📈 Actual Progress vs Plan

{/* Summary Stats */}
Total P&L
= 0 ? 'text-green-400' : 'text-red-400'}`}> {loading ? '...' : formatCurrency(currentCapital - STARTING_CAPITAL)}
Total Trades
{loading ? '...' : tradingStats?.totalTrades || 0}
Win Rate
= 50 ? 'text-green-400' : 'text-yellow-400'}`}> {loading ? '...' : tradingStats ? `${tradingStats.winRate.toFixed(1)}%` : '0%'}
Capital Change
= 0 ? 'text-green-400' : 'text-red-400'}`}> {loading ? '...' : `${((currentCapital - STARTING_CAPITAL) / STARTING_CAPITAL * 100).toFixed(1)}%`}
Net Profit
= 0 ? 'text-green-400' : 'text-red-400'}`}> {loading ? '...' : formatCurrency(currentCapital - STARTING_CAPITAL)}
{/* Plan Comparison */}

Expected vs Actual (70%/mo target)

{(() => { const daysElapsed = Math.max(0, Math.floor((new Date().getTime() - START_DATE.getTime()) / (1000 * 60 * 60 * 24))) const monthsElapsed = daysElapsed / 30 const dailyRate = Math.pow(1.70, 1/30) - 1 // 70%/month converted to daily compound rate const expectedCapital = STARTING_CAPITAL * Math.pow(1 + dailyRate, daysElapsed) const expectedGain = expectedCapital - STARTING_CAPITAL const actualGain = currentCapital - STARTING_CAPITAL const onTrack = currentCapital >= expectedCapital return (
Days Since Start (Jan 6, 2026): {daysElapsed} days ({monthsElapsed.toFixed(1)} months)
Expected Capital @ 70%/mo: {formatCurrency(expectedCapital)} (+{formatCurrency(expectedGain)})
Current Capital: = 0 ? 'text-green-400' : 'text-red-400'}`}> {loading ? '...' : formatCurrency(currentCapital)} ({actualGain >= 0 ? '+' : ''}{formatCurrency(actualGain)})
Status vs Plan: {loading ? '...' : onTrack ? '✅ ON TRACK' : '⚠️ BEHIND'} ({formatCurrency(currentCapital - expectedCapital)}, {((currentCapital / expectedCapital - 1) * 100).toFixed(1)}%)
Actual Daily Return: = 0 ? 'text-green-400' : 'text-red-400'}`}> {loading || daysElapsed === 0 ? '...' : `${((Math.pow(currentCapital / STARTING_CAPITAL, 1 / Math.max(1, daysElapsed)) - 1) * 100).toFixed(2)}%/day`} {daysElapsed > 0 && !loading && ` (≈ ${((Math.pow(currentCapital / STARTING_CAPITAL, 30 / Math.max(1, daysElapsed)) - 1) * 100).toFixed(0)}%/mo)`}
) })()}
{/* Scenario Selector */}

🎯 Select Monthly Return Scenario

{/* Current Actual Rate Button */} {actualMonthlyRate > 0 && !loading && ( )} {/* Preset Scenarios */} {[50, 70, 90, 110, 150].map(rate => ( ))}
{/* Year-End Summary for Selected Scenario */}

Year 1 Result @ {selectedScenario}%/mo

Trading Account
{formatCurrency(finalMonth.endCapital)}
BTC Holdings
{formatBTC(finalMonth.btcHoldings)}
Cash Withdrawn
{formatCurrency(finalMonth.totalCashOut)}
Total Net Worth
{formatCurrency(finalMonth.netWorth)}
{/* Scenario Comparison Table */}

📊 All Scenarios Comparison

{scenarios.map((scenario, idx) => ( ))}
Scenario Trading BTC Holdings Cash Out Net Worth
{scenario.label} {formatCurrency(scenario.finalTrading)} {formatBTC(scenario.finalBTC)} {formatCurrency(scenario.totalCashOut)} {formatCurrency(scenario.finalNetWorth)}
{/* Monthly Breakdown Table */}

📅 Month-by-Month Breakdown @ {selectedScenario}%/mo

{currentProjection.map((month, idx) => ( ))}
Month Start Profit Withdraw →BTC End BTC Total Net Worth
{month.date} {formatCurrency(month.startCapital)} +{formatCurrency(month.profit)} {month.withdrawal > 0 ? `-${formatCurrency(month.withdrawal)}` : '-'} {month.btcSweep > 0 ? formatBTC(month.btcSweep) : '-'} {formatCurrency(month.endCapital)} {formatBTC(month.btcHoldings)} {formatCurrency(month.netWorth)}
{/* Data Foundation */}

🔬 Data Foundation

ML v11.2 Backtest Results

  • 44 trades over 8 days
  • 84.09% win rate
  • 3.061 profit factor
  • • Extrapolated: ~176%/mo raw
  • • Base case: 70%/mo (conservative)

Pyramiding Configuration

  • • Base leverage: 7x
  • • Stack leverage: 7x
  • • Max total: 14x
  • • Max pyramid levels: 2
  • • Window: 4 hours (48 bars)
{/* Risk Disclaimer */}

⚠️ Important Disclaimer

These projections are based on backtested results and are NOT guaranteed. Past performance does not guarantee future results. Cryptocurrency trading involves substantial risk of loss. The projections assume consistent market conditions and strategy performance, which may not occur. Only trade with capital you can afford to lose.

{/* Footer */}

Strategy: ML v11.2 + Pyramiding | Exchange: MEXC (SOL/USDT Perp)

Last Updated: January 2026

) }