Portfolio optimization
npx -y skills add kuntal-r-d/my-skills --skill portfolio-optimizationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
- 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Optimizes allocation across a portfolio of DSE stocks using Modern Portfolio Theory — expected return/covariance, the efficient frontier, max-Sharpe and min-variance portfolios, risk parity and Kelly sizing — plus correlation/diversification analysis and rebalancing gaps. Use when the user asks how to allocate/weight a portfolio, optimize allocation, efficient frontier, Sharpe-optimal weights, diversification, or rebalancing for Dhaka Stock Exchange holdings.
The file declares its own license as Apache-2.0. That is the author’s claim about this one file, and it is not the same thing as the license GitHub reports for the repository, which is listed with the other numbers below.
SKILL.md
4.1 KB, 876 tokens by cl100k_base, as published. Nobody here has run it
Portfolio Optimization
Prompt-first, pure-prompt skill. No script is bundled. The matrix math (covariance, efficient frontier) is heavy — reason carefully and state assumptions; for precise weights, compute the covariance/optimisation in a numeric environment and feed results back.
Role & objective
Recommend a risk-aware target allocation across supplied holdings and quantify the portfolio's risk/return, returning the optimal weights, key risk metrics and rebalancing gaps.
When to use
"How should I weight my portfolio?", "optimize my allocation", "efficient frontier",
"Sharpe-optimal weights", "am I diversified?", "rebalancing". Use risk-manager for per-trade sizing.
Inputs you need
portfolio— holdings{ticker, qty, price}(and current weights).ohlcvper holding (or a returns series) for expected return + covariance.risk_free_rate; optional constraints (min/max weight per name), transaction costs.
Method (follow in order)
- Inputs — per-asset expected return and volatility; pairwise correlations → covariance matrix.
- Frontier — describe the efficient frontier; identify the max-Sharpe and min-variance portfolios.
- Strategy — present the objective the user wants: max-Sharpe, min-variance, risk-parity (equal risk contribution), or Kelly-scaled sizing.
- Diversification — correlation clusters, diversification ratio, concentration.
- Rebalancing — gap between current and target weights; note transaction-cost drag.
Scoring rubric
No single −1..+1 score; the deliverable is the target weights plus risk metrics (Sharpe, volatility, VaR, max drawdown, beta). Rank candidate portfolios by Sharpe for the chosen risk level. Confidence depends on history length (≥252 trading days) and return-estimate stability.
Output (emit this Thinking Card)
{ "skill": "portfolio-optimization", "as_of": "..",
"key_metrics": { "expected_return": 0.0, "volatility": 0.0, "sharpe_ratio": 0.0,
"max_drawdown": 0.0, "diversification_ratio": 0.0, "var_95": 0.0 },
"optimal_allocation": { "TICKER1": 0.0, "TICKER2": 0.0 },
"rebalancing_actions": [ { "ticker": "..", "from_weight": 0.0, "to_weight": 0.0 } ],
"reasoning": ["assumptions + objective used"], "flags": ["short_history?", "estimates_unstable?"],
"disclaimer": "Educational analysis only. Not financial advice." }
DSE pitfalls
- DSE correlations spike in stress (everything falls together) and liquidity is uneven — a mean-variance optimum can be untradeable; sanity-check weights against daily traded value.
- Expected returns from short, noisy DSE history are unreliable — prefer min-variance/risk-parity and wide assumptions over precise max-Sharpe point estimates.
- Respect single-name and sector caps; don't output a concentrated "optimal" weight.
Optional precision helper
No bundled script — pure-prompt skill. For exact covariance/efficient-frontier solving, run a numeric optimiser (e.g. NumPy/cvxpy) and pass the weights back for interpretation.
Worked example
3 holdings, 1y returns, rf 6.5% → max-Sharpe weights ~ {A 0.45, B 0.35, C 0.20}, portfolio Sharpe ≈ 0.6, vol ≈ 23%; current over-weights A by 10pp → rebalance toward target (note costs).
References
See risk-manager/references/RISK.md for sizing/Kelly context.
Output is educational analysis only, never financial advice.
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.