[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-nvidia-cufolio":3,"mdc-yo9bpq-key":34,"related-org-nvidia-cufolio":1999,"related-repo-nvidia-cufolio":2159},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":23,"repoUrl":24,"updatedAt":25,"license":26,"forks":27,"topics":28,"repo":29,"sourceUrl":32,"mdContent":33},"cufolio","build and optimize stock portfolios","Use when a user asks to build, optimize, backtest, rebalance, or analyze a stock portfolio with Mean-CVaR, efficient frontiers, scenario generation, or NVIDIA cuOpt.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},"nvidia","NVIDIA","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fnvidia.png",[12,16,19,20],{"name":13,"slug":14,"type":15},"Portfolio Management","portfolio-management","tag",{"name":17,"slug":18,"type":15},"Finance","finance",{"name":9,"slug":8,"type":15},{"name":21,"slug":22,"type":15},"Trading","trading",2473,"https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fskills","2026-07-14T05:30:00.601648","Apache-2.0",281,[],{"repoUrl":24,"stars":23,"forks":27,"topics":30,"description":31},[],"AI agent skills published by NVIDIA","https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fskills\u002Ftree\u002FHEAD\u002Fskills\u002Fcufolio","---\nname: cufolio\ndescription: Use when a user asks to build, optimize, backtest, rebalance, or analyze a stock portfolio with Mean-CVaR, efficient frontiers, scenario generation, or NVIDIA cuOpt.\nlicense: Apache-2.0\nmetadata:\n  author: Jake Goldberg \u003Cjgoldberg@nvidia.com>\n  tags:\n    - portfolio-optimization\n    - cvar\n    - cuopt\n    - quantitative-finance\n    - gpu\n---\n\n# cuFOLIO Skill\n\n\u003C!--\nSPDX-FileCopyrightText: Copyright (c) 2023-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\nSPDX-License-Identifier: Apache-2.0\n-->\n\n## Purpose\n\nBuild and analyze quantitative portfolios with NVIDIA-accelerated Mean-CVaR optimization. Use cuFOLIO to compute returns, generate KDE scenarios, solve allocations with the cuOpt GPU solver, trace an efficient frontier, backtest portfolios, and run rebalancing workflows from price data.\n\n## When to Use\n\nUse this skill when the task is to:\n\n- Build or optimize a Mean-CVaR portfolio from stock prices.\n- Allocate weights across tickers while controlling downside CVaR risk.\n- Plot or inspect an efficient frontier for a portfolio universe.\n- Produce a weights-by-risk-aversion table.\n- Backtest an optimized portfolio against benchmarks.\n- Rebalance a portfolio on a schedule or drift trigger.\n- Run workflows on an S&P 500, S&P 100, Dow 30, or user-supplied price dataset.\n\nCommon trigger phrases include \"optimize my portfolio\", \"build a CVaR portfolio\", \"use cuFOLIO on these tickers\", \"solve with cuOpt\", \"plot the efficient frontier\", \"show weights by risk aversion\", \"backtest this allocation\", \"rebalance monthly\", \"analyze my holdings with CVaR\", \"compare allocations\", \"reduce downside risk\", \"construct an allocation\", \"assess allocation options\", \"stress-test my holdings\", \"evaluate downside-risk exposure\", \"review my holdings under weight caps\", \"compare benchmark portfolios\", \"simulate CVaR scenarios\", \"screen portfolio risk\", \"optimize holdings under constraints\", and \"find a lower-risk allocation\".\n\nDo not use it for generic finance summaries, price forecasting, neural-network training, vehicle routing, or non-portfolio optimization.\n\n## Prerequisites\n\n- Python environment with the installed `cufolio` package.\n- NVIDIA GPU runtime with cuOpt and cuML installed.\n- CUDA extra matching the host, such as `uv sync --extra cuda12` or `uv sync --extra cuda13`.\n- `cvxpy` exposing `cp.CUOPT`.\n- Network access on first run if the default price CSV must be downloaded.\n\n## Setup\n\nThis skill drives the installed `cufolio` package. A ready environment can come from the Brev launchable or from `NVIDIA-AI-Blueprints\u002FcuFOLIO` after installing the matching CUDA extra.\n\nIn packaged agent\u002Feval sandboxes, `cufolio` may be available through `PYTHONPATH` rather than as a separately published wheel. Verify the local package with `python -c \"import cufolio\"` before declaring it missing. Do not `pip install cufolio`, do not reimplement cuFOLIO workflows from scratch, and do not replace the package APIs with generic pandas\u002Fscipy\u002Fcvxpy portfolio code.\n\nFor concrete implementation details, use `references\u002Fworkflows\u002Fagent_recipes.md` as the source of truth. It contains exact working shapes for loading prices, preparing returns, solving with cuOpt, building a 25-point frontier, backtesting against equal weight, and calling the rebalancer.\n\nThe default dataset is `data\u002Fstock_data\u002Fsp500.csv`. It is gitignored. Before a first-run download, tell the user this fetches public market data through the cuFOLIO\u002Fyfinance data helper and ask them to confirm:\n\n```python\nimport cvxpy as cp\nfrom cufolio.cvar_parameters import CvarParameters\nfrom cufolio.utils import download_data\n\ndownload_data(\"data\u002Fstock_data\", datasets=[\"sp500\"])\nSOLVER_SETTINGS = {\"solver\": cp.CUOPT, \"verbose\": False, \"solver_method\": \"PDLP\"}\ncvar_params = CvarParameters(\n    w_min=0.0, w_max=1.0,\n    c_min=0.0, c_max=0.0,\n    risk_aversion=1.0, confidence=0.95,\n)\n```\n\n## Instructions\n\nBriefly state the defaults being applied before execution, then use these guardrails:\n\n1. Load `data\u002Fstock_data\u002Fsp500.csv`; if it is missing, ask before downloading `sp500` with `cufolio.utils.download_data`. Do not glob, substitute, or fabricate price data.\n2. Validate user CSVs before solving: require a date-like index or first date column, numeric ticker columns, at least 60 rows after date filtering, and at least one requested ticker. If the user gives start\u002Fend dates, slice the price DataFrame before returns computation and report the retained date range. Filter tickers on the price DataFrame before returns are computed. `regime_dict` does not take a ticker field.\n3. Compute LOG returns with `utils.calculate_returns(...)`.\n4. Generate scenarios with `cvar_utils.generate_cvar_data(...)`, KDE, and `KDESettings(device=\"GPU\")`.\n5. Define `CvarParameters` with explicit `w_min` and `w_max`. For ordinary \"build the optimal portfolio\" requests, set `c_min=0.0` and `c_max=0.0` so the result is fully invested instead of 100% cash.\n6. Build `cvar_optimizer.CVaR(returns_dict, cvar_params)` directly from that returns dictionary; keep tickers, scenario arrays, means, and covariance in the shapes returned by cuFOLIO helpers.\n7. Solve with NVIDIA cuOpt only. Before solving, verify `hasattr(cp, \"CUOPT\")` and `str(cp.CUOPT) in {str(s) for s in cp.installed_solvers()}`. Pass `SOLVER_SETTINGS` to every single-shot solve or looped frontier solve. Never fall back to CLARABEL, SCS, ECOS, or another CPU solver. If cuOpt is absent, finish validation\u002Fsetup and report that the GPU\u002FcuOpt runtime is missing instead of fabricating a CPU result.\n8. For custom constraints, map user requests to `CvarParameters`: weight caps to `w_min`\u002F`w_max`, risk appetite to `risk_aversion`, confidence level to `confidence`, cash allowance to `c_max`, and cardinality only when the package exposes an explicit asset-count constraint for the workflow. If constraints conflict (for example, a max weight too low to invest across the requested ticker count), explain the conflict and ask for the constraint to relax instead of guessing.\n9. If the user omits a benchmark for backtesting, use an equal-weight portfolio over the same tickers. If the user omits a constraint, keep the defaults table values and briefly restate consequential assumptions before solving.\n10. Deliver weights sorted by allocation, cash weight, expected return, CVaR, solver label (`cuOpt GPU`), and any requested frontier figure, weights table, backtest metrics, or rebalancing schedule. For tables, include tickers as columns or rows with decimal weights and percentages; for plots, preserve the returned cuFOLIO figure instead of redrawing from scratch.\n11. For report-grade answers, include evidence that the requested workflow actually ran. For an efficient frontier, state `len(results_df)` and use the requested `ra_num` (25 unless the user specifies otherwise). For a weights table, expand `results_df[\"weights\"]` into ticker columns and include `cash` plus `risk_aversion`. For a backtest, include `mean portfolio return`, `sharpe`, `sortino`, and `max drawdown` for both optimized and benchmark portfolios. For rebalancing, include `results_dataframe`, `re_optimize_dates`, and the tail of `cumulative_portfolio_value`.\n\n## Canonical Workflow Skeleton\n\nStart positive cuFOLIO tasks from this shape and adapt only the requested output. For complete copyable functions, read `references\u002Fworkflows\u002Fagent_recipes.md` before writing custom code.\n\n```python\nimport cvxpy as cp\nimport pandas as pd\n\nfrom cufolio import backtest, cvar_optimizer, cvar_utils, rebalance, utils\nfrom cufolio.cvar_parameters import CvarParameters\nfrom cufolio.portfolio import Portfolio\nfrom cufolio.settings import KDESettings, ReturnsComputeSettings, ScenarioGenerationSettings\n\nif not hasattr(cp, \"CUOPT\") or str(cp.CUOPT) not in {str(s) for s in cp.installed_solvers()}:\n    raise RuntimeError(\"cuOpt GPU solver is required; do not substitute a CPU solver.\")\n\nSOLVER_SETTINGS = {\"solver\": cp.CUOPT, \"verbose\": False, \"solver_method\": \"PDLP\"}\n\nprices = utils.get_input_data(\"data\u002Fstock_data\u002Fsp500.csv\")\nreturns_dict = utils.calculate_returns(\n    prices,\n    regime_dict=None,\n    returns_compute_settings=ReturnsComputeSettings(return_type=\"LOG\"),\n)\nreturns_dict = cvar_utils.generate_cvar_data(\n    returns_dict,\n    ScenarioGenerationSettings(\n        fit_type=\"kde\",\n        kde_settings=KDESettings(device=\"GPU\"),\n    ),\n)\ncvar_params = CvarParameters(\n    w_min=0.0,\n    w_max=1.0,\n    c_min=0.0,\n    c_max=0.0,\n    risk_aversion=1.0,\n    confidence=0.95,\n)\noptimizer = cvar_optimizer.CVaR(returns_dict, cvar_params)\nresult, optimal_portfolio = optimizer.solve_optimization_problem(\n    solver_settings=SOLVER_SETTINGS,\n    print_results=False,\n)\n```\n\nFor an efficient frontier or weights table, call:\n\n```python\nresults_df, fig, ax = cvar_utils.create_efficient_frontier(\n    returns_dict,\n    cvar_params,\n    SOLVER_SETTINGS,\n    ra_num=25,\n    show_plot=False,\n    show_discretized_portfolios=False,\n    benchmark_portfolios=False,\n    print_portfolio_results=False,\n)\nweights_table = pd.DataFrame(results_df[\"weights\"].tolist(), index=results_df.index)\n```\n\nFor a benchmark backtest, wrap the solved allocation in `Portfolio(name=\"cuOpt Optimal\", tickers=returns_dict[\"tickers\"], weights=optimal_portfolio.weights, cash=optimal_portfolio.cash)`, create an equal-weight `Portfolio` over the same `returns_dict[\"tickers\"]`, then use `backtest.portfolio_backtester(..., test_method=\"historical\").backtest_against_benchmarks(...)`. The backtester returns `(backtest_results, ax)`.\n\nFor monthly rebalancing, write the price DataFrame to a CSV path first. Instantiate `rebalance.rebalance_portfolio(dataset_directory=\u003Ccsv_path>, ...)` with `re_optimize_criteria={\"type\": \"drift_from_optimal\", \"threshold\": 0, \"norm\": 1}` and call `re_optimize(transaction_cost_factor=..., plot_title=\"Monthly Rebalancing\")`. The rebalancer returns `(results_dataframe, re_optimize_dates, cumulative_portfolio_value)`.\n\n## Data and Defaults\n\n| Setting | Default |\n|---|---|\n| Dataset | `data\u002Fstock_data\u002Fsp500.csv` |\n| Date range | Full available range |\n| Portfolio type | Long-only |\n| Max weight | None unless specified |\n| Risk aversion | `1.0` |\n| Confidence | `0.95` |\n| Scenario method | KDE on GPU |\n| Solver | cuOpt GPU with PDLP |\n| Rebalancing | None unless requested |\n\nThe default S&P 500 file is a historical snapshot and can omit current constituents. User-supplied CSVs should be date-indexed price tables with ticker columns, compatible with `utils.get_input_data`. If requested tickers are absent, drop them, report the omissions, and continue with available columns unless the user explicitly asks you to fetch other data.\n\n## Key APIs\n\nUse the package APIs instead of reimplementing portfolio math or simulation loops. cuFOLIO helpers return flat objects: `returns_dict` has keys such as `returns`, `mean`, `covariance`, and `tickers`; do not index it as `returns_dict[\"regime_1\"]`. `solve_optimization_problem(...)` returns `(result_row, portfolio)`, not a nested result dictionary.\n\n- Returns: `utils.calculate_returns(input_dataset, regime_dict, returns_compute_settings)`.\n- Regime filter: `regime_dict` is `None` or `{\"name\": \"...\", \"range\": (\"YYYY-MM-DD\", \"YYYY-MM-DD\")}`; it is not keyed by regime name and does not contain tickers.\n- Scenarios: `cvar_utils.generate_cvar_data(returns_dict, scenario_generation_settings)`.\n- Optimizer: `cvar_optimizer.CVaR(returns_dict, cvar_params)`.\n- Solve: `result_row, portfolio = cvar_problem.solve_optimization_problem(solver_settings=SOLVER_SETTINGS, print_results=False)`.\n- Efficient frontier: `cvar_utils.create_efficient_frontier(returns_dict, cvar_params, solver_settings=SOLVER_SETTINGS, ra_num=25)`. The returned `results_df` includes metrics, a `weights` dict column, and `cash`.\n- Portfolio: `Portfolio(name=\"\", tickers=None, weights=None, cash=0.0, time_range=None)`; pass tickers and a flat array-like `weights` aligned to those tickers.\n- Backtest: create `portfolio.Portfolio` objects for the optimized allocation and each benchmark; for an equal-weight benchmark, use weights of `1 \u002F len(tickers)` and `cash=0.0`, then call `backtest.portfolio_backtester(test_portfolio, returns_dict, risk_free_rate=0.0, test_method=\"historical\", benchmark_portfolios=[...]).backtest_against_benchmarks(...)`.\n- Rebalance: `rebalance.rebalance_portfolio(...)` requires `dataset_directory` to be a CSV path, not a DataFrame. Call `re_optimize(...)`; it returns `(results_dataframe, re_optimize_dates, cumulative_portfolio_value)`.\n- Settings models: `ReturnsComputeSettings`, `ScenarioGenerationSettings`, `KDESettings`, `ApiSettings`, and `CvarParameters`.\n\n## Examples\n\n- \"Build the optimal portfolio from the S&P 500\": load prices, compute LOG returns, generate GPU KDE scenarios, set long-only fully invested `CvarParameters`, solve with cuOpt, and report diversified weights plus return\u002FCVaR.\n- \"Plot the efficient frontier\": call `create_efficient_frontier(...)`, return `results_df`, and show or save the figure as requested.\n- \"Give me weights by risk aversion\": expand `results_df[\"weights\"]` into a per-asset table.\n- \"Backtest against equal weight\": build the optimized and equal-weight `Portfolio` objects, then use the cuFOLIO backtester and report Sharpe, Sortino, and max drawdown.\n- \"Backtest monthly rebalancing\": configure `rebalance_portfolio` with the drift trigger above and run `re_optimize(transaction_cost_factor=...)`.\n\n## Limitations\n\n- Requires an NVIDIA GPU with cuOpt and cuML; CPU solvers are intentionally disallowed.\n- CPU-only eval containers can still validate routing, data handling, and reporting behavior, but they cannot produce a valid cuOpt solve. In that case, report the missing GPU\u002FcuOpt runtime explicitly.\n- Default price data is a historical snapshot and may omit current constituents.\n- First-run dataset download depends on network access unless the user supplies a CSV.\n\n## Troubleshooting\n\n- Missing default CSV or `FileNotFoundError`: explain that cuFOLIO will fetch public market data with `download_data(\"data\u002Fstock_data\", datasets=[\"sp500\"])`; run it only after user confirmation.\n- `SolverError` or missing `cp.CUOPT`: install the CUDA extra matching the host and verify with `python -c \"import cvxpy as cp; print(hasattr(cp, 'CUOPT'), cp.installed_solvers())\"`.\n- `ImportError` for `cuml` or GPU KDE failures: confirm cuML is present with `python -c \"import cuml\"` and keep `KDESettings(device=\"GPU\")`.\n- Ordinary optimization returns all cash: set `c_max=0.0` in `CvarParameters`.\n- Solver reports infeasible or no solution: check for contradictory bounds, too few tickers for the requested caps\u002Fcardinality, or a date filter that leaves too little data; report the smallest constraint change that would make the request feasible.\n- Requested tickers are absent from the default CSV: report them and proceed with the remaining requested tickers.\n- User CSV fails validation: ask for a date-indexed price table or a CSV whose first column is dates and remaining columns are numeric ticker prices; mention the minimum 60-row post-filter requirement.\n",{"data":35,"body":44},{"name":4,"description":6,"license":26,"metadata":36},{"author":37,"tags":38},"Jake Goldberg \u003Cjgoldberg@nvidia.com>",[39,40,41,42,43],"portfolio-optimization","cvar","cuopt","quantitative-finance","gpu",{"type":45,"children":46},"root",[47,56,63,69,75,80,120,125,130,136,201,207,227,263,276,289,402,408,413,740,746,758,1093,1098,1191,1235,1270,1276,1432,1445,1451,1517,1758,1764,1843,1849,1872,1878,1993],{"type":48,"tag":49,"props":50,"children":52},"element","h1",{"id":51},"cufolio-skill",[53],{"type":54,"value":55},"text","cuFOLIO Skill",{"type":48,"tag":57,"props":58,"children":60},"h2",{"id":59},"purpose",[61],{"type":54,"value":62},"Purpose",{"type":48,"tag":64,"props":65,"children":66},"p",{},[67],{"type":54,"value":68},"Build and analyze quantitative portfolios with NVIDIA-accelerated Mean-CVaR optimization. Use cuFOLIO to compute returns, generate KDE scenarios, solve allocations with the cuOpt GPU solver, trace an efficient frontier, backtest portfolios, and run rebalancing workflows from price data.",{"type":48,"tag":57,"props":70,"children":72},{"id":71},"when-to-use",[73],{"type":54,"value":74},"When to Use",{"type":48,"tag":64,"props":76,"children":77},{},[78],{"type":54,"value":79},"Use this skill when the task is to:",{"type":48,"tag":81,"props":82,"children":83},"ul",{},[84,90,95,100,105,110,115],{"type":48,"tag":85,"props":86,"children":87},"li",{},[88],{"type":54,"value":89},"Build or optimize a Mean-CVaR portfolio from stock prices.",{"type":48,"tag":85,"props":91,"children":92},{},[93],{"type":54,"value":94},"Allocate weights across tickers while controlling downside CVaR risk.",{"type":48,"tag":85,"props":96,"children":97},{},[98],{"type":54,"value":99},"Plot or inspect an efficient frontier for a portfolio universe.",{"type":48,"tag":85,"props":101,"children":102},{},[103],{"type":54,"value":104},"Produce a weights-by-risk-aversion table.",{"type":48,"tag":85,"props":106,"children":107},{},[108],{"type":54,"value":109},"Backtest an optimized portfolio against benchmarks.",{"type":48,"tag":85,"props":111,"children":112},{},[113],{"type":54,"value":114},"Rebalance a portfolio on a schedule or drift trigger.",{"type":48,"tag":85,"props":116,"children":117},{},[118],{"type":54,"value":119},"Run workflows on an S&P 500, S&P 100, Dow 30, or user-supplied price dataset.",{"type":48,"tag":64,"props":121,"children":122},{},[123],{"type":54,"value":124},"Common trigger phrases include \"optimize my portfolio\", \"build a CVaR portfolio\", \"use cuFOLIO on these tickers\", \"solve with cuOpt\", \"plot the efficient frontier\", \"show weights by risk aversion\", \"backtest this allocation\", \"rebalance monthly\", \"analyze my holdings with CVaR\", \"compare allocations\", \"reduce downside risk\", \"construct an allocation\", \"assess allocation options\", \"stress-test my holdings\", \"evaluate downside-risk exposure\", \"review my holdings under weight caps\", \"compare benchmark portfolios\", \"simulate CVaR scenarios\", \"screen portfolio risk\", \"optimize holdings under constraints\", and \"find a lower-risk allocation\".",{"type":48,"tag":64,"props":126,"children":127},{},[128],{"type":54,"value":129},"Do not use it for generic finance summaries, price forecasting, neural-network training, vehicle routing, or non-portfolio optimization.",{"type":48,"tag":57,"props":131,"children":133},{"id":132},"prerequisites",[134],{"type":54,"value":135},"Prerequisites",{"type":48,"tag":81,"props":137,"children":138},{},[139,152,157,178,196],{"type":48,"tag":85,"props":140,"children":141},{},[142,144,150],{"type":54,"value":143},"Python environment with the installed ",{"type":48,"tag":145,"props":146,"children":148},"code",{"className":147},[],[149],{"type":54,"value":4},{"type":54,"value":151}," package.",{"type":48,"tag":85,"props":153,"children":154},{},[155],{"type":54,"value":156},"NVIDIA GPU runtime with cuOpt and cuML installed.",{"type":48,"tag":85,"props":158,"children":159},{},[160,162,168,170,176],{"type":54,"value":161},"CUDA extra matching the host, such as ",{"type":48,"tag":145,"props":163,"children":165},{"className":164},[],[166],{"type":54,"value":167},"uv sync --extra cuda12",{"type":54,"value":169}," or ",{"type":48,"tag":145,"props":171,"children":173},{"className":172},[],[174],{"type":54,"value":175},"uv sync --extra cuda13",{"type":54,"value":177},".",{"type":48,"tag":85,"props":179,"children":180},{},[181,187,189,195],{"type":48,"tag":145,"props":182,"children":184},{"className":183},[],[185],{"type":54,"value":186},"cvxpy",{"type":54,"value":188}," exposing ",{"type":48,"tag":145,"props":190,"children":192},{"className":191},[],[193],{"type":54,"value":194},"cp.CUOPT",{"type":54,"value":177},{"type":48,"tag":85,"props":197,"children":198},{},[199],{"type":54,"value":200},"Network access on first run if the default price CSV must be downloaded.",{"type":48,"tag":57,"props":202,"children":204},{"id":203},"setup",[205],{"type":54,"value":206},"Setup",{"type":48,"tag":64,"props":208,"children":209},{},[210,212,217,219,225],{"type":54,"value":211},"This skill drives the installed ",{"type":48,"tag":145,"props":213,"children":215},{"className":214},[],[216],{"type":54,"value":4},{"type":54,"value":218}," package. A ready environment can come from the Brev launchable or from ",{"type":48,"tag":145,"props":220,"children":222},{"className":221},[],[223],{"type":54,"value":224},"NVIDIA-AI-Blueprints\u002FcuFOLIO",{"type":54,"value":226}," after installing the matching CUDA extra.",{"type":48,"tag":64,"props":228,"children":229},{},[230,232,237,239,245,247,253,255,261],{"type":54,"value":231},"In packaged agent\u002Feval sandboxes, ",{"type":48,"tag":145,"props":233,"children":235},{"className":234},[],[236],{"type":54,"value":4},{"type":54,"value":238}," may be available through ",{"type":48,"tag":145,"props":240,"children":242},{"className":241},[],[243],{"type":54,"value":244},"PYTHONPATH",{"type":54,"value":246}," rather than as a separately published wheel. Verify the local package with ",{"type":48,"tag":145,"props":248,"children":250},{"className":249},[],[251],{"type":54,"value":252},"python -c \"import cufolio\"",{"type":54,"value":254}," before declaring it missing. Do not ",{"type":48,"tag":145,"props":256,"children":258},{"className":257},[],[259],{"type":54,"value":260},"pip install cufolio",{"type":54,"value":262},", do not reimplement cuFOLIO workflows from scratch, and do not replace the package APIs with generic pandas\u002Fscipy\u002Fcvxpy portfolio code.",{"type":48,"tag":64,"props":264,"children":265},{},[266,268,274],{"type":54,"value":267},"For concrete implementation details, use ",{"type":48,"tag":145,"props":269,"children":271},{"className":270},[],[272],{"type":54,"value":273},"references\u002Fworkflows\u002Fagent_recipes.md",{"type":54,"value":275}," as the source of truth. It contains exact working shapes for loading prices, preparing returns, solving with cuOpt, building a 25-point frontier, backtesting against equal weight, and calling the rebalancer.",{"type":48,"tag":64,"props":277,"children":278},{},[279,281,287],{"type":54,"value":280},"The default dataset is ",{"type":48,"tag":145,"props":282,"children":284},{"className":283},[],[285],{"type":54,"value":286},"data\u002Fstock_data\u002Fsp500.csv",{"type":54,"value":288},". It is gitignored. Before a first-run download, tell the user this fetches public market data through the cuFOLIO\u002Fyfinance data helper and ask them to confirm:",{"type":48,"tag":290,"props":291,"children":296},"pre",{"className":292,"code":293,"language":294,"meta":295,"style":295},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import cvxpy as cp\nfrom cufolio.cvar_parameters import CvarParameters\nfrom cufolio.utils import download_data\n\ndownload_data(\"data\u002Fstock_data\", datasets=[\"sp500\"])\nSOLVER_SETTINGS = {\"solver\": cp.CUOPT, \"verbose\": False, \"solver_method\": \"PDLP\"}\ncvar_params = CvarParameters(\n    w_min=0.0, w_max=1.0,\n    c_min=0.0, c_max=0.0,\n    risk_aversion=1.0, confidence=0.95,\n)\n","python","",[297],{"type":48,"tag":145,"props":298,"children":299},{"__ignoreMap":295},[300,311,320,329,339,348,357,366,375,384,393],{"type":48,"tag":301,"props":302,"children":305},"span",{"class":303,"line":304},"line",1,[306],{"type":48,"tag":301,"props":307,"children":308},{},[309],{"type":54,"value":310},"import cvxpy as cp\n",{"type":48,"tag":301,"props":312,"children":314},{"class":303,"line":313},2,[315],{"type":48,"tag":301,"props":316,"children":317},{},[318],{"type":54,"value":319},"from cufolio.cvar_parameters import CvarParameters\n",{"type":48,"tag":301,"props":321,"children":323},{"class":303,"line":322},3,[324],{"type":48,"tag":301,"props":325,"children":326},{},[327],{"type":54,"value":328},"from cufolio.utils import download_data\n",{"type":48,"tag":301,"props":330,"children":332},{"class":303,"line":331},4,[333],{"type":48,"tag":301,"props":334,"children":336},{"emptyLinePlaceholder":335},true,[337],{"type":54,"value":338},"\n",{"type":48,"tag":301,"props":340,"children":342},{"class":303,"line":341},5,[343],{"type":48,"tag":301,"props":344,"children":345},{},[346],{"type":54,"value":347},"download_data(\"data\u002Fstock_data\", datasets=[\"sp500\"])\n",{"type":48,"tag":301,"props":349,"children":351},{"class":303,"line":350},6,[352],{"type":48,"tag":301,"props":353,"children":354},{},[355],{"type":54,"value":356},"SOLVER_SETTINGS = {\"solver\": cp.CUOPT, \"verbose\": False, \"solver_method\": \"PDLP\"}\n",{"type":48,"tag":301,"props":358,"children":360},{"class":303,"line":359},7,[361],{"type":48,"tag":301,"props":362,"children":363},{},[364],{"type":54,"value":365},"cvar_params = CvarParameters(\n",{"type":48,"tag":301,"props":367,"children":369},{"class":303,"line":368},8,[370],{"type":48,"tag":301,"props":371,"children":372},{},[373],{"type":54,"value":374},"    w_min=0.0, w_max=1.0,\n",{"type":48,"tag":301,"props":376,"children":378},{"class":303,"line":377},9,[379],{"type":48,"tag":301,"props":380,"children":381},{},[382],{"type":54,"value":383},"    c_min=0.0, c_max=0.0,\n",{"type":48,"tag":301,"props":385,"children":387},{"class":303,"line":386},10,[388],{"type":48,"tag":301,"props":389,"children":390},{},[391],{"type":54,"value":392},"    risk_aversion=1.0, confidence=0.95,\n",{"type":48,"tag":301,"props":394,"children":396},{"class":303,"line":395},11,[397],{"type":48,"tag":301,"props":398,"children":399},{},[400],{"type":54,"value":401},")\n",{"type":48,"tag":57,"props":403,"children":405},{"id":404},"instructions",[406],{"type":54,"value":407},"Instructions",{"type":48,"tag":64,"props":409,"children":410},{},[411],{"type":54,"value":412},"Briefly state the defaults being applied before execution, then use these guardrails:",{"type":48,"tag":414,"props":415,"children":416},"ol",{},[417,445,458,470,490,534,547,575,625,630,643],{"type":48,"tag":85,"props":418,"children":419},{},[420,422,427,429,435,437,443],{"type":54,"value":421},"Load ",{"type":48,"tag":145,"props":423,"children":425},{"className":424},[],[426],{"type":54,"value":286},{"type":54,"value":428},"; if it is missing, ask before downloading ",{"type":48,"tag":145,"props":430,"children":432},{"className":431},[],[433],{"type":54,"value":434},"sp500",{"type":54,"value":436}," with ",{"type":48,"tag":145,"props":438,"children":440},{"className":439},[],[441],{"type":54,"value":442},"cufolio.utils.download_data",{"type":54,"value":444},". Do not glob, substitute, or fabricate price data.",{"type":48,"tag":85,"props":446,"children":447},{},[448,450,456],{"type":54,"value":449},"Validate user CSVs before solving: require a date-like index or first date column, numeric ticker columns, at least 60 rows after date filtering, and at least one requested ticker. If the user gives start\u002Fend dates, slice the price DataFrame before returns computation and report the retained date range. Filter tickers on the price DataFrame before returns are computed. ",{"type":48,"tag":145,"props":451,"children":453},{"className":452},[],[454],{"type":54,"value":455},"regime_dict",{"type":54,"value":457}," does not take a ticker field.",{"type":48,"tag":85,"props":459,"children":460},{},[461,463,469],{"type":54,"value":462},"Compute LOG returns with ",{"type":48,"tag":145,"props":464,"children":466},{"className":465},[],[467],{"type":54,"value":468},"utils.calculate_returns(...)",{"type":54,"value":177},{"type":48,"tag":85,"props":471,"children":472},{},[473,475,481,483,489],{"type":54,"value":474},"Generate scenarios with ",{"type":48,"tag":145,"props":476,"children":478},{"className":477},[],[479],{"type":54,"value":480},"cvar_utils.generate_cvar_data(...)",{"type":54,"value":482},", KDE, and ",{"type":48,"tag":145,"props":484,"children":486},{"className":485},[],[487],{"type":54,"value":488},"KDESettings(device=\"GPU\")",{"type":54,"value":177},{"type":48,"tag":85,"props":491,"children":492},{},[493,495,501,503,509,511,517,519,525,526,532],{"type":54,"value":494},"Define ",{"type":48,"tag":145,"props":496,"children":498},{"className":497},[],[499],{"type":54,"value":500},"CvarParameters",{"type":54,"value":502}," with explicit ",{"type":48,"tag":145,"props":504,"children":506},{"className":505},[],[507],{"type":54,"value":508},"w_min",{"type":54,"value":510}," and ",{"type":48,"tag":145,"props":512,"children":514},{"className":513},[],[515],{"type":54,"value":516},"w_max",{"type":54,"value":518},". For ordinary \"build the optimal portfolio\" requests, set ",{"type":48,"tag":145,"props":520,"children":522},{"className":521},[],[523],{"type":54,"value":524},"c_min=0.0",{"type":54,"value":510},{"type":48,"tag":145,"props":527,"children":529},{"className":528},[],[530],{"type":54,"value":531},"c_max=0.0",{"type":54,"value":533}," so the result is fully invested instead of 100% cash.",{"type":48,"tag":85,"props":535,"children":536},{},[537,539,545],{"type":54,"value":538},"Build ",{"type":48,"tag":145,"props":540,"children":542},{"className":541},[],[543],{"type":54,"value":544},"cvar_optimizer.CVaR(returns_dict, cvar_params)",{"type":54,"value":546}," directly from that returns dictionary; keep tickers, scenario arrays, means, and covariance in the shapes returned by cuFOLIO helpers.",{"type":48,"tag":85,"props":548,"children":549},{},[550,552,558,559,565,567,573],{"type":54,"value":551},"Solve with NVIDIA cuOpt only. Before solving, verify ",{"type":48,"tag":145,"props":553,"children":555},{"className":554},[],[556],{"type":54,"value":557},"hasattr(cp, \"CUOPT\")",{"type":54,"value":510},{"type":48,"tag":145,"props":560,"children":562},{"className":561},[],[563],{"type":54,"value":564},"str(cp.CUOPT) in {str(s) for s in cp.installed_solvers()}",{"type":54,"value":566},". Pass ",{"type":48,"tag":145,"props":568,"children":570},{"className":569},[],[571],{"type":54,"value":572},"SOLVER_SETTINGS",{"type":54,"value":574}," to every single-shot solve or looped frontier solve. Never fall back to CLARABEL, SCS, ECOS, or another CPU solver. If cuOpt is absent, finish validation\u002Fsetup and report that the GPU\u002FcuOpt runtime is missing instead of fabricating a CPU result.",{"type":48,"tag":85,"props":576,"children":577},{},[578,580,585,587,592,594,599,601,607,609,615,617,623],{"type":54,"value":579},"For custom constraints, map user requests to ",{"type":48,"tag":145,"props":581,"children":583},{"className":582},[],[584],{"type":54,"value":500},{"type":54,"value":586},": weight caps to ",{"type":48,"tag":145,"props":588,"children":590},{"className":589},[],[591],{"type":54,"value":508},{"type":54,"value":593},"\u002F",{"type":48,"tag":145,"props":595,"children":597},{"className":596},[],[598],{"type":54,"value":516},{"type":54,"value":600},", risk appetite to ",{"type":48,"tag":145,"props":602,"children":604},{"className":603},[],[605],{"type":54,"value":606},"risk_aversion",{"type":54,"value":608},", confidence level to ",{"type":48,"tag":145,"props":610,"children":612},{"className":611},[],[613],{"type":54,"value":614},"confidence",{"type":54,"value":616},", cash allowance to ",{"type":48,"tag":145,"props":618,"children":620},{"className":619},[],[621],{"type":54,"value":622},"c_max",{"type":54,"value":624},", and cardinality only when the package exposes an explicit asset-count constraint for the workflow. If constraints conflict (for example, a max weight too low to invest across the requested ticker count), explain the conflict and ask for the constraint to relax instead of guessing.",{"type":48,"tag":85,"props":626,"children":627},{},[628],{"type":54,"value":629},"If the user omits a benchmark for backtesting, use an equal-weight portfolio over the same tickers. If the user omits a constraint, keep the defaults table values and briefly restate consequential assumptions before solving.",{"type":48,"tag":85,"props":631,"children":632},{},[633,635,641],{"type":54,"value":634},"Deliver weights sorted by allocation, cash weight, expected return, CVaR, solver label (",{"type":48,"tag":145,"props":636,"children":638},{"className":637},[],[639],{"type":54,"value":640},"cuOpt GPU",{"type":54,"value":642},"), and any requested frontier figure, weights table, backtest metrics, or rebalancing schedule. For tables, include tickers as columns or rows with decimal weights and percentages; for plots, preserve the returned cuFOLIO figure instead of redrawing from scratch.",{"type":48,"tag":85,"props":644,"children":645},{},[646,648,654,656,662,664,670,672,678,680,685,687,693,695,701,702,708,710,716,718,724,725,731,733,739],{"type":54,"value":647},"For report-grade answers, include evidence that the requested workflow actually ran. For an efficient frontier, state ",{"type":48,"tag":145,"props":649,"children":651},{"className":650},[],[652],{"type":54,"value":653},"len(results_df)",{"type":54,"value":655}," and use the requested ",{"type":48,"tag":145,"props":657,"children":659},{"className":658},[],[660],{"type":54,"value":661},"ra_num",{"type":54,"value":663}," (25 unless the user specifies otherwise). For a weights table, expand ",{"type":48,"tag":145,"props":665,"children":667},{"className":666},[],[668],{"type":54,"value":669},"results_df[\"weights\"]",{"type":54,"value":671}," into ticker columns and include ",{"type":48,"tag":145,"props":673,"children":675},{"className":674},[],[676],{"type":54,"value":677},"cash",{"type":54,"value":679}," plus ",{"type":48,"tag":145,"props":681,"children":683},{"className":682},[],[684],{"type":54,"value":606},{"type":54,"value":686},". For a backtest, include ",{"type":48,"tag":145,"props":688,"children":690},{"className":689},[],[691],{"type":54,"value":692},"mean portfolio return",{"type":54,"value":694},", ",{"type":48,"tag":145,"props":696,"children":698},{"className":697},[],[699],{"type":54,"value":700},"sharpe",{"type":54,"value":694},{"type":48,"tag":145,"props":703,"children":705},{"className":704},[],[706],{"type":54,"value":707},"sortino",{"type":54,"value":709},", and ",{"type":48,"tag":145,"props":711,"children":713},{"className":712},[],[714],{"type":54,"value":715},"max drawdown",{"type":54,"value":717}," for both optimized and benchmark portfolios. For rebalancing, include ",{"type":48,"tag":145,"props":719,"children":721},{"className":720},[],[722],{"type":54,"value":723},"results_dataframe",{"type":54,"value":694},{"type":48,"tag":145,"props":726,"children":728},{"className":727},[],[729],{"type":54,"value":730},"re_optimize_dates",{"type":54,"value":732},", and the tail of ",{"type":48,"tag":145,"props":734,"children":736},{"className":735},[],[737],{"type":54,"value":738},"cumulative_portfolio_value",{"type":54,"value":177},{"type":48,"tag":57,"props":741,"children":743},{"id":742},"canonical-workflow-skeleton",[744],{"type":54,"value":745},"Canonical Workflow Skeleton",{"type":48,"tag":64,"props":747,"children":748},{},[749,751,756],{"type":54,"value":750},"Start positive cuFOLIO tasks from this shape and adapt only the requested output. For complete copyable functions, read ",{"type":48,"tag":145,"props":752,"children":754},{"className":753},[],[755],{"type":54,"value":273},{"type":54,"value":757}," before writing custom code.",{"type":48,"tag":290,"props":759,"children":761},{"className":292,"code":760,"language":294,"meta":295,"style":295},"import cvxpy as cp\nimport pandas as pd\n\nfrom cufolio import backtest, cvar_optimizer, cvar_utils, rebalance, utils\nfrom cufolio.cvar_parameters import CvarParameters\nfrom cufolio.portfolio import Portfolio\nfrom cufolio.settings import KDESettings, ReturnsComputeSettings, ScenarioGenerationSettings\n\nif not hasattr(cp, \"CUOPT\") or str(cp.CUOPT) not in {str(s) for s in cp.installed_solvers()}:\n    raise RuntimeError(\"cuOpt GPU solver is required; do not substitute a CPU solver.\")\n\nSOLVER_SETTINGS = {\"solver\": cp.CUOPT, \"verbose\": False, \"solver_method\": \"PDLP\"}\n\nprices = utils.get_input_data(\"data\u002Fstock_data\u002Fsp500.csv\")\nreturns_dict = utils.calculate_returns(\n    prices,\n    regime_dict=None,\n    returns_compute_settings=ReturnsComputeSettings(return_type=\"LOG\"),\n)\nreturns_dict = cvar_utils.generate_cvar_data(\n    returns_dict,\n    ScenarioGenerationSettings(\n        fit_type=\"kde\",\n        kde_settings=KDESettings(device=\"GPU\"),\n    ),\n)\ncvar_params = CvarParameters(\n    w_min=0.0,\n    w_max=1.0,\n    c_min=0.0,\n    c_max=0.0,\n    risk_aversion=1.0,\n    confidence=0.95,\n)\noptimizer = cvar_optimizer.CVaR(returns_dict, cvar_params)\nresult, optimal_portfolio = optimizer.solve_optimization_problem(\n    solver_settings=SOLVER_SETTINGS,\n    print_results=False,\n)\n",[762],{"type":48,"tag":145,"props":763,"children":764},{"__ignoreMap":295},[765,772,780,787,795,802,810,818,825,833,841,848,856,864,873,882,891,900,909,917,926,935,944,953,962,971,979,987,996,1005,1014,1023,1032,1041,1049,1058,1067,1076,1085],{"type":48,"tag":301,"props":766,"children":767},{"class":303,"line":304},[768],{"type":48,"tag":301,"props":769,"children":770},{},[771],{"type":54,"value":310},{"type":48,"tag":301,"props":773,"children":774},{"class":303,"line":313},[775],{"type":48,"tag":301,"props":776,"children":777},{},[778],{"type":54,"value":779},"import pandas as pd\n",{"type":48,"tag":301,"props":781,"children":782},{"class":303,"line":322},[783],{"type":48,"tag":301,"props":784,"children":785},{"emptyLinePlaceholder":335},[786],{"type":54,"value":338},{"type":48,"tag":301,"props":788,"children":789},{"class":303,"line":331},[790],{"type":48,"tag":301,"props":791,"children":792},{},[793],{"type":54,"value":794},"from cufolio import backtest, cvar_optimizer, cvar_utils, rebalance, utils\n",{"type":48,"tag":301,"props":796,"children":797},{"class":303,"line":341},[798],{"type":48,"tag":301,"props":799,"children":800},{},[801],{"type":54,"value":319},{"type":48,"tag":301,"props":803,"children":804},{"class":303,"line":350},[805],{"type":48,"tag":301,"props":806,"children":807},{},[808],{"type":54,"value":809},"from cufolio.portfolio import Portfolio\n",{"type":48,"tag":301,"props":811,"children":812},{"class":303,"line":359},[813],{"type":48,"tag":301,"props":814,"children":815},{},[816],{"type":54,"value":817},"from cufolio.settings import KDESettings, ReturnsComputeSettings, ScenarioGenerationSettings\n",{"type":48,"tag":301,"props":819,"children":820},{"class":303,"line":368},[821],{"type":48,"tag":301,"props":822,"children":823},{"emptyLinePlaceholder":335},[824],{"type":54,"value":338},{"type":48,"tag":301,"props":826,"children":827},{"class":303,"line":377},[828],{"type":48,"tag":301,"props":829,"children":830},{},[831],{"type":54,"value":832},"if not hasattr(cp, \"CUOPT\") or str(cp.CUOPT) not in {str(s) for s in cp.installed_solvers()}:\n",{"type":48,"tag":301,"props":834,"children":835},{"class":303,"line":386},[836],{"type":48,"tag":301,"props":837,"children":838},{},[839],{"type":54,"value":840},"    raise RuntimeError(\"cuOpt GPU solver is required; do not substitute a CPU solver.\")\n",{"type":48,"tag":301,"props":842,"children":843},{"class":303,"line":395},[844],{"type":48,"tag":301,"props":845,"children":846},{"emptyLinePlaceholder":335},[847],{"type":54,"value":338},{"type":48,"tag":301,"props":849,"children":851},{"class":303,"line":850},12,[852],{"type":48,"tag":301,"props":853,"children":854},{},[855],{"type":54,"value":356},{"type":48,"tag":301,"props":857,"children":859},{"class":303,"line":858},13,[860],{"type":48,"tag":301,"props":861,"children":862},{"emptyLinePlaceholder":335},[863],{"type":54,"value":338},{"type":48,"tag":301,"props":865,"children":867},{"class":303,"line":866},14,[868],{"type":48,"tag":301,"props":869,"children":870},{},[871],{"type":54,"value":872},"prices = utils.get_input_data(\"data\u002Fstock_data\u002Fsp500.csv\")\n",{"type":48,"tag":301,"props":874,"children":876},{"class":303,"line":875},15,[877],{"type":48,"tag":301,"props":878,"children":879},{},[880],{"type":54,"value":881},"returns_dict = utils.calculate_returns(\n",{"type":48,"tag":301,"props":883,"children":885},{"class":303,"line":884},16,[886],{"type":48,"tag":301,"props":887,"children":888},{},[889],{"type":54,"value":890},"    prices,\n",{"type":48,"tag":301,"props":892,"children":894},{"class":303,"line":893},17,[895],{"type":48,"tag":301,"props":896,"children":897},{},[898],{"type":54,"value":899},"    regime_dict=None,\n",{"type":48,"tag":301,"props":901,"children":903},{"class":303,"line":902},18,[904],{"type":48,"tag":301,"props":905,"children":906},{},[907],{"type":54,"value":908},"    returns_compute_settings=ReturnsComputeSettings(return_type=\"LOG\"),\n",{"type":48,"tag":301,"props":910,"children":912},{"class":303,"line":911},19,[913],{"type":48,"tag":301,"props":914,"children":915},{},[916],{"type":54,"value":401},{"type":48,"tag":301,"props":918,"children":920},{"class":303,"line":919},20,[921],{"type":48,"tag":301,"props":922,"children":923},{},[924],{"type":54,"value":925},"returns_dict = cvar_utils.generate_cvar_data(\n",{"type":48,"tag":301,"props":927,"children":929},{"class":303,"line":928},21,[930],{"type":48,"tag":301,"props":931,"children":932},{},[933],{"type":54,"value":934},"    returns_dict,\n",{"type":48,"tag":301,"props":936,"children":938},{"class":303,"line":937},22,[939],{"type":48,"tag":301,"props":940,"children":941},{},[942],{"type":54,"value":943},"    ScenarioGenerationSettings(\n",{"type":48,"tag":301,"props":945,"children":947},{"class":303,"line":946},23,[948],{"type":48,"tag":301,"props":949,"children":950},{},[951],{"type":54,"value":952},"        fit_type=\"kde\",\n",{"type":48,"tag":301,"props":954,"children":956},{"class":303,"line":955},24,[957],{"type":48,"tag":301,"props":958,"children":959},{},[960],{"type":54,"value":961},"        kde_settings=KDESettings(device=\"GPU\"),\n",{"type":48,"tag":301,"props":963,"children":965},{"class":303,"line":964},25,[966],{"type":48,"tag":301,"props":967,"children":968},{},[969],{"type":54,"value":970},"    ),\n",{"type":48,"tag":301,"props":972,"children":974},{"class":303,"line":973},26,[975],{"type":48,"tag":301,"props":976,"children":977},{},[978],{"type":54,"value":401},{"type":48,"tag":301,"props":980,"children":982},{"class":303,"line":981},27,[983],{"type":48,"tag":301,"props":984,"children":985},{},[986],{"type":54,"value":365},{"type":48,"tag":301,"props":988,"children":990},{"class":303,"line":989},28,[991],{"type":48,"tag":301,"props":992,"children":993},{},[994],{"type":54,"value":995},"    w_min=0.0,\n",{"type":48,"tag":301,"props":997,"children":999},{"class":303,"line":998},29,[1000],{"type":48,"tag":301,"props":1001,"children":1002},{},[1003],{"type":54,"value":1004},"    w_max=1.0,\n",{"type":48,"tag":301,"props":1006,"children":1008},{"class":303,"line":1007},30,[1009],{"type":48,"tag":301,"props":1010,"children":1011},{},[1012],{"type":54,"value":1013},"    c_min=0.0,\n",{"type":48,"tag":301,"props":1015,"children":1017},{"class":303,"line":1016},31,[1018],{"type":48,"tag":301,"props":1019,"children":1020},{},[1021],{"type":54,"value":1022},"    c_max=0.0,\n",{"type":48,"tag":301,"props":1024,"children":1026},{"class":303,"line":1025},32,[1027],{"type":48,"tag":301,"props":1028,"children":1029},{},[1030],{"type":54,"value":1031},"    risk_aversion=1.0,\n",{"type":48,"tag":301,"props":1033,"children":1035},{"class":303,"line":1034},33,[1036],{"type":48,"tag":301,"props":1037,"children":1038},{},[1039],{"type":54,"value":1040},"    confidence=0.95,\n",{"type":48,"tag":301,"props":1042,"children":1044},{"class":303,"line":1043},34,[1045],{"type":48,"tag":301,"props":1046,"children":1047},{},[1048],{"type":54,"value":401},{"type":48,"tag":301,"props":1050,"children":1052},{"class":303,"line":1051},35,[1053],{"type":48,"tag":301,"props":1054,"children":1055},{},[1056],{"type":54,"value":1057},"optimizer = cvar_optimizer.CVaR(returns_dict, cvar_params)\n",{"type":48,"tag":301,"props":1059,"children":1061},{"class":303,"line":1060},36,[1062],{"type":48,"tag":301,"props":1063,"children":1064},{},[1065],{"type":54,"value":1066},"result, optimal_portfolio = optimizer.solve_optimization_problem(\n",{"type":48,"tag":301,"props":1068,"children":1070},{"class":303,"line":1069},37,[1071],{"type":48,"tag":301,"props":1072,"children":1073},{},[1074],{"type":54,"value":1075},"    solver_settings=SOLVER_SETTINGS,\n",{"type":48,"tag":301,"props":1077,"children":1079},{"class":303,"line":1078},38,[1080],{"type":48,"tag":301,"props":1081,"children":1082},{},[1083],{"type":54,"value":1084},"    print_results=False,\n",{"type":48,"tag":301,"props":1086,"children":1088},{"class":303,"line":1087},39,[1089],{"type":48,"tag":301,"props":1090,"children":1091},{},[1092],{"type":54,"value":401},{"type":48,"tag":64,"props":1094,"children":1095},{},[1096],{"type":54,"value":1097},"For an efficient frontier or weights table, call:",{"type":48,"tag":290,"props":1099,"children":1101},{"className":292,"code":1100,"language":294,"meta":295,"style":295},"results_df, fig, ax = cvar_utils.create_efficient_frontier(\n    returns_dict,\n    cvar_params,\n    SOLVER_SETTINGS,\n    ra_num=25,\n    show_plot=False,\n    show_discretized_portfolios=False,\n    benchmark_portfolios=False,\n    print_portfolio_results=False,\n)\nweights_table = pd.DataFrame(results_df[\"weights\"].tolist(), index=results_df.index)\n",[1102],{"type":48,"tag":145,"props":1103,"children":1104},{"__ignoreMap":295},[1105,1113,1120,1128,1136,1144,1152,1160,1168,1176,1183],{"type":48,"tag":301,"props":1106,"children":1107},{"class":303,"line":304},[1108],{"type":48,"tag":301,"props":1109,"children":1110},{},[1111],{"type":54,"value":1112},"results_df, fig, ax = cvar_utils.create_efficient_frontier(\n",{"type":48,"tag":301,"props":1114,"children":1115},{"class":303,"line":313},[1116],{"type":48,"tag":301,"props":1117,"children":1118},{},[1119],{"type":54,"value":934},{"type":48,"tag":301,"props":1121,"children":1122},{"class":303,"line":322},[1123],{"type":48,"tag":301,"props":1124,"children":1125},{},[1126],{"type":54,"value":1127},"    cvar_params,\n",{"type":48,"tag":301,"props":1129,"children":1130},{"class":303,"line":331},[1131],{"type":48,"tag":301,"props":1132,"children":1133},{},[1134],{"type":54,"value":1135},"    SOLVER_SETTINGS,\n",{"type":48,"tag":301,"props":1137,"children":1138},{"class":303,"line":341},[1139],{"type":48,"tag":301,"props":1140,"children":1141},{},[1142],{"type":54,"value":1143},"    ra_num=25,\n",{"type":48,"tag":301,"props":1145,"children":1146},{"class":303,"line":350},[1147],{"type":48,"tag":301,"props":1148,"children":1149},{},[1150],{"type":54,"value":1151},"    show_plot=False,\n",{"type":48,"tag":301,"props":1153,"children":1154},{"class":303,"line":359},[1155],{"type":48,"tag":301,"props":1156,"children":1157},{},[1158],{"type":54,"value":1159},"    show_discretized_portfolios=False,\n",{"type":48,"tag":301,"props":1161,"children":1162},{"class":303,"line":368},[1163],{"type":48,"tag":301,"props":1164,"children":1165},{},[1166],{"type":54,"value":1167},"    benchmark_portfolios=False,\n",{"type":48,"tag":301,"props":1169,"children":1170},{"class":303,"line":377},[1171],{"type":48,"tag":301,"props":1172,"children":1173},{},[1174],{"type":54,"value":1175},"    print_portfolio_results=False,\n",{"type":48,"tag":301,"props":1177,"children":1178},{"class":303,"line":386},[1179],{"type":48,"tag":301,"props":1180,"children":1181},{},[1182],{"type":54,"value":401},{"type":48,"tag":301,"props":1184,"children":1185},{"class":303,"line":395},[1186],{"type":48,"tag":301,"props":1187,"children":1188},{},[1189],{"type":54,"value":1190},"weights_table = pd.DataFrame(results_df[\"weights\"].tolist(), index=results_df.index)\n",{"type":48,"tag":64,"props":1192,"children":1193},{},[1194,1196,1202,1204,1210,1212,1218,1220,1226,1228,1234],{"type":54,"value":1195},"For a benchmark backtest, wrap the solved allocation in ",{"type":48,"tag":145,"props":1197,"children":1199},{"className":1198},[],[1200],{"type":54,"value":1201},"Portfolio(name=\"cuOpt Optimal\", tickers=returns_dict[\"tickers\"], weights=optimal_portfolio.weights, cash=optimal_portfolio.cash)",{"type":54,"value":1203},", create an equal-weight ",{"type":48,"tag":145,"props":1205,"children":1207},{"className":1206},[],[1208],{"type":54,"value":1209},"Portfolio",{"type":54,"value":1211}," over the same ",{"type":48,"tag":145,"props":1213,"children":1215},{"className":1214},[],[1216],{"type":54,"value":1217},"returns_dict[\"tickers\"]",{"type":54,"value":1219},", then use ",{"type":48,"tag":145,"props":1221,"children":1223},{"className":1222},[],[1224],{"type":54,"value":1225},"backtest.portfolio_backtester(..., test_method=\"historical\").backtest_against_benchmarks(...)",{"type":54,"value":1227},". The backtester returns ",{"type":48,"tag":145,"props":1229,"children":1231},{"className":1230},[],[1232],{"type":54,"value":1233},"(backtest_results, ax)",{"type":54,"value":177},{"type":48,"tag":64,"props":1236,"children":1237},{},[1238,1240,1246,1247,1253,1255,1261,1263,1269],{"type":54,"value":1239},"For monthly rebalancing, write the price DataFrame to a CSV path first. Instantiate ",{"type":48,"tag":145,"props":1241,"children":1243},{"className":1242},[],[1244],{"type":54,"value":1245},"rebalance.rebalance_portfolio(dataset_directory=\u003Ccsv_path>, ...)",{"type":54,"value":436},{"type":48,"tag":145,"props":1248,"children":1250},{"className":1249},[],[1251],{"type":54,"value":1252},"re_optimize_criteria={\"type\": \"drift_from_optimal\", \"threshold\": 0, \"norm\": 1}",{"type":54,"value":1254}," and call ",{"type":48,"tag":145,"props":1256,"children":1258},{"className":1257},[],[1259],{"type":54,"value":1260},"re_optimize(transaction_cost_factor=..., plot_title=\"Monthly Rebalancing\")",{"type":54,"value":1262},". The rebalancer returns ",{"type":48,"tag":145,"props":1264,"children":1266},{"className":1265},[],[1267],{"type":54,"value":1268},"(results_dataframe, re_optimize_dates, cumulative_portfolio_value)",{"type":54,"value":177},{"type":48,"tag":57,"props":1271,"children":1273},{"id":1272},"data-and-defaults",[1274],{"type":54,"value":1275},"Data and Defaults",{"type":48,"tag":1277,"props":1278,"children":1279},"table",{},[1280,1299],{"type":48,"tag":1281,"props":1282,"children":1283},"thead",{},[1284],{"type":48,"tag":1285,"props":1286,"children":1287},"tr",{},[1288,1294],{"type":48,"tag":1289,"props":1290,"children":1291},"th",{},[1292],{"type":54,"value":1293},"Setting",{"type":48,"tag":1289,"props":1295,"children":1296},{},[1297],{"type":54,"value":1298},"Default",{"type":48,"tag":1300,"props":1301,"children":1302},"tbody",{},[1303,1320,1333,1346,1359,1376,1393,1406,1419],{"type":48,"tag":1285,"props":1304,"children":1305},{},[1306,1312],{"type":48,"tag":1307,"props":1308,"children":1309},"td",{},[1310],{"type":54,"value":1311},"Dataset",{"type":48,"tag":1307,"props":1313,"children":1314},{},[1315],{"type":48,"tag":145,"props":1316,"children":1318},{"className":1317},[],[1319],{"type":54,"value":286},{"type":48,"tag":1285,"props":1321,"children":1322},{},[1323,1328],{"type":48,"tag":1307,"props":1324,"children":1325},{},[1326],{"type":54,"value":1327},"Date range",{"type":48,"tag":1307,"props":1329,"children":1330},{},[1331],{"type":54,"value":1332},"Full available range",{"type":48,"tag":1285,"props":1334,"children":1335},{},[1336,1341],{"type":48,"tag":1307,"props":1337,"children":1338},{},[1339],{"type":54,"value":1340},"Portfolio type",{"type":48,"tag":1307,"props":1342,"children":1343},{},[1344],{"type":54,"value":1345},"Long-only",{"type":48,"tag":1285,"props":1347,"children":1348},{},[1349,1354],{"type":48,"tag":1307,"props":1350,"children":1351},{},[1352],{"type":54,"value":1353},"Max weight",{"type":48,"tag":1307,"props":1355,"children":1356},{},[1357],{"type":54,"value":1358},"None unless specified",{"type":48,"tag":1285,"props":1360,"children":1361},{},[1362,1367],{"type":48,"tag":1307,"props":1363,"children":1364},{},[1365],{"type":54,"value":1366},"Risk aversion",{"type":48,"tag":1307,"props":1368,"children":1369},{},[1370],{"type":48,"tag":145,"props":1371,"children":1373},{"className":1372},[],[1374],{"type":54,"value":1375},"1.0",{"type":48,"tag":1285,"props":1377,"children":1378},{},[1379,1384],{"type":48,"tag":1307,"props":1380,"children":1381},{},[1382],{"type":54,"value":1383},"Confidence",{"type":48,"tag":1307,"props":1385,"children":1386},{},[1387],{"type":48,"tag":145,"props":1388,"children":1390},{"className":1389},[],[1391],{"type":54,"value":1392},"0.95",{"type":48,"tag":1285,"props":1394,"children":1395},{},[1396,1401],{"type":48,"tag":1307,"props":1397,"children":1398},{},[1399],{"type":54,"value":1400},"Scenario method",{"type":48,"tag":1307,"props":1402,"children":1403},{},[1404],{"type":54,"value":1405},"KDE on GPU",{"type":48,"tag":1285,"props":1407,"children":1408},{},[1409,1414],{"type":48,"tag":1307,"props":1410,"children":1411},{},[1412],{"type":54,"value":1413},"Solver",{"type":48,"tag":1307,"props":1415,"children":1416},{},[1417],{"type":54,"value":1418},"cuOpt GPU with PDLP",{"type":48,"tag":1285,"props":1420,"children":1421},{},[1422,1427],{"type":48,"tag":1307,"props":1423,"children":1424},{},[1425],{"type":54,"value":1426},"Rebalancing",{"type":48,"tag":1307,"props":1428,"children":1429},{},[1430],{"type":54,"value":1431},"None unless requested",{"type":48,"tag":64,"props":1433,"children":1434},{},[1435,1437,1443],{"type":54,"value":1436},"The default S&P 500 file is a historical snapshot and can omit current constituents. User-supplied CSVs should be date-indexed price tables with ticker columns, compatible with ",{"type":48,"tag":145,"props":1438,"children":1440},{"className":1439},[],[1441],{"type":54,"value":1442},"utils.get_input_data",{"type":54,"value":1444},". If requested tickers are absent, drop them, report the omissions, and continue with available columns unless the user explicitly asks you to fetch other data.",{"type":48,"tag":57,"props":1446,"children":1448},{"id":1447},"key-apis",[1449],{"type":54,"value":1450},"Key APIs",{"type":48,"tag":64,"props":1452,"children":1453},{},[1454,1456,1462,1464,1470,1471,1477,1478,1484,1485,1491,1493,1499,1501,1507,1509,1515],{"type":54,"value":1455},"Use the package APIs instead of reimplementing portfolio math or simulation loops. cuFOLIO helpers return flat objects: ",{"type":48,"tag":145,"props":1457,"children":1459},{"className":1458},[],[1460],{"type":54,"value":1461},"returns_dict",{"type":54,"value":1463}," has keys such as ",{"type":48,"tag":145,"props":1465,"children":1467},{"className":1466},[],[1468],{"type":54,"value":1469},"returns",{"type":54,"value":694},{"type":48,"tag":145,"props":1472,"children":1474},{"className":1473},[],[1475],{"type":54,"value":1476},"mean",{"type":54,"value":694},{"type":48,"tag":145,"props":1479,"children":1481},{"className":1480},[],[1482],{"type":54,"value":1483},"covariance",{"type":54,"value":709},{"type":48,"tag":145,"props":1486,"children":1488},{"className":1487},[],[1489],{"type":54,"value":1490},"tickers",{"type":54,"value":1492},"; do not index it as ",{"type":48,"tag":145,"props":1494,"children":1496},{"className":1495},[],[1497],{"type":54,"value":1498},"returns_dict[\"regime_1\"]",{"type":54,"value":1500},". ",{"type":48,"tag":145,"props":1502,"children":1504},{"className":1503},[],[1505],{"type":54,"value":1506},"solve_optimization_problem(...)",{"type":54,"value":1508}," returns ",{"type":48,"tag":145,"props":1510,"children":1512},{"className":1511},[],[1513],{"type":54,"value":1514},"(result_row, portfolio)",{"type":54,"value":1516},", not a nested result dictionary.",{"type":48,"tag":81,"props":1518,"children":1519},{},[1520,1532,1559,1571,1582,1594,1629,1649,1684,1719],{"type":48,"tag":85,"props":1521,"children":1522},{},[1523,1525,1531],{"type":54,"value":1524},"Returns: ",{"type":48,"tag":145,"props":1526,"children":1528},{"className":1527},[],[1529],{"type":54,"value":1530},"utils.calculate_returns(input_dataset, regime_dict, returns_compute_settings)",{"type":54,"value":177},{"type":48,"tag":85,"props":1533,"children":1534},{},[1535,1537,1542,1544,1550,1551,1557],{"type":54,"value":1536},"Regime filter: ",{"type":48,"tag":145,"props":1538,"children":1540},{"className":1539},[],[1541],{"type":54,"value":455},{"type":54,"value":1543}," is ",{"type":48,"tag":145,"props":1545,"children":1547},{"className":1546},[],[1548],{"type":54,"value":1549},"None",{"type":54,"value":169},{"type":48,"tag":145,"props":1552,"children":1554},{"className":1553},[],[1555],{"type":54,"value":1556},"{\"name\": \"...\", \"range\": (\"YYYY-MM-DD\", \"YYYY-MM-DD\")}",{"type":54,"value":1558},"; it is not keyed by regime name and does not contain tickers.",{"type":48,"tag":85,"props":1560,"children":1561},{},[1562,1564,1570],{"type":54,"value":1563},"Scenarios: ",{"type":48,"tag":145,"props":1565,"children":1567},{"className":1566},[],[1568],{"type":54,"value":1569},"cvar_utils.generate_cvar_data(returns_dict, scenario_generation_settings)",{"type":54,"value":177},{"type":48,"tag":85,"props":1572,"children":1573},{},[1574,1576,1581],{"type":54,"value":1575},"Optimizer: ",{"type":48,"tag":145,"props":1577,"children":1579},{"className":1578},[],[1580],{"type":54,"value":544},{"type":54,"value":177},{"type":48,"tag":85,"props":1583,"children":1584},{},[1585,1587,1593],{"type":54,"value":1586},"Solve: ",{"type":48,"tag":145,"props":1588,"children":1590},{"className":1589},[],[1591],{"type":54,"value":1592},"result_row, portfolio = cvar_problem.solve_optimization_problem(solver_settings=SOLVER_SETTINGS, print_results=False)",{"type":54,"value":177},{"type":48,"tag":85,"props":1595,"children":1596},{},[1597,1599,1605,1607,1613,1615,1621,1623,1628],{"type":54,"value":1598},"Efficient frontier: ",{"type":48,"tag":145,"props":1600,"children":1602},{"className":1601},[],[1603],{"type":54,"value":1604},"cvar_utils.create_efficient_frontier(returns_dict, cvar_params, solver_settings=SOLVER_SETTINGS, ra_num=25)",{"type":54,"value":1606},". The returned ",{"type":48,"tag":145,"props":1608,"children":1610},{"className":1609},[],[1611],{"type":54,"value":1612},"results_df",{"type":54,"value":1614}," includes metrics, a ",{"type":48,"tag":145,"props":1616,"children":1618},{"className":1617},[],[1619],{"type":54,"value":1620},"weights",{"type":54,"value":1622}," dict column, and ",{"type":48,"tag":145,"props":1624,"children":1626},{"className":1625},[],[1627],{"type":54,"value":677},{"type":54,"value":177},{"type":48,"tag":85,"props":1630,"children":1631},{},[1632,1634,1640,1642,1647],{"type":54,"value":1633},"Portfolio: ",{"type":48,"tag":145,"props":1635,"children":1637},{"className":1636},[],[1638],{"type":54,"value":1639},"Portfolio(name=\"\", tickers=None, weights=None, cash=0.0, time_range=None)",{"type":54,"value":1641},"; pass tickers and a flat array-like ",{"type":48,"tag":145,"props":1643,"children":1645},{"className":1644},[],[1646],{"type":54,"value":1620},{"type":54,"value":1648}," aligned to those tickers.",{"type":48,"tag":85,"props":1650,"children":1651},{},[1652,1654,1660,1662,1668,1669,1675,1677,1683],{"type":54,"value":1653},"Backtest: create ",{"type":48,"tag":145,"props":1655,"children":1657},{"className":1656},[],[1658],{"type":54,"value":1659},"portfolio.Portfolio",{"type":54,"value":1661}," objects for the optimized allocation and each benchmark; for an equal-weight benchmark, use weights of ",{"type":48,"tag":145,"props":1663,"children":1665},{"className":1664},[],[1666],{"type":54,"value":1667},"1 \u002F len(tickers)",{"type":54,"value":510},{"type":48,"tag":145,"props":1670,"children":1672},{"className":1671},[],[1673],{"type":54,"value":1674},"cash=0.0",{"type":54,"value":1676},", then call ",{"type":48,"tag":145,"props":1678,"children":1680},{"className":1679},[],[1681],{"type":54,"value":1682},"backtest.portfolio_backtester(test_portfolio, returns_dict, risk_free_rate=0.0, test_method=\"historical\", benchmark_portfolios=[...]).backtest_against_benchmarks(...)",{"type":54,"value":177},{"type":48,"tag":85,"props":1685,"children":1686},{},[1687,1689,1695,1697,1703,1705,1711,1713,1718],{"type":54,"value":1688},"Rebalance: ",{"type":48,"tag":145,"props":1690,"children":1692},{"className":1691},[],[1693],{"type":54,"value":1694},"rebalance.rebalance_portfolio(...)",{"type":54,"value":1696}," requires ",{"type":48,"tag":145,"props":1698,"children":1700},{"className":1699},[],[1701],{"type":54,"value":1702},"dataset_directory",{"type":54,"value":1704}," to be a CSV path, not a DataFrame. Call ",{"type":48,"tag":145,"props":1706,"children":1708},{"className":1707},[],[1709],{"type":54,"value":1710},"re_optimize(...)",{"type":54,"value":1712},"; it returns ",{"type":48,"tag":145,"props":1714,"children":1716},{"className":1715},[],[1717],{"type":54,"value":1268},{"type":54,"value":177},{"type":48,"tag":85,"props":1720,"children":1721},{},[1722,1724,1730,1731,1737,1738,1744,1745,1751,1752,1757],{"type":54,"value":1723},"Settings models: ",{"type":48,"tag":145,"props":1725,"children":1727},{"className":1726},[],[1728],{"type":54,"value":1729},"ReturnsComputeSettings",{"type":54,"value":694},{"type":48,"tag":145,"props":1732,"children":1734},{"className":1733},[],[1735],{"type":54,"value":1736},"ScenarioGenerationSettings",{"type":54,"value":694},{"type":48,"tag":145,"props":1739,"children":1741},{"className":1740},[],[1742],{"type":54,"value":1743},"KDESettings",{"type":54,"value":694},{"type":48,"tag":145,"props":1746,"children":1748},{"className":1747},[],[1749],{"type":54,"value":1750},"ApiSettings",{"type":54,"value":709},{"type":48,"tag":145,"props":1753,"children":1755},{"className":1754},[],[1756],{"type":54,"value":500},{"type":54,"value":177},{"type":48,"tag":57,"props":1759,"children":1761},{"id":1760},"examples",[1762],{"type":54,"value":1763},"Examples",{"type":48,"tag":81,"props":1765,"children":1766},{},[1767,1779,1799,1811,1823],{"type":48,"tag":85,"props":1768,"children":1769},{},[1770,1772,1777],{"type":54,"value":1771},"\"Build the optimal portfolio from the S&P 500\": load prices, compute LOG returns, generate GPU KDE scenarios, set long-only fully invested ",{"type":48,"tag":145,"props":1773,"children":1775},{"className":1774},[],[1776],{"type":54,"value":500},{"type":54,"value":1778},", solve with cuOpt, and report diversified weights plus return\u002FCVaR.",{"type":48,"tag":85,"props":1780,"children":1781},{},[1782,1784,1790,1792,1797],{"type":54,"value":1783},"\"Plot the efficient frontier\": call ",{"type":48,"tag":145,"props":1785,"children":1787},{"className":1786},[],[1788],{"type":54,"value":1789},"create_efficient_frontier(...)",{"type":54,"value":1791},", return ",{"type":48,"tag":145,"props":1793,"children":1795},{"className":1794},[],[1796],{"type":54,"value":1612},{"type":54,"value":1798},", and show or save the figure as requested.",{"type":48,"tag":85,"props":1800,"children":1801},{},[1802,1804,1809],{"type":54,"value":1803},"\"Give me weights by risk aversion\": expand ",{"type":48,"tag":145,"props":1805,"children":1807},{"className":1806},[],[1808],{"type":54,"value":669},{"type":54,"value":1810}," into a per-asset table.",{"type":48,"tag":85,"props":1812,"children":1813},{},[1814,1816,1821],{"type":54,"value":1815},"\"Backtest against equal weight\": build the optimized and equal-weight ",{"type":48,"tag":145,"props":1817,"children":1819},{"className":1818},[],[1820],{"type":54,"value":1209},{"type":54,"value":1822}," objects, then use the cuFOLIO backtester and report Sharpe, Sortino, and max drawdown.",{"type":48,"tag":85,"props":1824,"children":1825},{},[1826,1828,1834,1836,1842],{"type":54,"value":1827},"\"Backtest monthly rebalancing\": configure ",{"type":48,"tag":145,"props":1829,"children":1831},{"className":1830},[],[1832],{"type":54,"value":1833},"rebalance_portfolio",{"type":54,"value":1835}," with the drift trigger above and run ",{"type":48,"tag":145,"props":1837,"children":1839},{"className":1838},[],[1840],{"type":54,"value":1841},"re_optimize(transaction_cost_factor=...)",{"type":54,"value":177},{"type":48,"tag":57,"props":1844,"children":1846},{"id":1845},"limitations",[1847],{"type":54,"value":1848},"Limitations",{"type":48,"tag":81,"props":1850,"children":1851},{},[1852,1857,1862,1867],{"type":48,"tag":85,"props":1853,"children":1854},{},[1855],{"type":54,"value":1856},"Requires an NVIDIA GPU with cuOpt and cuML; CPU solvers are intentionally disallowed.",{"type":48,"tag":85,"props":1858,"children":1859},{},[1860],{"type":54,"value":1861},"CPU-only eval containers can still validate routing, data handling, and reporting behavior, but they cannot produce a valid cuOpt solve. In that case, report the missing GPU\u002FcuOpt runtime explicitly.",{"type":48,"tag":85,"props":1863,"children":1864},{},[1865],{"type":54,"value":1866},"Default price data is a historical snapshot and may omit current constituents.",{"type":48,"tag":85,"props":1868,"children":1869},{},[1870],{"type":54,"value":1871},"First-run dataset download depends on network access unless the user supplies a CSV.",{"type":48,"tag":57,"props":1873,"children":1875},{"id":1874},"troubleshooting",[1876],{"type":54,"value":1877},"Troubleshooting",{"type":48,"tag":81,"props":1879,"children":1880},{},[1881,1902,1927,1960,1978,1983,1988],{"type":48,"tag":85,"props":1882,"children":1883},{},[1884,1886,1892,1894,1900],{"type":54,"value":1885},"Missing default CSV or ",{"type":48,"tag":145,"props":1887,"children":1889},{"className":1888},[],[1890],{"type":54,"value":1891},"FileNotFoundError",{"type":54,"value":1893},": explain that cuFOLIO will fetch public market data with ",{"type":48,"tag":145,"props":1895,"children":1897},{"className":1896},[],[1898],{"type":54,"value":1899},"download_data(\"data\u002Fstock_data\", datasets=[\"sp500\"])",{"type":54,"value":1901},"; run it only after user confirmation.",{"type":48,"tag":85,"props":1903,"children":1904},{},[1905,1911,1913,1918,1920,1926],{"type":48,"tag":145,"props":1906,"children":1908},{"className":1907},[],[1909],{"type":54,"value":1910},"SolverError",{"type":54,"value":1912}," or missing ",{"type":48,"tag":145,"props":1914,"children":1916},{"className":1915},[],[1917],{"type":54,"value":194},{"type":54,"value":1919},": install the CUDA extra matching the host and verify with ",{"type":48,"tag":145,"props":1921,"children":1923},{"className":1922},[],[1924],{"type":54,"value":1925},"python -c \"import cvxpy as cp; print(hasattr(cp, 'CUOPT'), cp.installed_solvers())\"",{"type":54,"value":177},{"type":48,"tag":85,"props":1928,"children":1929},{},[1930,1936,1938,1944,1946,1952,1954,1959],{"type":48,"tag":145,"props":1931,"children":1933},{"className":1932},[],[1934],{"type":54,"value":1935},"ImportError",{"type":54,"value":1937}," for ",{"type":48,"tag":145,"props":1939,"children":1941},{"className":1940},[],[1942],{"type":54,"value":1943},"cuml",{"type":54,"value":1945}," or GPU KDE failures: confirm cuML is present with ",{"type":48,"tag":145,"props":1947,"children":1949},{"className":1948},[],[1950],{"type":54,"value":1951},"python -c \"import cuml\"",{"type":54,"value":1953}," and keep ",{"type":48,"tag":145,"props":1955,"children":1957},{"className":1956},[],[1958],{"type":54,"value":488},{"type":54,"value":177},{"type":48,"tag":85,"props":1961,"children":1962},{},[1963,1965,1970,1972,1977],{"type":54,"value":1964},"Ordinary optimization returns all cash: set ",{"type":48,"tag":145,"props":1966,"children":1968},{"className":1967},[],[1969],{"type":54,"value":531},{"type":54,"value":1971}," in ",{"type":48,"tag":145,"props":1973,"children":1975},{"className":1974},[],[1976],{"type":54,"value":500},{"type":54,"value":177},{"type":48,"tag":85,"props":1979,"children":1980},{},[1981],{"type":54,"value":1982},"Solver reports infeasible or no solution: check for contradictory bounds, too few tickers for the requested caps\u002Fcardinality, or a date filter that leaves too little data; report the smallest constraint change that would make the request feasible.",{"type":48,"tag":85,"props":1984,"children":1985},{},[1986],{"type":54,"value":1987},"Requested tickers are absent from the default CSV: report them and proceed with the remaining requested tickers.",{"type":48,"tag":85,"props":1989,"children":1990},{},[1991],{"type":54,"value":1992},"User CSV fails validation: ask for a date-indexed price table or a CSV whose first column is dates and remaining columns are numeric ticker prices; mention the minimum 60-row post-filter requirement.",{"type":48,"tag":1994,"props":1995,"children":1996},"style",{},[1997],{"type":54,"value":1998},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":2000,"total":2158},[2001,2019,2036,2047,2059,2073,2086,2100,2113,2124,2138,2147],{"slug":2002,"name":2002,"fn":2003,"description":2004,"org":2005,"tags":2006,"stars":2016,"repoUrl":2017,"updatedAt":2018},"nemoclaw-user-guide","retrieve NemoClaw documentation and configuration","Guides human users' AI agents to the NemoClaw docs MCP server and canonical Fern documentation in Markdown form. Use when users ask how to install, configure, operate, troubleshoot, secure, or learn NemoClaw with an AI coding assistant. Trigger keywords - nemoclaw docs, use nemoclaw with ai agent, nemoclaw mcp docs, nemoclaw install help, nemoclaw quickstart, nemoclaw markdown docs, llms.txt, agent skills.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2007,2010,2013],{"name":2008,"slug":2009,"type":15},"Documentation","documentation",{"name":2011,"slug":2012,"type":15},"MCP","mcp",{"name":2014,"slug":2015,"type":15},"Search","search",21777,"https:\u002F\u002Fgithub.com\u002FNVIDIA\u002FNemoClaw","2026-07-20T06:00:01.461044",{"slug":2020,"name":2020,"fn":2021,"description":2022,"org":2023,"tags":2024,"stars":2033,"repoUrl":2034,"updatedAt":2035},"mcore-build-and-dependency","manage Megatron-LM development environments","Container-based dev environment setup and dependency management for Megatron-LM. Covers acquiring and launching the CI container, uv package management, and updating uv.lock.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2025,2028,2031],{"name":2026,"slug":2027,"type":15},"Containers","containers",{"name":2029,"slug":2030,"type":15},"Deployment","deployment",{"name":2032,"slug":294,"type":15},"Python",17049,"https:\u002F\u002Fgithub.com\u002FNVIDIA\u002FMegatron-LM","2026-07-27T06:06:11.249662",{"slug":2037,"name":2037,"fn":2038,"description":2039,"org":2040,"tags":2041,"stars":2033,"repoUrl":2034,"updatedAt":2046},"mcore-bump-base-image","update NVIDIA PyTorch base images","Bump the NVIDIA PyTorch base image (`nvcr.io\u002Fnvidia\u002Fpytorch:YY.MM-py3`) used by Megatron-LM CI. Covers the two pin sites (GitHub CI in `docker\u002F.ngc_version.dev` and GitLab CI in `.gitlab\u002Fstages\u002F01.build.yml`), the post-bump CI loop (re-run functional tests, refresh golden values, mark broken tests), and the gotchas that bit PRs",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2042,2045],{"name":2043,"slug":2044,"type":15},"CI\u002FCD","ci-cd",{"name":2029,"slug":2030,"type":15},"2026-07-14T05:25:59.97109",{"slug":2048,"name":2048,"fn":2049,"description":2050,"org":2051,"tags":2052,"stars":2033,"repoUrl":2034,"updatedAt":2058},"mcore-cicd","manage CI\u002FCD pipelines for Megatron-LM","CI\u002FCD reference for Megatron-LM. Covers CI pipeline structure, PR scope labels, triggering internal GitLab CI (which force-pushes the current branch to a pull-request\u002FBRANCH ref — always dry-run and verify the destination first; never run against shared or protected branches), and CI failure investigation.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2053,2054,2055],{"name":2043,"slug":2044,"type":15},{"name":2029,"slug":2030,"type":15},{"name":2056,"slug":2057,"type":15},"GitHub","github","2026-07-27T06:06:12.278222",{"slug":2060,"name":2060,"fn":2061,"description":2062,"org":2063,"tags":2064,"stars":2033,"repoUrl":2034,"updatedAt":2072},"mcore-create-issue","investigate CI failures and create issues","Investigate a failing GitHub Actions run or job and create a GitHub issue for the failure.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2065,2068,2069],{"name":2066,"slug":2067,"type":15},"Debugging","debugging",{"name":2056,"slug":2057,"type":15},{"name":2070,"slug":2071,"type":15},"Triage","triage","2026-07-14T05:25:57.442089",{"slug":2074,"name":2074,"fn":2075,"description":2076,"org":2077,"tags":2078,"stars":2033,"repoUrl":2034,"updatedAt":2085},"mcore-linting-and-formatting","lint and format Megatron-LM code","Linting and formatting for Megatron-LM. Covers running autoformat.sh, tools (ruff, black, isort, pylint, mypy), and code style rules.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2079,2082],{"name":2080,"slug":2081,"type":15},"Best Practices","best-practices",{"name":2083,"slug":2084,"type":15},"Code Analysis","code-analysis","2026-07-14T05:25:56.18433",{"slug":2087,"name":2087,"fn":2088,"description":2089,"org":2090,"tags":2091,"stars":2033,"repoUrl":2034,"updatedAt":2099},"mcore-migrate-gpt-to-hybrid","migrate Megatron-LM models to HybridModel","Migration guide for moving Megatron Core GPTModel checkpoints, model providers, training commands, and layer mappings to HybridModel.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2092,2095,2098],{"name":2093,"slug":2094,"type":15},"Machine Learning","machine-learning",{"name":2096,"slug":2097,"type":15},"Migration","migration",{"name":9,"slug":8,"type":15},"2026-07-17T06:07:11.777011",{"slug":2101,"name":2101,"fn":2102,"description":2103,"org":2104,"tags":2105,"stars":2033,"repoUrl":2034,"updatedAt":2112},"mcore-onboard-gb200-1node-tests","onboard functional tests for GB200","Onboard 1-node GitHub MR functional tests for GB200 from existing mr-scoped 2-node tests.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2106,2109],{"name":2107,"slug":2108,"type":15},"QA","qa",{"name":2110,"slug":2111,"type":15},"Testing","testing","2026-07-14T05:25:53.673039",{"slug":2114,"name":2114,"fn":2115,"description":2116,"org":2117,"tags":2118,"stars":2033,"repoUrl":2034,"updatedAt":2123},"mcore-run-on-slurm","launch distributed training jobs on SLURM","How to launch distributed Megatron-LM training jobs on a SLURM cluster. Covers a minimal sbatch skeleton, environment-variable setup for torch.distributed.run, CUDA_DEVICE_MAX_CONNECTIONS rules across hardware and parallelism modes, container conventions, monitoring, and per-rank failure diagnosis.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2119,2120],{"name":2029,"slug":2030,"type":15},{"name":2121,"slug":2122,"type":15},"Infrastructure","infrastructure","2026-07-14T05:25:49.362534",{"slug":2125,"name":2125,"fn":2126,"description":2127,"org":2128,"tags":2129,"stars":2033,"repoUrl":2034,"updatedAt":2137},"mcore-split-pr","split pull requests to reduce review load","Split a PR into multiple PRs to reduce the number of required CODEOWNERS reviewer groups.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2130,2133,2134],{"name":2131,"slug":2132,"type":15},"Code Review","code-review",{"name":2056,"slug":2057,"type":15},{"name":2135,"slug":2136,"type":15},"Pull Requests","pull-requests","2026-07-14T05:26:01.226578",{"slug":2139,"name":2139,"fn":2140,"description":2141,"org":2142,"tags":2143,"stars":2033,"repoUrl":2034,"updatedAt":2146},"mcore-testing","run and manage Megatron-LM tests","Test system for Megatron-LM. Covers test layout, recipe YAML structure, adding and running unit and functional tests, golden values, marker filters, and CI parity.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2144,2145],{"name":2107,"slug":2108,"type":15},{"name":2110,"slug":2111,"type":15},"2026-07-14T05:25:54.928983",{"slug":2148,"name":2148,"fn":2149,"description":2150,"org":2151,"tags":2152,"stars":2033,"repoUrl":2034,"updatedAt":2157},"nightly-sync","manage nightly main-to-dev sync workflows","Domain knowledge for the nightly main-to-dev sync workflow. Covers merge strategy, CI architecture, failure investigation, and known issues.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2153,2156],{"name":2154,"slug":2155,"type":15},"Automation","automation",{"name":2043,"slug":2044,"type":15},"2026-07-30T05:29:03.275638",496,{"items":2160,"total":2256},[2161,2178,2188,2202,2212,2227,2242],{"slug":2162,"name":2162,"fn":2163,"description":2164,"org":2165,"tags":2166,"stars":23,"repoUrl":24,"updatedAt":2177},"accelerated-computing-cudf","accelerate data processing with cuDF","Official NVIDIA-authored guidance for NVIDIA cuDF GPU DataFrames, pandas acceleration, dask-cuDF, ETL, joins, groupby, CSV\u002FParquet I\u002FO, nullable semantics, and multi-GPU DataFrame workloads.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2167,2170,2173,2174],{"name":2168,"slug":2169,"type":15},"Data Analysis","data-analysis",{"name":2171,"slug":2172,"type":15},"Data Engineering","data-engineering",{"name":9,"slug":8,"type":15},{"name":2175,"slug":2176,"type":15},"Performance","performance","2026-07-14T05:28:43.176466",{"slug":2179,"name":2179,"fn":2180,"description":2181,"org":2182,"tags":2183,"stars":23,"repoUrl":24,"updatedAt":2187},"aiq-deploy","deploy and manage NVIDIA AI-Q infrastructure","Use when asked to install, deploy, run, validate, troubleshoot, or stop NVIDIA AI-Q Blueprint infrastructure.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2184,2185,2186],{"name":2029,"slug":2030,"type":15},{"name":2121,"slug":2122,"type":15},{"name":9,"slug":8,"type":15},"2026-07-14T05:29:06.667109",{"slug":2189,"name":2189,"fn":2190,"description":2191,"org":2192,"tags":2193,"stars":23,"repoUrl":24,"updatedAt":2201},"aiq-research","conduct deep research with AI-Q","Use when asked to run deep research or AI-Q research through a reachable NVIDIA AI-Q Blueprint backend.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2194,2197,2198],{"name":2195,"slug":2196,"type":15},"Agents","agents",{"name":9,"slug":8,"type":15},{"name":2199,"slug":2200,"type":15},"Research","research","2026-07-14T05:28:06.816956",{"slug":2203,"name":2203,"fn":2204,"description":2205,"org":2206,"tags":2207,"stars":23,"repoUrl":24,"updatedAt":2211},"amc-run-sample-calibration","run AMC sample dataset calibration","Run end-to-end calibration on the shipped sample dataset (sdg_08_2_sample_data_010926.zip) against a running AMC microservice. Use when user says 'test sample dataset', 'run sample calibration', 'verify AMC install', or 'launch and test'.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2208,2209,2210],{"name":2168,"slug":2169,"type":15},{"name":9,"slug":8,"type":15},{"name":2110,"slug":2111,"type":15},"2026-07-17T05:29:03.913266",{"slug":2213,"name":2213,"fn":2214,"description":2215,"org":2216,"tags":2217,"stars":23,"repoUrl":24,"updatedAt":2226},"amc-run-video-calibration","calibrate video datasets with AutoMagicCalib","Calibrate a new dataset from pre-recorded video files via the AutoMagicCalib REST API. Use when user has local MP4s and says 'calibrate my videos', 'run AMC on these videos', or similar. For RTSP\u002Flive streams, use amc-run-rtsp-calibration instead.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2218,2219,2222,2223],{"name":2154,"slug":2155,"type":15},{"name":2220,"slug":2221,"type":15},"Imaging","imaging",{"name":9,"slug":8,"type":15},{"name":2224,"slug":2225,"type":15},"Video","video","2026-07-17T05:28:53.905004",{"slug":2228,"name":2228,"fn":2229,"description":2230,"org":2231,"tags":2232,"stars":23,"repoUrl":24,"updatedAt":2241},"amc-setup-calibration-stack","deploy AutoMagicCalib microservice with Docker","Launch AutoMagicCalib microservice and web UI from NGC release images via Docker Compose. Use when user says 'deploy auto calibration', 'launch auto calibration', 'launch AMC', 'start MS+UI', or 'set up auto-magic-calib'. Requires NGC API key.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2233,2234,2237,2238],{"name":2029,"slug":2030,"type":15},{"name":2235,"slug":2236,"type":15},"Docker","docker",{"name":9,"slug":8,"type":15},{"name":2239,"slug":2240,"type":15},"Operations","operations","2026-07-17T05:28:56.913999",{"slug":2243,"name":2243,"fn":2244,"description":2245,"org":2246,"tags":2247,"stars":23,"repoUrl":24,"updatedAt":2255},"cudaq-guide","develop quantum applications with CUDA-Q","CUDA-Q onboarding guide for installation, test programs, GPU simulation, QPU hardware, and quantum applications.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[2248,2249,2252],{"name":9,"slug":8,"type":15},{"name":2250,"slug":2251,"type":15},"Quantum Computing","quantum-computing",{"name":2253,"slug":2254,"type":15},"Simulation","simulation","2026-07-14T05:26:58.898253",305]