12 Commits
Author SHA1 Message Date
vgearen 28eb6bd98c feat(korea): add Market.krStock + KRW currency + chart x-axis
Adding Market.krStock cascades into several exhaustive switches that must all
update together: ExchangeRates.convert, DisplayCurrency, StockChartView ranges
and labels. Bundles tasks 2/3/4/5/14 into one build-passing landing.

- Market enum: add krStock case + kr_ prefix routing in Market.from
- ExchangeRates: add usdToKrw (fallback 1380), krwToCny derived, KRW path in convert
- DisplayCurrency: add .krw (₩), display name 韩元
- CurrencyService.fetchRates: include fx_susdkrw in Sina FX batch URL
- StockChartView: KR fullDayRange 0...389 (KST 09:00-15:30, 390 min); KR axis labels
  09:00/10:30/12:00/13:30/15:30

Tests: +5 Stock cases for KR, +8 CurrencyKRWTests covering all KR↔CNY/USD/HKD/KRW
conversion paths and fallback constant.
2026-05-14 10:01:57 +08:00
vgearenandClaude Opus 4.6 f8bb287194 v1.2.6: Hide daily PnL on non-trading days (holidays/weekends)
- Add Quote.isToday: compare updateTime date with today in Beijing timezone
- effectiveDailyPnl returns nil when quote data is stale (not from today)
- Prevents showing yesterday's change as today's daily PnL on closed markets

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-03 14:14:49 +08:00
vgearenandClaude Opus 4.6 592ad90f61 v1.2.5: Add watchlist (观察仓) feature with virtual portfolio support
- New Watchlist model: named virtual portfolios with per-stock cost/shares
- Watchlists persisted to watchlists.json, active ID in settings
- AppState: effective cost/shares/PnL methods that respect active watchlist
- Settings: create/delete/switch watchlists, edit writes to active watchlist
- ProfitSummaryView shows active watchlist name
- UI alignment fixes for toggle and text field padding

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-31 11:31:59 +08:00
vgearenandClaude Opus 4.6 7e502232d3 v1.2.3: Add holdings group option to pin held stocks at top
- New setting: "持仓股单独分组置顶" toggle
- When enabled, stocks with holdings are grouped into a "持仓" section at top
- Remaining non-held stocks still grouped by A/HK/US market as usual
- StockGroupView supports custom title for holdings group

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-24 09:58:30 +08:00
vgearenandClaude Opus 4.6 c7b19e4f49 v1.2.1: Add sort settings (change% asc/desc, US session/regular price mode)
- Add SortRule enum (涨跌幅升序/降序) and USPriceMode enum (时段价格/盘中价)
- Settings page: sort rule segmented picker + US price mode picker
- Toolbar sort button applies configured rule; off = default order
- US stocks: session price mode uses extendedPrice for change% calculation

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-20 15:30:41 +08:00
vgearenandClaude Opus 4.6 00f142f091 v1.1.3: Fix status bar PnL display, rounded app icon, LaunchAgent fallback
- Fix "daily + total" PnL mode only showing daily: use single Text concatenation
- Move PnL options into status bar picker (daily / total / both), hide icon in PnL mode
- Add rounded corners to app icon for macOS consistency
- Add LaunchAgent plist fallback for launch-at-login on Intel Macs
- Remove StatusBarPnL enum, use statusBarStockId special values instead

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 09:56:19 +08:00
vgearenandClaude Opus 4.6 af7a45e027 v1.1.2: Status bar PnL display options and login item fix
- Add setting to choose status bar PnL: none / daily / total / both
- Fix launch-at-login: remove unconditional register() on every launch
- Add error logging for SMAppService register/unregister

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 09:27:08 +08:00
vgearenandClaude Opus 4.6 88e705fece v1.1.1: Add PnL percentage display and in-app auto-update
- Show floating PnL percentage for each stock and portfolio summary
- Show daily/total PnL percentage in profit summary view
- Replace manual GitHub download with in-app auto-update (download DMG, mount, replace, relaunch)
- Disable app sandbox for Process support (non-App Store distribution)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 09:16:35 +08:00
vgearenandClaude Sonnet 4.6 8c60d39024 Migrate all settings from UserDefaults to settings.json
- AppSettings: fully Codable with statusBarStockId, refreshInterval,
  colorScheme, displayCurrency; uses decodeIfPresent for forward compat
- AppState: replace @AppStorage with @Published var config: AppSettings,
  persisted to ~/Library/Application Support/Stockbar/settings.json
- Computed accessors (statusBarStockId, refreshInterval, colorScheme,
  displayCurrency) maintain same API so views require no changes
- Fix views: appState.settings.* → appState.config.*

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 10:12:59 +08:00
vgearenandClaude Sonnet 4.6 a119f89624 Fix config data loss on startup and Codable forward-compatibility
- AppState.init: use _stocks = Published(wrappedValue:) to bypass didSet,
  preventing empty array from overwriting disk on decode failure
- AppState.saveStocks: guard against overwriting non-empty file with []
- Stock: explicit Codable extension using decodeIfPresent for optional fields,
  so missing fields in old JSON use defaults instead of failing the whole decode

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 09:17:14 +08:00
vgearenandClaude Sonnet 4.6 5a482ac818 Add currency conversion for portfolio summary
- CurrencyService: fetch USD/CNY and USD/HKD from Sina Finance forex
- DisplayCurrency enum (CNY/HKD/USD) with symbol and display name
- AppState: fetch rates on every refresh, convert totalPnL/totalDailyPnL
- Settings: add 持仓汇总货币 segmented picker
- ProfitSummaryView: show currency symbol in P&L display

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-18 08:51:42 +08:00
vgearenandClaude Sonnet 4.6 6b1f565d7d Initial release: macOS menu bar stock monitor
- A-shares, HK, and US stock real-time quotes (Sina / Tencent)
- Intraday minute charts (Tencent / Yahoo Finance)
- US extended-hours session indicator with price and change%
- Portfolio P&L tracking (cost price × shares)
- Sort by change%, color themes, launch at login
- File-based persistence with 10-snapshot rolling backup
- Universal binary (Apple Silicon + Intel)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 17:41:52 +08:00