jpskill.com
📄 ドキュメント コミュニティ

PortfolioSyncing

Import and sync broker CSV portfolio data to Google Sheets DataHub. Supports Fidelity (automated) with multi-broker planned. USE WHEN user mentions import broker data OR sync portfolio OR update positions OR CSV import OR portfolio-sync OR ingest positions OR bring in positions OR downloaded from Fidelity OR working with Portfolio_Positions CSVs. Handles file ingestion from Downloads, position updates, SPAXX/margin validation, safety checks, and formula protection.

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o portfoliosyncing.zip https://jpskill.com/download/22806.zip && unzip -o portfoliosyncing.zip && rm portfoliosyncing.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/22806.zip -OutFile "$d\portfoliosyncing.zip"; Expand-Archive "$d\portfoliosyncing.zip" -DestinationPath $d -Force; ri "$d\portfoliosyncing.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して portfoliosyncing.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → portfoliosyncing フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

PortfolioSyncing

ブローカーのCSVポジションエクスポートをGoogle SheetsのDataHubタブに安全にインポートし、データの整合性を確保し、変更を検証し、重要な数式を保護します。

マルチブローカー対応

対応ブローカー:

  • Fidelity - 完全自動解析
  • ⚠️ *Schwab, Vanguard, TD Ameritrade, ETRADE, Robinhood** - 手動マッピングが必要(近日対応予定)

ブローカー検出: Finance Guruはuser-profile.yaml(オンボーディング時に設定)からブローカーを自動的に検出します。CSV解析はブローカーの形式に合わせて調整されます。

参照: 各ブローカーの詳細なエクスポート手順については、docs/broker-csv-export-guide.mdをご覧ください。

ワークフロールーティング

ワークフローを実行する際、対応する通知を出力します。

ワークフロー トリガー ファイル
IngestPositions "ingest positions", "import positions", "bring in positions", ユーザーがFidelityからのダウンロードに言及 workflows/IngestPositions.md
SyncPortfolio "sync portfolio", "portfolio-sync", "import fidelity" workflows/SyncPortfolio.md

一般的な流れ: IngestPositions(ダウンロードから移動)-> SyncPortfolio(Google Sheetsにプッシュ)

通知:

Running the **IngestPositions** workflow from the **PortfolioSyncing** skill...
Running the **SyncPortfolio** workflow from the **PortfolioSyncing** skill...

例1: ダウンロードからの完全なフロー

User: "ingest positions" or "bring in positions"
-> Scans ~/Downloads/ for Portfolio_Positions_*.csv and Balances_*.csv
-> Classifies regular vs dividend view by reading headers
-> Moves regular view as-is (already date-tagged)
-> Renames dividend view to Dividend_Positions_MMM-DD-YYYY.csv
-> Moves Balances file (overwrites existing)
-> Reports files moved and suggests "portfolio-sync" next

例2: インジェスト後の同期

User: "portfolio-sync"
-> Reads Portfolio_Positions_*.csv and Balances_*.csv from notebooks/updates/
-> Compares with Google Sheets DataHub
-> Updates quantities, cost basis, SPAXX, margin debt
-> Reports changes and validates formulas

例3: 取引後のポジション更新

User: "I just bought more JEPI, sync my portfolio"
-> Invokes SyncPortfolio workflow
-> Detects quantity change in JEPI
-> If >10% change, asks for confirmation
-> Updates DataHub with new position data

例4: 重複ダウンロードの処理

User downloads both regular and dividend views from Fidelity
-> ~/Downloads/ contains: Portfolio_Positions_Mar-06-2026.csv
                          Portfolio_Positions_Mar-06-2026 (1).csv
-> Reads header of each to classify
-> Regular view (has "Average Cost Basis") -> notebooks/updates/Portfolio_Positions_Mar-06-2026.csv
-> Dividend view (has "Ex-date") -> notebooks/updates/Dividend_Positions_Mar-06-2026.csv

CSV形式リファレンス

Fidelity Positions CSV (通常ビュー)

ヘッダー行 (17列):

