stock-portfolio
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chineseポートフォリオ管理スキル
Portfolio Management Skill
$ARGUMENTS を解析してコマンドを判定し、以下のコマンドを実行してください。
Parse $ARGUMENTS to determine the command, then execute the corresponding command below.
実行コマンド
Execution Command
bash
python3 /Users/kikuchihiroyuki/stock-skills/.claude/skills/stock-portfolio/scripts/run_portfolio.py <command> [args]bash
python3 /Users/kikuchihiroyuki/stock-skills/.claude/skills/stock-portfolio/scripts/run_portfolio.py <command> [args]コマンド一覧
Command List
snapshot -- PFスナップショット
snapshot -- Portfolio Snapshot
現在価格・損益・通貨換算を含むポートフォリオのスナップショットを生成する。
bash
python3 .../run_portfolio.py snapshotGenerate a portfolio snapshot including current price, profit/loss, and currency conversion.
bash
python3 .../run_portfolio.py snapshotbuy -- 購入記録追加
buy -- Add Purchase Record
bash
python3 .../run_portfolio.py buy --symbol <sym> --shares <n> --price <p> [--currency JPY] [--date YYYY-MM-DD] [--memo テキスト] [--yes]--yes-y--yesbash
python3 .../run_portfolio.py buy --symbol <sym> --shares <n> --price <p> [--currency JPY] [--date YYYY-MM-DD] [--memo text] [--yes]Omitting () will display a confirmation preview of the purchase details and exit. Specifying skips confirmation and directly records the purchase (KIK-444).
--yes-y--yessell -- 売却記録
sell -- Add Sale Record
bash
python3 .../run_portfolio.py sell --symbol <sym> --shares <n> [--price <売却単価>] [--date YYYY-MM-DD] [--yes]--yes-y--yes--pricedata/history/trade/*.jsonbash
python3 .../run_portfolio.py sell --symbol <sym> --shares <n> [--price <sale-price>] [--date YYYY-MM-DD] [--yes]Omitting () will display a confirmation preview of the sale details (acquisition price, estimated realized profit/loss) and exit. Specifying skips confirmation and directly records the sale (KIK-444).
--yes-y--yesWhen is specified, it calculates and displays realized profit/loss, profit/loss ratio, and after-tax estimate, then saves to (KIK-441).
--pricedata/history/trade/*.jsonreview -- 売買パフォーマンスレビュー (KIK-441)
review -- Trade Performance Review (KIK-441)
過去の売却記録( 付きで記録したもの)から損益統計を集計して表示する。
--pricebash
python3 .../run_portfolio.py review [--year 2026] [--symbol NVDA]出力内容:
- 取引履歴テーブル(銘柄・売却日・株数・取得単価・売却単価・保有日数・実現損益・損益率)
- 統計(取引件数・勝率・平均リターン・平均保有期間・合計実現損益)
Aggregate and display profit/loss statistics from past sale records (those recorded with ).
--pricebash
python3 .../run_portfolio.py review [--year 2026] [--symbol NVDA]Output Content:
- Transaction History Table (Symbol, Sale Date, Shares Held, Acquisition Price, Sale Price, Holding Period, Realized Profit/Loss, Profit/Loss Ratio)
- Statistics (Number of Transactions, Win Rate, Average Return, Average Holding Period, Total Realized Profit/Loss)
analyze -- 構造分析
analyze -- Structural Analysis
地域/セクター/通貨/規模のHHI(ハーフィンダール指数)を算出し、ポートフォリオの偏りを分析する。規模別構成(大型/中型/小型/ETF/不明)テーブルを含む4軸分析(KIK-438, KIK-469 P2: ETF分類)。ETFはセクター「ETF」、規模「ETF」として独立分類される。
bash
python3 .../run_portfolio.py analyzeCalculate HHI (Herfindahl-Hirschman Index) for region/sector/currency/size to analyze portfolio bias. 4-axis analysis including size-based composition table (Large/Mid/Small/ETF/Unknown) (KIK-438, KIK-469 P2: ETF Classification). ETFs are independently categorized as sector "ETF" and size "ETF".
bash
python3 .../run_portfolio.py analyzehealth -- ヘルスチェック
health -- Health Check
保有銘柄の投資仮説がまだ有効かをチェックする。テクニカル(SMA50/200, RSI, ゴールデンクロス/デッドクロス検出)とファンダメンタル(変化スコア、株主還元安定度)の多軸で3段階アラートを出力。小型株は自動的に感度を引き上げ(KIK-438)。
bash
python3 .../run_portfolio.py healthテクニカル分析(KIK-356/374/438):
- SMA50/200 のトレンド判定(上昇/横ばい/下降)
- ゴールデンクロス/デッドクロス検出: 60日 lookback でクロスイベントを検出し、発生日と経過日数を表示
- 小型株クロスルックバック短縮(KIK-438): 小型株は lookback=30日で直近の変動を早期検出
株主還元安定度(KIK-403):
- 配当+自社株買いの総還元率から安定度を評価(✅安定高還元/📈増加傾向/⚠️一時的高還元/📉減少傾向)
- 一時的高還元(temporary)→ 早期警告に昇格
- 減少傾向(decreasing)→ アラート詳細に理由追加
- 長期適性判定に総還元率(配当+自社株買い)を使用
小型株アロケーション(KIK-438):
- 銘柄ごとに時価総額から規模分類(大型/中型/小型/不明)し バッジを表示
[小型] - 小型株は EARLY_WARNING → CAUTION に自動エスカレーション
- PF全体の小型株比率を算出し、>25% で警告、>35% で危険を表示
ETFヘルスチェック(KIK-469 Phase 2):
- 個別株とETFのテーブルを分離表示
- ETFテーブル: 銘柄/損益/トレンド/経費率/AUM/ETFスコア/アラート
- 個別株テーブル: 従来通り(変化の質/長期適性/還元安定度)
アラートレベル:
- 早期警告: SMA50割れ / RSI急低下 / 変化スコア1指標悪化 / 一時的高還元
- 注意: SMA50がSMA200に接近 + 指標悪化 / 変化スコア複数悪化 / 小型株のEARLY_WARNING昇格
- 撤退: デッドクロス検出 / トレンド崩壊 + 変化スコア悪化
Check if the investment hypothesis for held securities is still valid. Output 3-level alerts based on multiple axes of technical analysis (SMA50/200, RSI, Golden Cross/Dead Cross detection) and fundamental analysis (Change Score, Shareholder Return Stability). Sensitivity is automatically increased for small-cap stocks (KIK-438).
bash
python3 .../run_portfolio.py healthTechnical Analysis (KIK-356/374/438):
- Trend determination for SMA50/200 (Uptrend/Sideways/Downtrend)
- Golden Cross/Dead Cross Detection: Detect cross events with a 60-day lookback, display occurrence date and elapsed days
- Small-Cap Cross Lookback Shortening (KIK-438): For small-cap stocks, use lookback=30 days to detect recent fluctuations early
Shareholder Return Stability (KIK-403):
- Evaluate stability based on total return ratio of dividends + share buybacks (✅Stable High Return/📈Increasing Trend/⚠️Temporary High Return/📉Decreasing Trend)
- Temporary High Return → Promoted to early warning
- Decreasing Trend → Add reason to alert details
- Use total return ratio (dividends + share buybacks) for long-term suitability assessment
Small-Cap Allocation (KIK-438):
- Classify each security by market capitalization (Large/Mid/Small/Unknown) and display badge
[Small-Cap] - Small-cap stocks automatically escalate from EARLY_WARNING to CAUTION
- Calculate the small-cap ratio of the entire portfolio, display warning if >25%, danger if >35%
ETF Health Check (KIK-469 Phase 2):
- Display separate tables for individual stocks and ETFs
- ETF Table: Symbol, Profit/Loss, Trend, Expense Ratio, AUM, ETF Score, Alert
- Individual Stock Table: As before (Quality of Change, Long-Term Suitability, Return Stability)
Alert Levels:
- Early Warning: Break below SMA50 / Sharp RSI decline / Deterioration of 1 change score indicator / Temporary High Return
- Caution: SMA50 approaching SMA200 + indicator deterioration / Deterioration of multiple change score indicators / Escalation of small-cap EARLY_WARNING
- Exit: Dead Cross detected / Trend collapse + change score deterioration
adjust -- ポートフォリオ調整アドバイザー (KIK-496)
adjust -- Portfolio Adjustment Advisor (KIK-496)
ヘルスチェック結果 + マーケットレジーム判定から、17ルール(P1-P10: ポジション別、F1-F7: PF全体)で具体的な調整アクション(SELL/SWAP/ADD/TRIM_CLASS/FLAG)を生成する。
bash
python3 .../run_portfolio.py adjust [--full]CLIオプション:
- : フル分析モード(集中度・相関分析も含む。API負荷が高い)
--full
出力:
- マーケットレジーム(bull/bear/crash/neutral)— SMA50/200、RSI、ドローダウンから判定
- HIGH/MEDIUM/LOW 優先度別のアクションテーブル(アクション種別/対象/理由/ルールID)
- サマリー(アクション件数)
レジーム補正: crash 時は urgency を1段階引き上げ。bear 時は小型株・下降トレンド系ルールを引き上げ。
Generate specific adjustment actions (SELL/SWAP/ADD/TRIM_CLASS/FLAG) using 17 rules (P1-P10: Position-specific, F1-F7: Portfolio-wide) based on health check results + market regime determination.
bash
python3 .../run_portfolio.py adjust [--full]CLI Options:
- : Full analysis mode (includes concentration and correlation analysis. High API load)
--full
Output:
- Market Regime (bull/bear/crash/neutral) — Determined from SMA50/200, RSI, drawdown
- Action Table by HIGH/MEDIUM/LOW Priority (Action Type/Target/Reason/Rule ID)
- Summary (Number of Actions)
Regime Correction: In crash regime, increase urgency by 1 level. In bear regime, prioritize rules for small-cap stocks and downtrend sectors.
rebalance -- リバランス提案
rebalance -- Rebalancing Proposal
現在のポートフォリオ構造を分析し、集中リスクの低減と目標配分への調整案を提示する。
bash
python3 .../run_portfolio.py rebalance [options]CLIオプション:
- (デフォルト: balanced)
--strategy defensive|balanced|aggressive - (例: Technology)
--reduce-sector SECTOR - (例: USD)
--reduce-currency CURRENCY - (例: 0.15)
--max-single-ratio RATIO - (例: 0.25)
--max-sector-hhi HHI - (例: 0.30)
--max-region-hhi HHI - (円, 例: 1000000)
--additional-cash AMOUNT - (例: 0.03)
--min-dividend-yield YIELD
Analyze current portfolio structure and present proposals to reduce concentration risk and adjust to target allocation.
bash
python3 .../run_portfolio.py rebalance [options]CLI Options:
- (Default: balanced)
--strategy defensive|balanced|aggressive - (Example: Technology)
--reduce-sector SECTOR - (Example: USD)
--reduce-currency CURRENCY - (Example: 0.15)
--max-single-ratio RATIO - (Example: 0.25)
--max-sector-hhi HHI - (Example: 0.30)
--max-region-hhi HHI - (JPY, Example: 1000000)
--additional-cash AMOUNT - (Example: 0.03)
--min-dividend-yield YIELD
forecast -- 推定利回り
forecast -- Estimated Return
保有銘柄ごとにアナリスト目標価格 or 過去リターン分布から12ヶ月の期待リターンを3シナリオ(楽観/ベース/悲観)で推定する。バリュートラップ警告・TOP/BOTTOM ランキング付き。
bash
python3 .../run_portfolio.py forecast推定手法:
- アナリスト法: アナリスト目標株価 + 配当利回り + 自社株買い利回り(株主還元込み)
- 過去リターン法: ETF等アナリストカバレッジなし銘柄は過去CAGR + 標準偏差で推定(KIK-469 P2: ETFは年率ボラティリティ表示 + バッジ付き)
[ETF] - 業界カタリスト調整(KIK-433, Neo4j 接続時): 同セクターの直近 カタリスト数 × 1.7% を楽観シナリオに加算、
growth_driverカタリスト数 × 1.7% を悲観シナリオから減算(上限各 10%)risk
出力構成(KIK-390):
- ポートフォリオ全体の3シナリオ利回り・損益額テーブル
- 注意銘柄セクション(バリュートラップ警告のある銘柄を集約)
- 期待リターン TOP 3 / BOTTOM 3 ランキング
- 銘柄別詳細(アナリスト目標/Forward PER/ニュース件数/Xセンチメント/3シナリオ)
Estimate 12-month expected returns for each held security in 3 scenarios (Optimistic/Base/Pessimistic) based on analyst target prices or historical return distribution. Includes value trap warnings and TOP/BOTTOM rankings.
bash
python3 .../run_portfolio.py forecastEstimation Methods:
- Analyst Method: Analyst target price + dividend yield + share buyback yield (including shareholder returns)
- Historical Return Method: For securities without analyst coverage such as ETFs, estimate using historical CAGR + standard deviation (KIK-469 P2: ETFs display annual volatility + badge)
[ETF] - Industry Catalyst Adjustment (KIK-433, when connected to Neo4j): Add number of recent catalysts in the same sector × 1.7% to optimistic scenario, subtract number of
growth_drivercatalysts × 1.7% from pessimistic scenario (capped at 10% each)risk
Output Structure (KIK-390):
- Portfolio-wide 3-scenario return and profit/loss table
- Watchlist Section (Aggregate securities with value trap warnings)
- Expected Return TOP 3 / BOTTOM 3 Rankings
- Security-specific details (Analyst Target/Forward PER/Number of News/X Sentiment/3 Scenarios)
what-if -- What-Ifシミュレーション (KIK-376 / KIK-451)
what-if -- What-If Simulation (KIK-376 / KIK-451)
銘柄の追加・売却・スワップをシミュレーションし、ポートフォリオへの影響をBefore/After比較で表示する。
bash
undefinedSimulate adding/selling/swapping securities and display the impact on the portfolio with Before/After comparison.
bash
undefined追加のみ(従来)
Add only (Traditional)
python3 .../run_portfolio.py what-if --add "SYMBOL:SHARES:PRICE[,...]"
python3 .../run_portfolio.py what-if --add "SYMBOL:SHARES:PRICE[,...]"
スワップ(売却して購入)(KIK-451)
Swap (Sell then Buy) (KIK-451)
python3 .../run_portfolio.py what-if --remove "SYMBOL:SHARES[,...]" --add "SYMBOL:SHARES:PRICE[,...]"
python3 .../run_portfolio.py what-if --remove "SYMBOL:SHARES[,...]" --add "SYMBOL:SHARES:PRICE[,...]"
売却のみシミュレーション (KIK-451)
Sell only simulation (KIK-451)
python3 .../run_portfolio.py what-if --remove "SYMBOL:SHARES[,...]"
CLIオプション:
- `--add` : 追加銘柄リスト(任意)。形式: `SYMBOL:SHARES:PRICE` をカンマ区切り
- `--remove` : 売却銘柄リスト(任意)。形式: `SYMBOL:SHARES` をカンマ区切り(価格不要・時価で試算)
- `--add` と `--remove` のどちらか一方は必須
**出力:**
- **[売却時] 売却候補のコンテキスト(KIK-470)**: `--remove` 指定時、シミュレーション前にスクリーニング出現回数・投資メモ・リサーチ履歴を自動表示(Neo4j接続時)
- Before/After のセクターHHI・地域HHI・通貨HHI比較
- 追加銘柄の基本情報(PER/PBR/配当利回り/ROE)
- **[スワップ時] 売却銘柄テーブル**(銘柄・株数・売却代金試算)
- **[スワップ時] 資金収支**(購入必要資金 / 売却代金試算 / 差額)
- **[スワップ時] 売却銘柄ヘルスチェック**(売却対象のアラート状況)
- 判定ラベル: 推奨 / 注意して検討 / 非推奨(スワップ時は「このスワップは推奨」等)
- **ETF品質評価(KIK-469 P2)**: ETF追加時にETFスコアを判定に反映(品質良好≥75、品質低<40で警告)python3 .../run_portfolio.py what-if --remove "SYMBOL:SHARES[,...]"
CLI Options:
- `--add` : List of securities to add (optional). Format: Comma-separated `SYMBOL:SHARES:PRICE`
- `--remove` : List of securities to sell (optional). Format: Comma-separated `SYMBOL:SHARES` (price not required, calculated at market price)
- Either `--add` or `--remove` is required
**Output:**
- **[When Selling] Context of Sale Candidates (KIK-470)**: When `--remove` is specified, automatically display screening appearance count, investment notes, and research history before simulation (when connected to Neo4j)
- Before/After comparison of sector HHI, region HHI, currency HHI
- Basic information of added securities (PER/PBR/Dividend Yield/ROE)
- **[When Swapping] Sale Security Table** (Symbol, Shares, Estimated Sale Proceeds)
- **[When Swapping] Cash Flow** (Required Purchase Funds / Estimated Sale Proceeds / Difference)
- **[When Swapping] Sale Security Health Check** (Alert status of sale targets)
- Judgment label: Recommended / Consider with Caution / Not Recommended (e.g., "This swap is recommended" for swaps)
- **ETF Quality Evaluation (KIK-469 P2)**: When adding ETFs, reflect ETF score in judgment (Warning if quality is low <40, Good if ≥75)backtest -- バックテスト
backtest -- Backtesting
蓄積されたスクリーニング結果からリターンを検証し、ベンチマーク(日経225/S&P500)と比較する。
bash
python3 .../run_portfolio.py backtest [options]CLIオプション:
- : 検証対象のスクリーニングプリセット(例: alpha, value)
--preset PRESET - : 検証対象の地域(例: jp, us)
--region REGION - : 取得後N日間のリターンを検証(デフォルト: 90)
--days N
出力:
- スクリーニング日別の平均リターン
- ベンチマーク比較(超過リターン)
- 勝率・平均リターン・最大リターン/最大損失
Verify returns from accumulated screening results and compare with benchmarks (Nikkei 225/S&P500).
bash
python3 .../run_portfolio.py backtest [options]CLI Options:
- : Screening preset to verify (Example: alpha, value)
--preset PRESET - : Region to verify (Example: jp, us)
--region REGION - : Verify returns for N days after acquisition (Default: 90)
--days N
Output:
- Daily returns by screening date
- Benchmark comparison (Excess Return)
- Win Rate, Average Return, Maximum Return/Maximum Loss
simulate -- 複利シミュレーション
simulate -- Compound Interest Simulation
現在のポートフォリオを基に、複利計算で将来の資産推移をシミュレーションする。forecast の期待リターン + 配当再投資 + 毎月積立を複利で計算し、楽観/ベース/悲観の3シナリオで表示。
bash
python3 .../run_portfolio.py simulate [options]CLIオプション:
- (シミュレーション年数, デフォルト: 10)
--years N - (月額積立額, 円, デフォルト: 0)
--monthly-add AMOUNT - (目標額, 円, 例: 15000000)
--target AMOUNT - (配当再投資する, デフォルト: ON)
--reinvest-dividends - (配当再投資しない)
--no-reinvest-dividends
Simulate future asset growth using compound interest based on the current portfolio. Calculate compound interest using forecast expected returns + dividend reinvestment + monthly contributions, display in 3 scenarios (Optimistic/Base/Pessimistic).
bash
python3 .../run_portfolio.py simulate [options]CLI Options:
- (Simulation period in years, Default: 10)
--years N - (Monthly contribution amount, JPY, Default: 0)
--monthly-add AMOUNT - (Target amount, JPY, Example: 15000000)
--target AMOUNT - (Reinvest dividends, Default: ON)
--reinvest-dividends - (Do not reinvest dividends)
--no-reinvest-dividends
list -- 保有銘柄一覧
list -- List of Held Securities
portfolio.csv の内容をそのまま表示する。
bash
python3 .../run_portfolio.py listDisplay the contents of portfolio.csv as-is.
bash
python3 .../run_portfolio.py list自然言語ルーティング
Natural Language Routing
自然言語→スキル判定は .claude/rules/intent-routing.md を参照。
Refer to .claude/rules/intent-routing.md for natural language → skill determination.
制約事項
Constraints
- 日本株: 100株単位(単元株)
- ASEAN株: 100株単位(最低手数料 3,300円)
- 楽天証券対応(手数料体系)
- portfolio.csv のパス:
.claude/skills/stock-portfolio/data/portfolio.csv
- Japanese Stocks: 100-share units (board lot)
- ASEAN Stocks: 100-share units (minimum commission 3,300 JPY)
- Rakuten Securities compatible (commission structure)
- portfolio.csv path:
.claude/skills/stock-portfolio/data/portfolio.csv
出力
Output
結果はMarkdown形式で表示してください。
Display results in Markdown format.
snapshot の出力項目
snapshot Output Items
- 銘柄 / 名称 / 保有数 / 取得単価 / 現在価格 / 評価額 / 損益 / 損益率 / 通貨
- Symbol / Name / Quantity Held / Acquisition Price / Current Price / Valuation Amount / Profit/Loss / Profit/Loss Ratio / Currency
analyze の出力項目
analyze Output Items
- セクターHHI / 地域HHI / 通貨HHI / 規模HHI(KIK-438)
- 各軸の構成比率(規模別構成テーブル: 大型/中型/小型/ETF/不明)
- ETF注釈(ルックスルー未対応の注記)
- リスクレベル判定
- Sector HHI / Region HHI / Currency HHI / Size HHI (KIK-438)
- Composition ratio for each axis (Size-based composition table: Large/Mid/Small/ETF/Unknown)
- ETF Notes (Note on unimplemented look-through)
- Risk level determination
health の出力項目
health Output Items
- 個別株テーブル: 銘柄(小型株は バッジ付き) / 損益率 / トレンド / クロスイベント / 変化の質 / アラート / 長期適性 / 還元安定度
[小型] - ETFテーブル(KIK-469 P2): 銘柄 / 損益 / トレンド / 経費率 / AUM / ETFスコア / アラート
- アラートがある銘柄の詳細(理由、SMA/RSI値、クロス発生日・経過日数、変化スコア、株主還元安定度、推奨アクション)
- 小型株アロケーション: PF全体の小型株比率サマリー(✅正常/⚠️警告/🔴危険)
- Individual Stock Table: Symbol (Small-cap stocks have badge) / Profit/Loss Ratio / Trend / Cross Event / Quality of Change / Alert / Long-Term Suitability / Shareholder Return Stability
[Small-Cap] - ETF Table (KIK-469 P2): Symbol / Profit/Loss / Trend / Expense Ratio / AUM / ETF Score / Alert
- Details of securities with alerts (Reason, SMA/RSI values, Cross occurrence date/elapsed days, Change Score, Shareholder Return Stability, Recommended Action)
- Small-Cap Allocation: Summary of small-cap ratio for entire portfolio (✅Normal/⚠️Warning/🔴Danger)
forecast の出力項目
forecast Output Items
- ポートフォリオ全体: 3シナリオ利回り(楽観/ベース/悲観)+ 損益額 + 総評価額
- 注意銘柄セクション: バリュートラップ警告のある銘柄一覧
- TOP 3 / BOTTOM 3: 期待リターンランキング(アナリスト数付き)
- 銘柄別: アナリスト目標価格 / Forward PER / ニュース件数 / Xセンチメント / 3シナリオ / ETFは年率ボラティリティ + バッジ
[ETF]
- Portfolio-wide: 3-scenario returns (Optimistic/Base/Pessimistic) + Profit/Loss Amount + Total Valuation
- Watchlist Section: List of securities with value trap warnings
- TOP 3 / BOTTOM 3: Expected Return Rankings (with number of analysts)
- Security-specific: Analyst Target Price / Forward PER / Number of News / X Sentiment / 3 Scenarios / ETFs display annual volatility + badge
[ETF]
what-if の出力項目
what-if Output Items
- [売却時] 売却候補のコンテキスト(KIK-470): スクリーニング出現回数・投資メモ・リサーチ履歴
- Before/After のHHI比較(セクター/地域/通貨)
- 追加銘柄のファンダメンタルズ
- 集中度変化の判定
- [スワップ時] 売却銘柄テーブル(売却代金試算)
- [スワップ時] 資金収支(購入必要資金 / 売却代金 / 差額)
- [スワップ時] 売却銘柄ヘルスチェック
- [スワップ時] 「このスワップは推奨 / 注意して検討 / 非推奨」
- [When Selling] Context of Sale Candidates (KIK-470): Screening appearance count, investment notes, research history
- Before/After HHI comparison (Sector/Region/Currency)
- Fundamentals of added securities
- Concentration change determination
- [When Swapping] Sale Security Table (Estimated Sale Proceeds)
- [When Swapping] Cash Flow (Required Purchase Funds / Sale Proceeds / Difference)
- [When Swapping] Sale Security Health Check
- [When Swapping] "This swap is recommended / Consider with Caution / Not Recommended"
backtest の出力項目
backtest Output Items
- スクリーニング日別リターン
- ベンチマーク比較(超過リターン)
- 勝率・統計値
- Daily returns by screening date
- Benchmark comparison (Excess Return)
- Win Rate, Statistical Values
adjust の出力項目
adjust Output Items
- マーケットレジーム(レジーム名/SMA50 vs SMA200/RSI/ドローダウン)
- HIGH Priority テーブル: SELL/SWAP/TRIM_CLASS アクション
- MEDIUM Priority テーブル: FLAG/SELL アクション
- LOW Priority テーブル: FLAG アクション
- サマリー(HIGH/MEDIUM/LOW 件数、レジーム)
- Market Regime (Regime Name/SMA50 vs SMA200/RSI/Drawdown)
- HIGH Priority Table: SELL/SWAP/TRIM_CLASS Actions
- MEDIUM Priority Table: FLAG/SELL Actions
- LOW Priority Table: FLAG Actions
- Summary (Number of HIGH/MEDIUM/LOW Actions, Regime)
rebalance の出力項目
rebalance Output Items
- 現状のHHI(セクター/地域/通貨)と目標HHI
- 売却候補(銘柄・株数・理由)
- 購入候補(銘柄・株数・理由・配当利回り)
- リバランス後のHHI予測値
- Current HHI (Sector/Region/Currency) and Target HHI
- Sale Candidates (Symbol, Shares, Reason)
- Purchase Candidates (Symbol, Shares, Reason, Dividend Yield)
- Predicted HHI after rebalancing
simulate の出力項目
simulate Output Items
- 年次推移テーブル(年/評価額/累計投入/運用益/配当累計)
- 3シナリオ比較(楽観/ベース/悲観の最終年)
- 目標達成分析(到達年/必要積立額)
- 配当再投資の複利効果
- Annual transition table (Year/Valuation Amount/Total Contributions/Investment Gains/Total Dividends)
- 3-scenario comparison (Final year of Optimistic/Base/Pessimistic)
- Target Achievement Analysis (Year of Achievement / Required Monthly Contribution)
- Compound interest effect of dividend reinvestment
実行例
Execution Examples
bash
undefinedbash
undefinedスナップショット
Snapshot
python3 .../run_portfolio.py snapshot
python3 .../run_portfolio.py snapshot
購入記録
Purchase Record
python3 .../run_portfolio.py buy --symbol 7203.T --shares 100 --price 2850 --currency JPY --date 2025-06-15 --memo トヨタ
python3 .../run_portfolio.py buy --symbol 7203.T --shares 100 --price 2850 --currency JPY --date 2025-06-15 --memo Toyota
売却記録
Sale Record
python3 .../run_portfolio.py sell --symbol AAPL --shares 5
python3 .../run_portfolio.py sell --symbol AAPL --shares 5
構造分析
Structural Analysis
python3 .../run_portfolio.py analyze
python3 .../run_portfolio.py analyze
一覧表示
List Display
python3 .../run_portfolio.py list
python3 .../run_portfolio.py list
ヘルスチェック
Health Check
python3 .../run_portfolio.py health
python3 .../run_portfolio.py health
推定利回り
Estimated Return
python3 .../run_portfolio.py forecast
python3 .../run_portfolio.py forecast
リバランス提案
Rebalancing Proposal
python3 .../run_portfolio.py rebalance
python3 .../run_portfolio.py rebalance --strategy defensive
python3 .../run_portfolio.py rebalance --reduce-sector Technology --additional-cash 1000000
python3 .../run_portfolio.py rebalance
python3 .../run_portfolio.py rebalance --strategy defensive
python3 .../run_portfolio.py rebalance --reduce-sector Technology --additional-cash 1000000
What-Ifシミュレーション(追加のみ)
What-If Simulation (Add only)
python3 .../run_portfolio.py what-if --add "7203.T:100:2850,AAPL:10:250"
python3 .../run_portfolio.py what-if --add "7203.T:100:2850,AAPL:10:250"
What-Ifシミュレーション(スワップ: 7203.T売却 → 9984.T購入)(KIK-451)
What-If Simulation (Swap: Sell 7203.T → Buy 9984.T) (KIK-451)
python3 .../run_portfolio.py what-if --remove "7203.T:100" --add "9984.T:50:7500"
python3 .../run_portfolio.py what-if --remove "7203.T:100" --add "9984.T:50:7500"
What-Ifシミュレーション(純売却)(KIK-451)
What-If Simulation (Sell only) (KIK-451)
python3 .../run_portfolio.py what-if --remove "7203.T:50"
python3 .../run_portfolio.py what-if --remove "7203.T:50"
調整アドバイザー (KIK-496)
Adjustment Advisor (KIK-496)
python3 .../run_portfolio.py adjust
python3 .../run_portfolio.py adjust --full
python3 .../run_portfolio.py adjust
python3 .../run_portfolio.py adjust --full
バックテスト
Backtesting
python3 .../run_portfolio.py backtest --preset alpha --region jp --days 90
undefinedpython3 .../run_portfolio.py backtest --preset alpha --region jp --days 90
undefined前提知識統合ルール (KIK-466)
Prior Knowledge Integration Rules (KIK-466)
health コマンド
health Command
get_context.py の出力に以下がある場合、ヘルスチェック結果と統合して回答する:
- 売買履歴(BOUGHT/SOLD): 購入価格・日付を参照し、含み損益の文脈を付加。売却済み銘柄が警告に出た場合は「売却済みのため問題なし」と明記
- 投資メモ(Note): テーゼ・懸念メモがあれば、ヘルスチェック結果と照合。「バリュートラップ懸念メモあり → 今回もBTスコア高 → 本当に要注意」等
- 前回ヘルスチェック(HealthCheck): 前回との差分を示す。「前回HOLD → 今回EXIT: 状況悪化」「前回EXIT → 今回HOLD: 改善」
- スクリーニング履歴(SURFACED): 警告銘柄が過去にスクリーニング上位だった場合、「注目度は高い(3回上位)が現在は要注意」等
- テーゼ経過: テーゼメモが90日以上前なら「テーゼ見直し時期」と促す
If the output of get_context.py includes the following, integrate with health check results in the response:
- Trade History (BOUGHT/SOLD): Reference purchase price and date to add context of unrealized profit/loss. If a sold security appears in warnings, clearly state "No problem as it has been sold"
- Investment Notes (Note): If there are thesis/concern notes, cross-reference with health check results. e.g., "Value trap concern note exists → BT score is also high this time → Requires close attention"
- Previous Health Check (HealthCheck): Show differences from previous check. e.g., "Previous HOLD → Current EXIT: Situation deteriorated" "Previous EXIT → Current HOLD: Improved"
- Screening History (SURFACED): If a warning security was in the top rankings in past screenings, e.g., "High attention (3 times in top rankings) but requires caution now"
- Thesis Progress: If thesis note is over 90 days old, prompt "Time to review thesis"
snapshot / forecast
snapshot / forecast
- 前回スナップショット・フォーキャストがあれば差分コメントを付加
- 「前回比: 評価額+5.2%、利回り改善」等
- If there is a previous snapshot/forecast, add difference comments
- e.g., "Compared to previous: Valuation amount +5.2%, return improved"
分析結論の記録促し
Prompt to Record Analysis Conclusions
EXIT/警告に対して具体的な判断(「売却推奨」「継続保有」等)を含む回答をした場合:
💡 この判断を投資メモとして記録しますか?
When providing a response that includes a specific judgment for EXIT/warnings (e.g., "Recommended to sell" "Continue holding"):
💡 Would you like to record this judgment as an investment note?