Skip to content

Finance post#348

Merged
fretchen merged 18 commits intomainfrom
finance_post
Mar 15, 2026
Merged

Finance post#348
fretchen merged 18 commits intomainfrom
finance_post

Conversation

@fretchen
Copy link
Owner

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new interactive blog post on ETF diversification and introduces two reusable blog widgets (random-walk diversification simulator + risk-budget allocator) backed by a shared ETF dataset. Also includes minor Markdown formatting updates in a couple of planning/notes docs.

Changes:

  • Add DiversificationRandomWalk (Chart.js-based simulator) and PortfolioRiskAllocator (risk-budget optimizer UI).
  • Add shared ETF/covariance dataset used by both widgets.
  • Add new MDX blog post embedding the widgets; minor Markdown table/spacing cleanup in docs.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
website/TOC_IMPLEMENTATION_PLAN.md Markdown formatting/spacing cleanup in the ToC implementation plan.
website/components/blog/PortfolioRiskAllocator.tsx New interactive risk-budget allocator widget (UI + optimization routines).
website/components/blog/etfData.ts New shared ETF/cluster/covariance data payload for blog widgets.
website/components/blog/DiversificationRandomWalk.tsx New interactive diversification random-walk simulator + histogram visualization.
website/blog/multichain_technical_notes.md Markdown formatting cleanup (tables/spacing).
website/blog/etf_diversification_interactive.mdx New blog post embedding the new interactive widgets.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +29 to +42
const STEPS = 504; // 2 trading years — more points for smoother histogram
const ANIM_BATCH = 8; // steps drawn per frame
const ANIM_INTERVAL = 25; // ms between frames

interface Paths {
bondReturns: number[];
stockReturns: number[];
}

/** Generate correlated daily returns for bonds and stocks.
* Uses Cholesky decomposition for the 2×2 case. */
function generatePaths(sigBond: number, sigStock: number, rho: number): Paths {
const dailySigBond = sigBond / Math.sqrt(STEPS);
const dailySigStock = sigStock / Math.sqrt(STEPS);
Comment on lines +234 to +246
// defer interval to next tick so state is set
setTimeout(() => {
let step = 0;
animRef.current = setInterval(() => {
step = Math.min(step + ANIM_BATCH, STEPS);
setVisibleSteps(step);
if (step >= STEPS) {
clearInterval(animRef.current!);
animRef.current = null;
setIsAnimating(false);
}
}, ANIM_INTERVAL);
}, 0);
Comment on lines +313 to +341
<div
key={hi}
onPointerDown={(e) => {
e.preventDefault();
setDragging(hi);
}}
className={css({
position: "absolute",
top: "-2px",
width: "16px",
height: "calc(100% + 4px)",
cursor: "col-resize",
display: "flex",
alignItems: "center",
justifyContent: "center",
zIndex: 2,
})}
style={{ left: `calc(${leftPct}% - 8px)` }}
>
<div
className={css({
width: "4px",
height: "60%",
backgroundColor: "white",
borderRadius: "2px",
boxShadow: "0 1px 4px rgba(0,0,0,0.35)",
})}
/>
</div>
Comment on lines +521 to +524
{cluster.etfs.map((etf) => {
const idx = DATA.etf_names.indexOf(etf);
const etfVol = Math.sqrt(DATA.cov_etf_ann[idx][idx]) * 100;
return (
@fretchen fretchen merged commit be9c0a2 into main Mar 15, 2026
4 checks passed
@fretchen fretchen deleted the finance_post branch March 15, 2026 15:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants