const WORK = [
  {
    id: "peak6",
    where: "PEAK6",
    role: "Trading Micro Intern",
    when: "Aug 2026",
    tag: "incoming",
    color: "#22c55e",
    start: "2026-08-01",
    end: "2026-08-31",
    location: "Chicago, IL",
    logo: "/assets/logos/peak6.ico",
    body: "Incoming trading micro internship in August 2026.",
    bullets: [
      "Incoming trading micro internship in August 2026.",
    ],
  },
  {
    id: "scalp",
    where: "SCALP Trade",
    role: "Quantitative Trading Intern",
    when: "Jun – Aug 2026",
    tag: "incoming",
    color: "#22c55e",
    start: "2026-06-01",
    end: "2026-08-31",
    location: "Chicago, IL",
    logo: "/assets/logos/scalptrade.png",
    body: "Incoming quantitative trading internship for summer 2026.",
    bullets: [
      "Incoming quantitative trading internship for summer 2026.",
      "Part of a 2026 run of trading roles alongside Valkyrie and PEAK6.",
    ],
  },
  {
    id: "valkyrie",
    where: "Valkyrie Trading",
    role: "Trading Micro Intern",
    when: "May 2026",
    tag: "incoming",
    color: "#22c55e",
    start: "2026-05-01",
    end: "2026-05-31",
    location: "Chicago, IL",
    logo: "/assets/logos/valkyrie.png",
    body: "Incoming trading micro internship.",
    bullets: [
      "Incoming trading micro internship in May 2026.",
    ],
  },
  {
    id: "gnosis",
    where: "Gnosis",
    role: "Quantitative Research Intern",
    when: "Feb 2026 - present",
    tag: "now",
    color: "#6366f1",
    start: "2026-02-01",
    end: null,
    location: "Prague, Czechia",
    logo: "/assets/logos/gnosis.png",
    body: "Researching prediction-market alpha and trader behavior at a crypto-native trading firm in Prague.",
    bullets: [
      "Current work centers on prediction-market alpha, order flow, and trader behavior.",
      "Based in Prague while studying abroad and working on market microstructure questions.",
    ],
  },
  {
    id: "demand",
    where: "DemandEngine",
    role: "Founder & Solo Full-Stack Engineer",
    when: "Mar - Aug 2025",
    tag: "shipped",
    color: "#8b5cf6",
    start: "2025-03-15",
    end: "2025-08-31",
    location: "Remote",
    logo: "/assets/logos/demandengine.png",
    body: "Built and shipped a product end to end as a solo founder and engineer, covering data pipelines, modeling, product, infra, auth, payments, and observability.",
    bullets: [
      "Built an AI-driven SaaS idea generator analyzing millions of online discussions.",
      "Ran the stack on GCP with Cloud Run, Cloud SQL, CI/CD, and Stripe billing.",
      "Handled product, infra, auth, payments, and observability solo.",
    ],
  },
  {
    id: "mfams",
    where: "Michigan Finance & Math Society",
    role: "Co-President · VP External · Quant Sports Betting Lead",
    when: "Feb 2025 - present",
    color: "#ec4899",
    start: "2025-02-01",
    end: null,
    location: "Ann Arbor, MI",
    logo: "/assets/logos/mfams.png",
    segments: [
      { title: "Quantitative Sports Betting Lead", start: "2025-02-01", end: "2025-05-01" },
      { title: "VP External", start: "2025-05-01", end: "2026-01-01" },
      { title: "Co-President", start: "2026-01-01", end: null },
    ],
    body: "Built and led the NCAA point-spread research process behind the Hoops-Spread model.",
    bullets: [
      "Ran a multi-factor NCAA point-spread strategy with out-of-sample ROI +9.8% and Sharpe 2.96 over 15k+ bets.",
      "Led the quantitative sports betting team before stepping into VP External and then co-president roles.",
      "Helped turn club research into a live, testable market model.",
    ],
  },
  {
    id: "rocket",
    where: "Rocket Lab",
    role: "Structural Analysis Intern",
    when: "Sep - Nov 2024",
    color: "#f97316",
    start: "2024-09-15",
    end: "2024-11-30",
    location: "Long Beach, CA",
    logo: "/assets/logos/rocketlab.png",
    body: "Structural-analysis internship on satellite hardware with heavy FEA, model reduction, and test-standardization work.",
    bullets: [
      "Reduced full-satellite modal analysis runtime from roughly 1.5 hours to under 5 minutes with a reduced-order composite fuel-tank model.",
      "Closed a thermal-analysis risk item ahead of PDR by verifying structural integrity under orbital temperature gradients.",
      "Established a standardized composite-insert test workflow and used chi-square analysis to derive NASA-compliant B-basis allowables.",
    ],
  },
  {
    id: "harris",
    where: "Harris",
    role: "Building Physics Intern",
    when: "May - Jul 2024",
    color: "#ef4444",
    start: "2024-05-15",
    end: "2024-07-31",
    location: "Arlington, VA",
    logo: "/assets/logos/harris.png",
    body: "Building-physics modeling work focused on emissions research and data-center thermal design.",
    bullets: [
      "Co-authored the first ASHRAE paper on modular-build emissions.",
      "Designed a thermal-storage cooling system for a data center.",
    ],
  },
  {
    id: "copeland",
    where: "Copeland",
    role: "Mechanical Engineering Co-op",
    when: "Jan - Apr 2024",
    color: "#10b981",
    start: "2024-01-15",
    end: "2024-04-30",
    location: "Sidney, OH",
    logo: "/assets/logos/copeland.png",
    body: "Numerical simulation and reliability analysis work centered on compressor collisions and automated test analytics.",
    bullets: [
      "Simulated compressor part collisions in NX Nastran.",
      "Automated lab-test analytics in Python to verify long-term reliability.",
    ],
  },
  {
    id: "robosub",
    where: "Michigan Robotic Submarine",
    role: "Mechanical Team Member",
    when: "Sep 2023 - Jan 2024",
    color: "#1d4ed8",
    start: "2023-09-15",
    end: "2024-01-31",
    location: "Ann Arbor, MI",
    logo: "/assets/logos/robosub.png",
    body: "Mechanical design and CFD work on the Michigan Robotic Submarine team.",
    bullets: [
      "Designed and CFD-optimized a torpedo launcher that materially improved RoboSub scoring potential.",
      "Integrated the launcher cleanly into the hull and overall mechanical package.",
    ],
  },
  {
    id: "stealth",
    where: "Stealth startup",
    role: "Software Engineer",
    when: "May - Jul 2023",
    color: "#3b82f6",
    start: "2023-05-15",
    end: "2023-07-31",
    location: "Remote",
    logo: "/assets/logos/stealth.png",
    body: "Early product-side ML work building bilingual voice and retrieval systems for a conversational customer-service platform.",
    bullets: [
      "Built bilingual voice and RAG systems for a conversational customer-service platform.",
      "Contract software work done remotely before the shift toward trading and market research.",
    ],
  },
  {
    id: "emtech",
    where: "EMTECH",
    role: "Engineering Research Intern",
    when: "Jun - Aug 2021",
    color: "#6d28d9",
    start: "2021-06-15",
    end: "2021-08-31",
    location: "Athens, Greece",
    logo: "/assets/logos/emtech.png",
    body: "Engineering research internship covering thermal and electrical analyses for simulator work later used in ESA's Space Rider mission.",
    bullets: [
      "Co-authored an ESA CubeSat subsystem guide.",
      "Delivered thermal and electrical analyses for simulator work later used in ESA’s Space Rider mission.",
    ],
  },
];