Account Number,Account Name,Investment Type,Symbol,Description,Quantity,Last Price,Last Price Change,Current Value,Today's Gain/Loss Dollar,Today's Gain/Loss Percent,Total Gain/Loss Dollar,Total Gain/Loss Percent,Percent Of Account,Cost Basis Total,Average Cost Basis,Type

同期の主要フィールド: Symbol (4列目), Quantity (6列目), Average Cost Basis (16列目), Type (17列目 — "Margin"または"Cash")

Fidelity Positions CSV (配当ビュー)

ヘッダー行 (19列):

Account Number,Account Name,Investment Type,Symbol,Description,Quantity,Last Price,Last Price Change,Current Value,Percent Of Account,Ex-date,Amount per share,Pay date,Dist. yield,Distribution yield as of,SEC yield,SEC yield as of,Est. annual income,Type

簡易分類器: ヘッダーにEx-dateが含まれていれば配当ビュー。ヘッダーにAverage Cost Basisが含まれていれば通常ビュー。

Fidelity Balances CSV

キーバリュー形式(列形式ではありません)。抽出:

  • "Settled cash" → SPAXX行 (L列: Current Value)
  • "Account equity percentage" → 100%の場合、margin debt = $0
  • "Net debit" → 実際の証拠金残高(負の値はmargin debt)
  • "Margin interest accrued this month" → > $1の場合、margin debtが存在します

現金ポジションロジック:

  • Positions CSVのSPAXX値は使用しないでください(決済済みマネーマーケットのみを表示します)
  • SPAXX行にはBalances CSVの"Settled cash"を使用してください
  • "Settled cash" = 0の場合、SPAXX = $0(すべての資金は投資されているか、証拠金にあります)
  • "Cash market value"は現金ではありません — キャッシュ口座(証拠金口座ではない)のポジションの価値です

重要なルール

書き込み可能な列 (CSVから)

  • ✅ A列: Ticker
  • ✅ B列: Quantity
  • ✅ G列: Avg Cost Basis

重要な列 (絶対に触らない)

  • ❌ C列: Last Price (GOOGLEFINANCE数式)
  • ❌ D-F列: $ Change, % Change, Volume (数式)
  • ❌ H-M列: Gains/Losses計算 (数式)
  • ❌ N-S列: Ranges, dividends, layer (数式/手動)

更新パターン: 個々のセルのみを更新

黄金律: 更新範囲にC-F列を絶対に含めないでください。どのセルにも空文字列を絶対に渡さないでください。

C-F列の空文字列 ("") は、GOOGLEFINANCEおよび計算数式を削除します。常にA、B、G列を個別に更新してください。

// ✅ 正しい - 書き込み可能な列のみを一度に1つずつ更新
mcp__gdrive__sheets(operation: "updateCells", params: {
    spreadsheetId: SPREADSHEET_ID,
    range: "DataHub!B13:B13",  // ✅ 単一列、特定の行
    values: [["72.942"]]
})
// ❌ 間違い - 空文字列を含む複数列範囲は数式を破壊します
mcp__gdrive__sheets(operation: "updateCells", params: {
    range: "DataHub!A13:G13",
    values: [["JEPI", "72.942", "", "", "", "", "$56.48"]]  // ❌ 空文字列は数式を削除します
})
アクション 正しい 間違い
数量の更新 range: "DataHub!B13:B13" 空文字列を含むrange: "DataHub!A13:G13"
コストベースの更新 range: "DataHub!G13:G13" 範囲にC-F列を含める
新しいティッカーの追加 3つの個別の呼び出し (A, B, G) 空文字列を含む単一の呼び出し
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

PortfolioSyncing

Safely import broker CSV position exports into the Google Sheets DataHub tab, ensuring data integrity, validating changes, and protecting sacred formulas.

Multi-Broker Support

Supported Brokers:

  • Fidelity - Fully automated parsing
  • ⚠️ *Schwab, Vanguard, TD Ameritrade, ETRADE, Robinhood** - Manual mapping required (coming soon)

Broker Detection: Finance Guru automatically detects your broker from user-profile.yaml (set during onboarding). CSV parsing is tailored to your broker's format.

See: docs/broker-csv-export-guide.md for detailed export instructions per broker.

Workflow Routing

When executing a workflow, output the corresponding notification:

