Skip to content

Batch 4: portfolio (holdings, P/L, allocation, concentration, dividends) - #4

Open
Arvi23 wants to merge 2 commits into
batch-3-frontendfrom
batch-4-portfolio
Open

Arvi23 wants to merge 2 commits into
batch-3-frontendfrom
batch-4-portfolio

Conversation

@Arvi23

@Arvi23 Arvi23 commented Nov 4, 2026

Copy link
Copy Markdown
Owner

Stacked on #3. Merge #1–#3 first.

Portfolio

  • New holdings table, one row per position: shares, average cost, currency, and "why I own it" notes.
  • watchstock/portfolio.py (pure, tested) computes:
    • value, P/L and today's change
    • weights and sector allocation
    • projected yearly dividends and yield on cost
  • Currencies: totals are per currency, with no FX conversion; see D12 for why.
  • Concentration flags: a position above 20% or a sector above 40%, only with 3+ positions.
  • API: /api/portfolio GET/PUT/DELETE. PUT validates the ticker against Yahoo and caches its data.
  • Home screen:
    • "My Portfolio": summary cards, a holdings table (click a row to open the stock), position and sector doughnuts, flags
    • add/edit modal with autocomplete, decimal-comma input, and two-click remove
  • Stock sidebar: "You own N @ cost" with P/L.

Owner feedback

  • The long-term safety circle is now "Stability (debt & volatility)". Its breakdown says which half drags it down, e.g. a debt-free stock with beta 2.5.
  • Scores round half up, so 48.5 shows as 49.

76 backend tests. The UI smoke test covers the portfolio flow.


Generated by Claude Code

Arvi23 and others added 2 commits November 4, 2026 04:16
- holdings table (migration 2): one row per position with shares, average
  cost, currency and "why I own it" notes (D12).
- watchstock/portfolio.py (pure, tested): value, P/L, day change, weights,
  sector allocation, per-currency totals with no FX conversion, concentration
  flags (position > 20%, sector > 40%, only with 3+ positions), projected
  annual dividends and yield on cost, missing-price handling, biggest currency
  group first.
- /api/portfolio GET/PUT/DELETE; PUT validates the ticker via Yahoo and caches
  its snapshot (sector/country/dividend rate).
- Home screen "My Portfolio": summary cards, holdings table (click opens the
  stock), position and sector doughnuts, flags; add/edit modal with
  autocomplete, decimal-comma input and two-click remove.
- Stock sidebar shows "You own N @ cost" with P/L.
- Owner feedback: long-term safety is now "Stability (debt & volatility)" and
  its breakdown says which half drags it down; scores round half up.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TW7cJeWrcBW5SJHr4ZKtSH
… test

A background 'uv run' kept uv's cache lock, failing setup-uv's post-job prune.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TW7cJeWrcBW5SJHr4ZKtSH
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.

1 participant