const COMPETITIONS = [
  {
    name: "IMC Prosperity Global Trading Challenge",
    when: "2025",
    headline: "41st / 12,626",
    detail: "Top 0.33% globally",
    color: "#6EE7F4",
  },
  {
    name: "Michigan Quant Conference - Market Making",
    when: "2025",
    headline: "2nd place",
    detail: "IMC Trading + Old Mission-sponsored",
    color: "#ec4899",
  },
];

const PROJECTS = [
  {
    id: "hedgerl",
    name: "Deep RL Hedger",
    repo: "bcosm/rBergomi-HedgeRL",
    command: "hedgerl",
    blurb: "Options-based RL agent hedging a 10k-share SPY book with long-dated calls and puts. Trained on 100k+ rBergomi paths and validated in Backtrader on historical SPY data.",
    highlights: [
      "GPU rBergomi simulator produces 100k-path training sets with CPU fallback when needed.",
      "Backtrader validation on real SPY data shows materially lower volatility, drawdown, and cost than classical delta hedging.",
      "State includes spot, option mids, holdings, portfolio Greeks, time-to-go, vol, and lagged changes; actions are continuous call/put position deltas.",
    ],
    stats: [
      { v: "−23.8%", k: "volatility" },
      { v: "−96.0%", k: "trading costs" },
      { v: "−36.3%", k: "max drawdown" },
      { v: "24.1×", k: "hedge efficiency" },
      { v: "95%", k: "seed win-rate" },
      { v: "100k", k: "rBergomi GPU" },
    ],
    methods: ["rBergomi", "RecurrentPPO (LSTM)", "Backtrader", "Optuna HPO", "CuPy/CUDA"],
    visuals: [
      {
        src: "/assets/visuals/hedgerl/hedgerl_headline_reductions.png",
        label: "headline reductions",
        alt: "Bar chart of RL hedger headline reductions vs delta hedge for volatility, drawdown, and trading costs",
      },
      {
        src: "/assets/visuals/hedgerl/hedgerl_pareto_scatter.png",
        label: "cost / risk scatter",
        alt: "Scatter plot of Pareto grid showing mean cost versus mean absolute PnL risk proxy on a log scale",
      },
      {
        src: "/assets/visuals/hedgerl/pareto_plot.png",
        label: "pareto frontier",
        alt: "Pareto frontier plot from rBergomi HedgeRL experiments",
      },
    ],
    detailSections: [
      {
        title: "What this is",
        body: "A Deep RL agent that hedges a 10,000-share SPY position with liquid long-dated ATM calls and puts. The policy is Recurrent PPO with an LSTM, trained on 100k rBergomi rough-volatility paths and validated in Backtrader on historical SPY underlying plus options.",
      },
      {
        title: "How it works",
        bullets: [
          "Simulator: rBergomi paths plus ATM option prices, with CuPy/CUDA acceleration and CPU fallback.",
          "State: spot, ATM call/put mids, current call/put holdings, portfolio delta and gamma, time-to-go, volatility, and lagged changes.",
          "Actions: continuous call and put contract deltas, clipped to +/-100 contracts per step.",
          "Reward: minimize absolute delta PnL or risk loss plus transaction costs, with position limits enforced.",
          "Training: Optuna HPO followed by final long training runs; evaluation uses multiple seeds and normalized observations.",
        ],
      },
      {
        title: "Backtesting setup",
        bullets: [
          "Historical SPY backtests use underlying plus options data.",
          "Costs are parameterized with contract commissions and slippage.",
          "Baseline is classical delta hedging; headline comparison tracks volatility, max drawdown, and total trading cost.",
        ],
      },
      {
        title: "Reproduce quickly",
        code: "pip install -r requirements.txt && pip install -e .\nhedgerl train --hpo\nhedgerl train --loss_type abs --w 0.05 --lam 0.001\nhedgerl backtest",
      },
      {
        title: "Repo map",
        body: "Key pieces: src/sim/rbergomi_sim.py for GPU rough-vol paths and ATM pricing; src/env/hedging_env.py for state/action/reward; src/agents/train_ppo.py for RecurrentPPO and Optuna; src/backtester/* for Backtrader, model wrapper, and delta baseline; model_files/* for exported weights and normalization.",
      },
      {
        title: "Notes and limitations",
        body: "Sim-to-real gaps around liquidity and microstructure remain. ATM selection uses robust mids with Black-Scholes fallback, commission and slippage are configurable, and the current scope is single-asset with multi-asset hedging still a roadmap item.",
      },
    ],
    notes: "State is 13-dim (spot, ATM call/put mids, holdings, portfolio Δ & Γ, time-to-go, vol, lagged changes). Actions: continuous call/put contract deltas, clipped to ±100/step. Reward: risk + λ·costs, with position limits. Backtests use historical SPY underlying plus options data.",
  },
  {
    id: "hoops",
    name: "Hoops-Spread - NCAA Point-Spread Alpha",
    repo: "bcosm/hoops-spread",
    command: "hoops",
    blurb: "XGBoost spread model with Boruta→SHAP selection and a 50+ subreddit cascading-sentiment pipeline. Walk-forward, half-Kelly, and built around market modeling, risk sizing, and signal evaluation.",
    highlights: [
      "Out-of-sample backtest covers 15,276 bets with half-Kelly sizing and walk-forward retraining.",
      "Fundamentals-only profile remains profitable, which keeps the sentiment uplift honest rather than hiding behind market priors.",
      "The upstream sentiment pipeline was designed to handle large Reddit corpora while respecting chronological leakage constraints.",
    ],
    stats: [
      { v: "+9.75%", k: "ROI (½-Kelly)" },
      { v: "63.2%", k: "hit rate" },
      { v: "2.96", k: "Sharpe" },
      { v: "+0.213", k: "mean CLV" },
      { v: "15,276", k: "bets" },
    ],
    methods: ["XGBoost", "Boruta-SHAP", "Optuna", "Walk-forward", "DistilBERT"],
    visuals: [
      {
        src: "/assets/visuals/hoops/hoops_equity_curve.png",
        label: "equity curve",
        alt: "Hoops-Spread walk-forward out-of-sample equity curve comparing market-signal and fundamental profiles",
      },
      {
        src: "/assets/visuals/hoops/hoops_drawdown.png",
        label: "drawdown",
        alt: "Hoops-Spread drawdown over time comparing market-signal and fundamental profiles",
      },
      {
        src: "/assets/visuals/hoops/hoops_yearly_roi.png",
        label: "yearly ROI",
        alt: "Hoops-Spread year-by-year out-of-sample ROI",
      },
      {
        src: "/assets/visuals/hoops/hoops_rolling_sharpe.png",
        label: "rolling Sharpe",
        alt: "Hoops-Spread rolling Sharpe over time",
      },
      {
        src: "/assets/visuals/hoops/hoops_clv_distribution.png",
        label: "CLV distribution",
        alt: "Hoops-Spread closing-line value distribution comparing market-signal and fundamental profiles",
      },
    ],
    detailSections: [
      {
        title: "What this is",
        body: "A reproducible NCAA point-spread pipeline that learns cover probability and sizes stakes with half-Kelly. It supports both a market-signal profile, which includes opening total as a weak market prior, and a fundamental profile that excludes it.",
      },
      {
        title: "How it works",
        bullets: [
          "Features include pace, efficiency, strength of schedule, travel and altitude, rolling team stats, and sentiment EMAs from 50+ subreddits.",
          "Sentiment uses a cascading VADER -> Flair -> DistilBERT pipeline with sarcasm handling, escalating only on uncertainty.",
          "Feature selection uses Boruta-SHAP; modeling uses Optuna-tuned XGBoost with SHAP attribution.",
          "Backtesting uses walk-forward refits, half-Kelly sizing, bankroll and VaR tracking, CLV, and bootstrap confidence intervals.",
        ],
      },
      {
        title: "Reproduce quickly",
        code: "pip install -e .\nhoops-spread modeling\nhoops-spread backtest\nhoops-spread all",
      },
      {
        title: "Repo map",
        body: "Core paths: hoops_spread/modeling/*, hoops_spread/backtesting/*, config/boruta_features_sentiment.txt, and /wip/* for upstream data and sentiment orchestration.",
      },
      {
        title: "Notes and limitations",
        body: "Limits, line moves, stale openers, and book rules can dominate realized ROI, so CLV is the primary edge signal. The backtest assumes execution near the modeled line with a fixed edge threshold; upstream collection is being consolidated into a single DAG.",
      },
    ],
    notes: "Walk-forward OOS 2008–2022 · train-on-prior-seasons starting 2007 · strict chronological splits · sentiment lags tip-off by 24h · half-Kelly staking. Fundamental profile (no market prior) remains profitable at +1.62% ROI as the honest baseline.",
  },
  {
    id: "pricer",
    name: "Hybrid Monte Carlo Options Pricer",
    repo: "bcosm/MonteCarloOptionsPricer-new",
    command: "pricer",
    status: "revamp in progress",
    blurb: "Modular American-style pricer on rough-vol paths. Four early-exercise estimators plus an optional Torch Bayesian layer for uncertainty.",
    highlights: [
      "C++17 / OpenMP engine with rough-vol path simulation, early-exercise estimators, and optional LibTorch Bayesian post-processing.",
      "Combines asymptotic analysis, branching processes, Longstaff-Schwartz, and martingale optimization.",
      "The project is being rebuilt now, so the site keeps the working playground and architecture visible while the revamp finishes.",
    ],
    stats: [
      { v: "4", k: "pricing methods" },
      { v: "C++17", k: "core engine" },
      { v: "OpenMP", k: "parallelism" },
      { v: "Torch", k: "BNN layer" },
    ],
    methods: ["C++ / OpenMP", "rBergomi FFT", "LSM", "Dual/martingale", "LibTorch BNN"],
    visuals: [
      {
        src: "/assets/visuals/pricer/pricer_lsm_convergence.png",
        label: "LSM convergence",
        alt: "American put Longstaff-Schwartz convergence versus number of Monte Carlo paths",
      },
      {
        src: "/assets/visuals/pricer/pricer_openmp_scaling.png",
        label: "OpenMP scaling",
        alt: "OpenMP scaling showing speedup versus threads for Monte Carlo pricing",
      },
      {
        src: "/assets/visuals/pricer/pricer_bs_sanity_error.png",
        label: "BS sanity error",
        alt: "Bar chart showing Monte Carlo Black-Scholes sanity check absolute percent error for call and put",
      },
    ],
    detailSections: [
      {
        title: "What this is",
        body: "A modular American-style options pricer built around Monte Carlo path generation under rough volatility. The engine compares and combines multiple early-exercise estimators and can feed their outputs into a Torch-based Bayesian meta-model for uncertainty.",
      },
      {
        title: "Methods implemented",
        bullets: [
          "Asymptotic analysis: boundary-style early-exercise approximations for fast screening.",
          "Branching processes: upper/lower bounds via randomized tree exploration.",
          "Longstaff-Schwartz LSM: regression of continuation values across simulated paths.",
          "Martingale/duality optimization: variance-reduced bounds on the American price.",
        ],
      },
      {
        title: "Rough-vol paths",
        body: "Fractional Gaussian noise via FFT acceleration; H, vol-of-vol, and correlation can be estimated from recent returns before constructing forward variance paths.",
      },
      {
        title: "Bayesian meta-model",
        body: "Optional Torch/LibTorch model with MC-Dropout support post-processes estimator outputs and produces mean predictions with uncertainty bands. It runs on CPU by default; GPU/CUDA is optional.",
      },
      {
        title: "Current state",
        bullets: [
          "The public repo already shows the rough-vol engine, estimator stack, and Torch-based uncertainty layer.",
          "The project is mid-rebuild, so this page avoids fresh benchmark claims until the updated version is finished.",
        ],
      },
    ],
    notes: "Fractional Gaussian noise via FFT; H, vol-of-vol, and correlation can be estimated from recent returns; Bayesian meta-model (MC-Dropout) post-processes estimator outputs. Revamp in progress.",
  },
];