Workflow Trigger File
IngestPositions "ingest positions", "import positions", "bring in positions", user mentions downloading from Fidelity workflows/IngestPositions.md
SyncPortfolio "sync portfolio", "portfolio-sync", "import fidelity" workflows/SyncPortfolio.md

Typical flow: IngestPositions (move from Downloads) -> SyncPortfolio (push to Google Sheets)

Notifications:

Running the **IngestPositions** workflow from the **PortfolioSyncing** skill...
Running the **SyncPortfolio** workflow from the **PortfolioSyncing** skill...

Examples

Example 1: Full flow from Downloads

User: "ingest positions" or "bring in positions"
-> Scans ~/Downloads/ for Portfolio_Positions_*.csv and Balances_*.csv
-> Classifies regular vs dividend view by reading headers
-> Moves regular view as-is (already date-tagged)
-> Renames dividend view to Dividend_Positions_MMM-DD-YYYY.csv
-> Moves Balances file (overwrites existing)
-> Reports files moved and suggests "portfolio-sync" next

Example 2: Sync after ingest

User: "portfolio-sync"
-> Reads Portfolio_Positions_*.csv and Balances_*.csv from notebooks/updates/
-> Compares with Google Sheets DataHub
-> Updates quantities, cost basis, SPAXX, margin debt
-> Reports changes and validates formulas

Example 3: Update positions after trades

User: "I just bought more JEPI, sync my portfolio"
-> Invokes SyncPortfolio workflow
-> Detects quantity change in JEPI
-> If >10% change, asks for confirmation
-> Updates DataHub with new position data

Example 4: Handling duplicate downloads

User downloads both regular and dividend views from Fidelity
-> ~/Downloads/ contains: Portfolio_Positions_Mar-06-2026.csv
                          Portfolio_Positions_Mar-06-2026 (1).csv
-> Reads header of each to classify
-> Regular view (has "Average Cost Basis") -> notebooks/updates/Portfolio_Positions_Mar-06-2026.csv
-> Dividend view (has "Ex-date") -> notebooks/updates/Dividend_Positions_Mar-06-2026.csv

CSV Format Reference

Fidelity Positions CSV (Regular View)

Header row (17 columns):

Account Number,Account Name,Investment Type,Symbol,Description,Quantity,Last Price,Last Price Change,Current Value,Today's Gain/Loss Dollar,Today's Gain/Loss Percent,Total Gain/Loss Dollar,Total Gain/Loss Percent,Percent Of Account,Cost Basis Total,Average Cost Basis,Type

Key fields for sync: Symbol (col 4), Quantity (col 6), Average Cost Basis (col 16), Type (col 17 — "Margin" or "Cash")

Fidelity Positions CSV (Dividend View)

Header row (19 columns):

Account Number,Account Name,Investment Type,Symbol,Description,Quantity,Last Price,Last Price Change,Current Value,Percent Of Account,Ex-date,Amount per share,Pay date,Dist. yield,Distribution yield as of,SEC yield,SEC yield as of,Est. annual income,Type

Quick classifier: If header contains Ex-date -> dividend view. If header contains Average Cost Basis -> regular view.

Fidelity Balances CSV

Key-value format (not columnar). Extract:

  • "Settled cash" → SPAXX row (Column L: Current Value)
  • "Account equity percentage" → If 100%, margin debt = $0
  • "Net debit" → Actual margin balance (negative value = margin debt)
  • "Margin interest accrued this month" → If > $1, there IS margin debt

Cash Position Logic:

  • Do NOT use SPAXX value from Positions CSV (shows only settled money market)
  • Use "Settled cash" from Balances CSV for the SPAXX row
  • If "Settled cash" = 0, then SPAXX = $0 (all funds are invested or in margin)
  • "Cash market value" is NOT cash — it's the value of positions in your Cash account (vs Margin account)

Critical Rules

WRITABLE Columns (from CSV)

  • ✅ Column A: Ticker
  • ✅ Column B: Quantity
  • ✅ Column G: Avg Cost Basis

SACRED Columns (NEVER TOUCH)

  • ❌ Column C: Last Price (GOOGLEFINANCE formulas)
  • ❌ Columns D-F: $ Change, % Change, Volume (formulas)
  • ❌ Columns H-M: Gains/Losses calculations (formulas)
  • ❌ Columns N-S: Ranges, dividends, layer (formulas/manual)

Update Pattern: Individual Cell Updates ONLY

Golden Rule: NEVER include columns C-F in your update range. NEVER pass empty strings to any cell.

Empty strings ("") in columns C-F DELETE the GOOGLEFINANCE and calculation formulas. Always update columns A, B, G individually:

// ✅ RIGHT - Update ONLY writable columns, one at a time
mcp__gdrive__sheets(operation: "updateCells", params: {
    spreadsheetId: SPREADSHEET_ID,
    range: "DataHub!B13:B13",  // ✅ Single column, specific row
    values: [["72.942"]]
})
// ❌ WRONG - Multi-column range with empty strings kills formulas
mcp__gdrive__sheets(operation: "updateCells", params: {
    range: "DataHub!A13:G13",
    values: [["JEPI", "72.942", "", "", "", "", "$56.48"]]  // ❌ Empty strings delete formulas
})
Action Correct Wrong
Update quantity range: "DataHub!B13:B13" range: "DataHub!A13:G13" with empty strings
Update cost basis range: "DataHub!G13:G13" Including columns C-F in range
Add new ticker 3 separate calls (A, B, G) Single call with empty strings in C-F

Layer Classification for New Tickers

When adding new tickers, classify into the correct portfolio layer in Column S.

Do NOT hardcode layer assignments. Instead, read the current layer definitions from:

  • Primary: fin-guru/data/spreadsheet-architecture.md → "Pattern-Based Layer Classification" section
  • Fallback: Read existing Column S values from DataHub to learn current classification patterns

If a new ticker doesn't clearly match any layer pattern, set to "UNKNOWN - Manual Review Required" and alert the user for classification.

Safety Gates

STOP conditions (require user confirmation):

  1. CSV has fewer tickers than sheet (possible sales)
  2. Any quantity change > 10%
  3. Any cost basis change > 20%
  4. 3+ formula errors detected
  5. Margin balance jumped > $5,000 (unintentional draw)
  6. SPAXX discrepancy > $100 (cash mismatch between sheet and CSV)

FLAG conditions (alert user but proceed):

  • SPAXX differs from "Settled cash" by $1-$100 (minor discrepancy)
  • Pending Activity differs from "Net debit" by >$100

When STOPPED: Show clear diff table, ask user to confirm, proceed only after explicit approval.

When FLAGGED: Show the discrepancy, proceed with update but highlight in summary.

Google Sheets Integration

Spreadsheet ID: Read from fin-guru/data/user-profile.yamlgoogle_sheets.portfolio_tracker.spreadsheet_id

Agent Permissions

Builder (Write-enabled): Can update columns A, B, G; can add new rows; can apply layer classification; CANNOT modify formulas.

All Other Agents (Read-only): Market Researcher, Quant Analyst, Strategy Advisor — can read all data, cannot write, must defer to Builder for updates.

Reference Files

  • Full Architecture: fin-guru/data/spreadsheet-architecture.md
  • Quick Reference: fin-guru/data/spreadsheet-quick-ref.md
  • User Profile: fin-guru/data/user-profile.yaml
  • Formula Protection: See the formula-protection skill for sacred formula rules

Pre-Flight Checklist

Before syncing (SyncPortfolio):

  • [ ] Positions CSV (Portfolio_Positions_*.csv) is latest by date in notebooks/updates/
  • [ ] Balances CSV (Balances_for_Account_*.csv) is available and current in notebooks/updates/
  • [ ] Both CSVs are from Fidelity (not M1 Finance or other broker)
  • [ ] Google Sheets DataHub tab exists
  • [ ] No pending manual edits in sheet (user should save first)
  • [ ] Current portfolio value is known (for validation)

Files not in notebooks/updates/ yet? Run IngestPositions first to move them from ~/Downloads/.

Both CSVs Required: Positions CSV alone is insufficient. Balances CSV provides:

  • "Settled cash" → SPAXX value
  • "Net debit" → Pending Activity and Margin Debt values

Skill Type: Domain (workflow guidance) Enforcement: BLOCK (data integrity critical) Priority: Critical