const RESEARCH = {
  title: "Trader Behavior in 2024 Election Prediction Markets",
  venue: "Published · Kalshi PRES-2024 trade logs",
  command: "paper",
  abstract: "Who moves price on Kalshi? I segment traders with a GMM on log trade size, then run price-impact regressions, power-law fits, persistence tests, and mispricing event studies. Basically, retail flow can be predictive where institutions are not, and “net flow” is not one thing.",
  findings: [
    { h: "Retail flow can be predictive", b: "In the Kamala Harris market, retail net flow Granger-causes subsequent price changes across multiple lags." },
    { h: "Institutional impact is often contemporaneous", b: "In the Trump market, institutional flow shows stronger same-window price impact than retail." },
    { h: "Markets are resilient", b: "Median price-impact ratios drop below 1 across horizons - consistent with mean-reversion and absorption." },
    { h: "“First institutional trade” is nuanced", b: "Not purely corrective. Whether behavior looks corrective or momentum-driven depends on whether mispricing is defined by MA% or z-score." },
  ],
  numbers: [
    { v: "1,697", k: "inst. median size" },
    { v: "89", k: "retail median size" },
    { v: "−0.154", k: "KH retail slope" },
    { v: "flow → ΔP", k: "retail predictive (KH)" },
  ],
  numbersNote: "Numbers are from PRES-2024 Kalshi trade logs (retail vs institutional via GMM). Slopes are log-log fits; Granger results use differenced stationary series.",
  visuals: [
    {
      src: "/assets/visuals/microstructure/log_size_density.png",
      label: "trade-size density",
      alt: "Density plot of log trade sizes for institutional versus retail labels",
    },
    {
      src: "/assets/visuals/microstructure/combined_powerlaw_PRES-2024-KH.png",
      label: "KH flow / impact",
      alt: "Log-log scatter and fitted lines for flow versus absolute price change in the KH market by label",
    },
    {
      src: "/assets/visuals/microstructure/combined_powerlaw_PRES-2024-DJT.png",
      label: "DJT flow / impact",
      alt: "Log-log scatter and fitted lines for flow versus absolute price change in the DJT market by label",
    },
    {
      src: "/assets/visuals/microstructure/persistence_subplots_PRES-2024-KH.png",
      label: "KH persistence",
      alt: "Subplots of price persistence metrics across horizons in the KH market by label",
    },
    {
      src: "/assets/visuals/microstructure/persistence_subplots_PRES-2024-DJT.png",
      label: "DJT persistence",
      alt: "Subplots of price persistence metrics across horizons in the DJT market by label",
    },
  ],
  implications: [
    {
      h: "Segmented flow features",
      b: "\"Net flow\" is not one thing; labeling matters. Retail vs institutional flow can behave differently and carry different predictive content.",
    },
    {
      h: "Event definitions matter",
      b: "The same market can look corrective or momentum-driven depending on mispricing definition; robust signals need multiple lenses.",
    },
    {
      h: "Impact decays",
      b: "Persistence tests suggest impact mean-reverts across horizons, which informs holding periods and risk controls.",
    },
  ],
  detailSections: [
    {
      title: "Methods",
      bullets: [
        "Trader labeling: Gaussian Mixture Model on log trade size, plus robustness checks.",
        "Impact: regressions of signed flow versus contemporaneous price changes; power-law fits on log-log scale.",
        "Persistence: post-trade impact ratios across horizons, including median and confidence intervals.",
        "Mispricing events: MA% and z-score definitions; flow decomposition into corrective versus counter-flow.",
        "Predictability: bivariate Granger causality on stationary series, with event-level tests as a robustness check.",
      ],
    },
    {
      title: "Reproduce",
      body: "Full code, data pulls, and notebooks live in the repo. The paper PDF is linked above for the narrative and figure references.",
    },
    {
      title: "Limitations",
      bullets: [
        "No full order book or depth data, so impact is measured on mid/last-trade proxies.",
        "Prediction markets have unique microstructure, including fees, contract increments, and liquidity constraints, so results transfer conceptually rather than 1:1 to equities.",
        "Some VAR residual autocorrelation issues remain; conclusions emphasize robust bivariate results and descriptive evidence.",
      ],
    },
  ],
  pdf: "/assets/papers/election_microstructure.pdf",
  repo: "bcosm/2024_election_prediction_market_microstructure_analysis",
};

const ABOUT_BULLETS = [
  "Michigan '27, studying Financial Math and Data Science with a CS minor.",
  "Studied Mechanical Engineering for two years, designed anything from AC systems to satellites.",
  "Decided trading is sick, swapped out my major.",
  "Since then, I've spend my time on competitions, projects, and professional experience related to trading.",
  "Outside work: lifting, surfing or windsurfing when I can, travel, and existentialist philosophy.",
];

Object.assign(window, { WORK, COMPETITIONS, PROJECTS, RESEARCH, ABOUT_BULLETS });
