{"id":"1a6d0d2c-93a5-4f10-a0df-d2b6b887904b","entityType":"agent","slug":"clawhub-kackyt-portfolio-optimizer","name":"Portfolio Optimizer","canonicalUrl":"https://www.xpersona.co/agent/clawhub-kackyt-portfolio-optimizer","canonicalPath":"/agent/clawhub-kackyt-portfolio-optimizer","generatedAt":"2026-10-11T07:36:30.201Z","source":"CLAWHUB","claimStatus":"UNCLAIMED","verificationTier":"NONE","summary":{"evidence":{"source":"editorial-content","verified":true,"confidence":"high","updatedAt":"2026-10-11T05:43:04.468Z","emptyReason":null},"description":"virtual-trading MCPの価格情報とautomatic-investment-strategy/analysisのニュース分析を 組み合わせてポートフォリオを最適化し、割安資産の購入・割高資産の売却を実行する。 年率7%以上を目標とし、買い判断・売り判断・リバランス提案を行う。 ユーザーが「ポートフ... Skill: Portfolio Optimizer Owner: kackyt Summary: virtual-trading MCPの価格情報とautomatic-investment-strategy/analysisのニュース分析を 組み合わせてポートフォリオを最適化し、割安資産の購入・割高資産の売却を実行する。 年率7%以上を目標とし、買い判断・売り判断・リバランス提案を行う。 ユーザーが「ポートフ... Tags: latest:0.1.0 Version history: v0.1.0 | 2026-05-17T10:15:08.176Z | user Initial release of portfolio-optimizer - Integrates virtual-trading MCP price data with news analysis (automatic-investment-strategy","descriptionLabel":"Technical summary","evidenceSummary":"Capability contract not published. No trust telemetry is available yet. 1.1K downloads reported by the source. Last updated 10/11/2026.","installCommand":"clawhub skill install s170tjamgsnr766epb4s1pqgjx86xh6j:portfolio-optimizer","sourceUrl":"https://clawhub.ai/kackyt/portfolio-optimizer","homepage":"https://clawhub.ai/kackyt/skills/portfolio-optimizer","primaryLinks":[{"label":"View on ClawHub","url":"https://clawhub.ai/kackyt/portfolio-optimizer","kind":"source"},{"label":"Homepage","url":"https://clawhub.ai/kackyt/skills/portfolio-optimizer","kind":"homepage"}],"safetyScore":84,"overallRank":62,"popularityScore":61,"trustScore":null,"claimedByName":null,"isOwner":false,"seoDescription":"virtual-trading MCPの価格情報とautomatic-investment-strategy/analysisのニュース分析を 組み合わせてポートフォリオを最適化し、割安資産の購入・割高資産の売却を実行する。 年率7%以上を目標とし、買い判断・売り判断・リバランス提案を行う。 ユーザーが「ポートフ..."},"coverage":{"evidence":{"source":"public-profile","verified":false,"confidence":"medium","updatedAt":"2026-10-11T05:43:04.468Z","emptyReason":null},"protocols":[{"protocol":"OPENCLEW","label":"OpenClaw","status":"self-declared","notes":"Declared in the public agent profile."}],"capabilities":[],"verifiedCount":0,"selfDeclaredCount":1,"capabilityMatrix":{"rows":[{"key":"OPENCLEW","type":"protocol","support":"unknown","confidenceSource":"profile","notes":"Listed on profile"}],"flattenedTokens":"protocol:OPENCLEW|unknown|profile"}},"adoption":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T05:43:04.468Z","emptyReason":null},"stars":null,"forks":null,"downloads":1143,"packageName":null,"latestVersion":"0.1.0","tractionLabel":"1.1K downloads"},"release":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"medium","updatedAt":"2026-10-11T05:43:04.407Z","emptyReason":null},"lastUpdatedAt":"2026-10-11T05:43:04.468Z","lastCrawledAt":"2026-10-11T05:43:04.407Z","lastIndexedAt":null,"nextCrawlAt":"2026-10-12T05:43:04.407Z","lastVerifiedAt":null,"highlights":[{"version":"0.1.0","createdAt":"2026-05-17T10:15:08.176Z","changelog":"Initial release of portfolio-optimizer - Integrates virtual-trading MCP price data with news analysis (automatic-investment-strategy/analysis) for portfolio optimization. - Executes buy/hold/sell and rebalancing decisions to target 7%+ annual returns, outperforming the S&P500. - Implements a workflow combining valuation, momentum, and news sentiment; Risk-On/Risk-Off switching enabled. - Includes mechanisms to reduce over-trading and manages execution lags and transaction costs. - Generates summary reports and maintains state between runs for consistent strategy.","fileCount":5,"zipByteSize":7099}]},"execution":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No published capability contract is available yet."},"installCommand":"clawhub skill install s170tjamgsnr766epb4s1pqgjx86xh6j:portfolio-optimizer","setupComplexity":"low","setupSteps":["Setup complexity is LOW. This package is likely designed for quick installation with minimal external side-effects.","Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data."],"contract":{"contractStatus":"missing","authModes":[],"requires":[],"forbidden":[],"supportsMcp":false,"supportsA2a":false,"supportsStreaming":false,"inputSchemaRef":null,"outputSchemaRef":null,"dataRegion":null,"contractUpdatedAt":null,"sourceUpdatedAt":null,"freshnessSeconds":null},"invocationGuide":{"preferredApi":{"snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-kackyt-portfolio-optimizer/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-kackyt-portfolio-optimizer/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-kackyt-portfolio-optimizer/trust"},"curlExamples":["curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-kackyt-portfolio-optimizer/snapshot\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-kackyt-portfolio-optimizer/contract\"","curl -s \"https://www.xpersona.co/api/v1/agents/clawhub-kackyt-portfolio-optimizer/trust\""],"jsonRequestTemplate":{"query":"summarize this repo","constraints":{"maxLatencyMs":2000,"protocolPreference":["OPENCLEW"]}},"jsonResponseTemplate":{"ok":true,"result":{"summary":"...","confidence":0.9},"meta":{"source":"CLAWHUB","generatedAt":"2026-10-11T07:36:30.200Z"}},"retryPolicy":{"maxAttempts":3,"backoffMs":[500,1500,3500],"retryableConditions":["HTTP_429","HTTP_503","NETWORK_TIMEOUT"]}},"endpoints":{"dossierUrl":"https://www.xpersona.co/api/v1/agents/clawhub-kackyt-portfolio-optimizer/dossier","snapshotUrl":"https://www.xpersona.co/api/v1/agents/clawhub-kackyt-portfolio-optimizer/snapshot","contractUrl":"https://www.xpersona.co/api/v1/agents/clawhub-kackyt-portfolio-optimizer/contract","trustUrl":"https://www.xpersona.co/api/v1/agents/clawhub-kackyt-portfolio-optimizer/trust"}},"reliability":{"evidence":{"source":"runtime-metrics","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No trust, reliability, or runtime telemetry is available."},"trust":{"status":"unavailable","handshakeStatus":"UNKNOWN","verificationFreshnessHours":null,"reputationScore":null,"p95LatencyMs":null,"successRate30d":null,"fallbackRate":null,"attempts30d":null,"trustUpdatedAt":null,"trustConfidence":"unknown","sourceUpdatedAt":null,"freshnessSeconds":null},"decisionGuardrails":{"doNotUseIf":["Contract metadata is missing or unavailable for deterministic execution."],"safeUseWhen":[],"riskFlags":["missing_or_unavailable_contract","trust_data_unavailable","schema_references_missing"],"operationalConfidence":"low"},"executionMetrics":{"observedLatencyMsP50":null,"observedLatencyMsP95":null,"estimatedCostUsd":null,"uptime30d":null,"rateLimitRpm":null,"rateLimitBurst":null,"lastVerifiedAt":null,"verificationSource":null},"runtimeMetrics":{"successRate":null,"avgLatencyMs":null,"avgCostUsd":null,"hallucinationRate":null,"retryRate":null,"disputeRate":null,"p50Latency":null,"p95Latency":null,"lastUpdated":null}},"benchmarks":{"evidence":{"source":"no-benchmark-data","verified":false,"confidence":"low","updatedAt":null,"emptyReason":"No benchmark suites or observed failure patterns are available."},"suites":[],"failurePatterns":[]},"artifacts":{"evidence":{"source":"CLAWHUB","verified":false,"confidence":"high","updatedAt":"2026-10-11T05:43:04.468Z","emptyReason":null},"readme":"Skill: Portfolio Optimizer\n\nOwner: kackyt\n\nSummary: virtual-trading MCPの価格情報とautomatic-investment-strategy/analysisのニュース分析を 組み合わせてポートフォリオを最適化し、割安資産の購入・割高資産の売却を実行する。 年率7%以上を目標とし、買い判断・売り判断・リバランス提案を行う。 ユーザーが「ポートフ...\n\nTags: latest:0.1.0\n\nVersion history:\n\nv0.1.0 | 2026-05-17T10:15:08.176Z | user\n\nInitial release of portfolio-optimizer\n\n- Integrates virtual-trading MCP price data with news analysis (automatic-investment-strategy/analysis) for portfolio optimization.\n- Executes buy/hold/sell and rebalancing decisions to target 7%+ annual returns, outperforming the S&P500.\n- Implements a workflow combining valuation, momentum, and news sentiment; Risk-On/Risk-Off switching enabled.\n- Includes mechanisms to reduce over-trading and manages execution lags and transaction costs.\n- Generates summary reports and maintains state between runs for consistent strategy.\n\nArchive index:\n\nArchive v0.1.0: 5 files, 7099 bytes\n\nFiles: references/news-analysis-format.md (1788b), references/virtual-trading-api.md (1444b), skill-card.md (2218b), SKILL.md (7157b), _meta.json (138b)\n\nFile v0.1.0:SKILL.md\n\n---\nname: portfolio-optimizer\ndescription: >-\n  virtual-trading MCPの価格情報とautomatic-investment-strategy/analysisのニュース分析を\n  組み合わせてポートフォリオを最適化し、割安資産の購入・割高資産の売却を実行する。\n  年率7%以上を目標とし、買い判断・売り判断・リバランス提案を行う。\n  ユーザーが「ポートフォリオを最適化して」「割安な資産を買って」「リバランスして」\n  「投資戦略を実行して」などと依頼したときにトリガーすること。\n---\n\n# ポートフォリオ最適化 Workflow\n\nvirtual-trading MCP の価格データと analysis/ のニュース分析スコアを統合し、\nS&P500を上回るリターンを目標とした売買判断・注文執行を行う。\n\n## ワークフロー概要\n\n```\n1. 現状把握   → ポートフォリオ残高・価格取得\n2. 分析読込   → 直近のニュース分析スコア集計\n3. バリュエーション → 価格トレンド＋ニューススコアで割安/割高判定\n4. 判断       → 買い/売り/ホールドの資産リスト作成\n5. 執行       → virtual-trading MCP で注文\n6. サマリー   → 実行結果と次回推奨をレポート\n```\n\n## Step 1: 現状把握\n\n以下の virtual-trading MCP ツールで現状を取得する。\n\n```\nget_portfolio   → 保有資産一覧・数量・平均取得コスト\nget_prices      → 対象資産の現在価格（または PromQL で過去1週間の高値/安値）\nget_balance     → 現金残高\n```\n\nPromQL で価格トレンドを見る場合: [references/virtual-trading-api.md](./references/virtual-trading-api.md) 参照。\n\n## Step 2: ニュース分析スコア集計\n\ngit pull あるいは \n\n```\ngit clone git@github.com:kackyt/automatic-investment-strategy.git\n```\n\nを実行して最新のニュース分析を取得する\n\n`analysis/` ディレクトリの構造と読み方: [references/news-analysis-format.md](./references/news-analysis-format.md) 参照。\n\n- 直近 3〜7 日分の bloomberg.md / coindesk.md を読む\n- 投資対象となる資産クラスの **平均スコア** を算出する\n  - 株式 (Stocks): bloomberg スコア (株式) の平均\n  - 暗号資産 (Crypto): coindesk スコアの平均\n  *(注: 現金は USD で保有し、債券は取引対象外のためスコア集計から除外する)*\n\n## Step 3: 戦略の一貫性維持（Stateful Strategy Memory の読み込み）\n\n10分ごとの実行（Tick）において方針がブレるのを防ぐため、前回の戦略状態を読み込む。\n- `automatic-investment-strategy/analysis/strategy_state.md` ファイルを確認する（存在しなければ新規作成を想定）。\n- 記載されている「長期軸（Long-term View）」と「短期軸（Short-term View）」を読み込み、直近の動きとの差分をとらえ、適宜更新していく。\n\n## Step 4: マクロ環境による「Risk-On / Risk-Off」の判定\n\n各アセットクラスの `news_score` を用いて、相場全体の地合いを判定し、攻めと守りのスイッチを切り替える。ベンチマークである「SPYの100%バイアンドホールド」のドローダウンを回避することが目的である。\n\n- **Risk-On（強気相場）**: アセットクラスの `news_score` が **0より大きい** 場合。このクラスの銘柄への投資を許可する。\n- **Risk-Off（弱気相場）**: `news_score` が **0以下** の場合。暴落回避のため、このクラスの銘柄は**すべて売却し、100%現金（USD）に退避**する。\n\n## Step 5: 個別銘柄のモメンタム判定と目標配分計算\n\n売買対象銘柄（`SPY`, `BKCH`, `MSFT`, `GOOGL`, `BTC`, `ETH`, `LINK`）について、価格の勢い（モメンタム）を評価し、強い銘柄に資金を集中させる。\n\n```text\nR = (現在価格 - 直近7日安値) / (直近7日高値 - 直近7日安値)  // 0なら底値、1なら高値\nモメンタムスコア = R × 100\n\n総合確信度スコア = (ニューススコア平均 × 5) + モメンタムスコア\n```\n\n- **投資条件**: 総合確信度スコアが **+60 以上** の銘柄のみを投資対象とする。\n- **目標割合(%)**: `確信度スコア` の数値そのままを目標割合(%)とする（例: スコア70なら70%）。\n- **上限設定**: 分散を強制するため、**1銘柄あたりの上限は 30%** とする。\n- **現金バッファ**: 条件を満たす銘柄の割合合計が100%に満たない場合は、残りをUSD（現金）として保持する。合計が100%を超える場合のみ、100%になるよう等比率で縮小（正規化）する。\n\n## Step 6: 取引コストと決済ラグへの対応（Hysteresis）\n\n10分周期の実行に対して毎回細かく売買すると、取引手数料（0.25%）により資金（初期$10,000）が枯渇する（Fee Bleed）。また、株式の翌日決済により資金ロックが発生する。\n\n- **リバランス閾値（不感帯）**: 各銘柄の「現在の保有割合」と「目標割合」の差が**絶対値で 15% 以上**乖離していない限り、売買は実行しない（ホールド継続）。これにより微細なノイズによる取引を防止する。\n- **注文時の残高確認（決済対応）**: `buy_asset` 発注前に必ず利用可能なUSD残高（Settled Cash）を確認する。株式の売却代金が未決済（翌日反映）である場合は、手元の現金残高の範囲内でのみ買い注文を出す。\n\n## Step 7: 注文執行\n\nvirtual-trading MCP の `sell_asset` および `buy_asset` で注文を執行する。\n（※ 売り注文を先に行い、現金を確保してから買い注文を行うこと）\n執行後は `get_portfolio` で最新の状況を確認する。\n\n## Step 8: サマリーレポートと戦略の更新\n\n以下の形式でレポートを出力するとともに、次回のTickに向けて `strategy_state.md` を最新の状況で上書き更新する。\n\n```markdown\n## 最適化レポート (YYYY-MM-DD HH:MM)\n\n### 市場環境サマリー\n- Stocks センチメント: [スコア] (Risk-[On/Off])\n- Crypto センチメント: [スコア] (Risk-[On/Off])\n\n### 実行した取引 (Threshold 15% filter applied)\n| 資産 | 売/買 | 数量 | 金額 | 理由 |\n|------|-------|------|------|------|\n（※ 取引なしの場合は「なし（不感帯内）」と記載）\n\n### ポートフォリオ変化\n- 総額 $X / 現金 $Y\n\n### 戦略状態の更新 (strategy_state.md へ反映)\n- **長期軸**: [マクロトレンドの評価]\n- **短期軸**: [直近のアクション理由と次の注目点]\n```\n\n## 注意事項\n\n- virtual-trading は仮想取引: 実際の資金損失は発生しないが、ロジックの一貫性を保つこと\n- ニュース分析は `automatic-investment-strategy/analysis/<YYYY-MM-DD>/` に格納される\n- 分析ファイルが当日分でない場合は直近の日付フォルダを使う\n- MCP ツール名は会話の文脈で確認すること（get_portfolio, get_prices 等）\n\nFile v0.1.0:_meta.json\n\n{\n  \"ownerId\": \"kn73mne930v2mg1peg6pkb9ann86wqam\",\n  \"slug\": \"portfolio-optimizer\",\n  \"version\": \"0.1.0\",\n  \"publishedAt\": 1779012908176\n}\n\nFile v0.1.0:references/news-analysis-format.md\n\n# ニュース分析ファイルのフォーマット\n\n`automatic-investment-strategy/analysis/<YYYY-MM-DD>/` に毎日 2 ファイルが生成される。\n\n## ファイル一覧\n\n| ファイル | 内容 |\n|----------|------|\n| `bloomberg.md` | 日本・米国の株式/債券/為替に関するニュース分析 |\n| `coindesk.md` | 暗号資産市場のニュース分析 |\n\n## bloomberg.md のスコア読み取り方\n\n各記事に以下の形式でスコアが記載される:\n\n```markdown\n* **影響評価**:\n  * **株式 (Stocks)**: +7 (説明文)\n  * **債券 (Bonds)**: -3 (説明文)\n  * **為替 (Forex)**: +4 (説明文)\n```\n\n- スコア範囲: -10〜+10\n- 複数記事のスコアを**算術平均**して資産クラスのセンチメントとする\n\n## coindesk.md のスコア読み取り方\n\n```markdown\n* **評価スコア**: **+8**\n```\n\n- ファイル末尾の `**総合スコア: +X**` を使うと効率的\n- なければ全記事の評価スコアを平均する\n\n## 資産クラスとスコアのマッピング\n\n| 資産クラス | 参照ファイル | 使用するスコア | 備考 |\n|------------|-------------|---------------|------|\n| 株式 (VOO, 個別株) | bloomberg.md | 株式 (Stocks) スコア平均 | 投資対象 |\n| 暗号資産 (BTC/ETH/SOL) | coindesk.md | 総合スコア or 個別平均 | 投資対象 |\n| 債券 | bloomberg.md | 債券 (Bonds) スコア平均 | 取引不可（参考値） |\n| 円/ドル | bloomberg.md | 為替 (Forex) スコア平均 | 現金はUSD保有のため参考値 |\n\n## 分析ファイルが存在しない場合\n\n- 直近の日付フォルダを使う (例: 休日は前営業日分)\n- 7 日以上古い場合はニューススコアを 0 (中立) として扱い、\n  モメンタムスコアのみで判断する\n\nFile v0.1.0:references/virtual-trading-api.md\n\n# Virtual Trading MCP API リファレンス\n\nvirtual-trading MCP で利用可能なツール群。実際のツール名は MCP 接続時に確認すること。\n\n## 主要ツール\n\n| ツール名 | 用途 |\n|----------|------|\n| `get_portfolio` | 保有資産一覧 (銘柄, 数量, 平均取得価格) |\n| `get_prices` | 資産の現在価格一覧 |\n| `get_balance` | 現金残高 |\n| `place_order` | 買い/売り注文の発行 |\n| `query_metrics` | PromQL でメトリクス時系列取得 |\n\n## PromQL で価格トレンドを取得する例\n\n7 日間の高値/安値を取得する PromQL:\n\n```promql\n# 過去 7 日の高値\nmax_over_time(asset_price{asset=\"BTC\"}[7d])\n\n# 過去 7 日の安値\nmin_over_time(asset_price{asset=\"BTC\"}[7d])\n\n# 現在価格\nasset_price{asset=\"BTC\"}\n```\n\n`query_metrics` ツールに上記クエリを渡し、レスポンスの value を使う。\n\n## place_order パラメータ例\n\n```json\n{\n  \"asset\": \"BTC\",\n  \"side\": \"buy\",\n  \"quantity\": 0.01,\n  \"order_type\": \"market\"\n}\n```\n\n- `side`: `\"buy\"` または `\"sell\"`\n- `quantity`: 数量（通貨・株式の単位）\n- `order_type`: `\"market\"` (成行) / `\"limit\"` (指値)\n\n## エラー対処\n\n- 残高不足: `get_balance` で現金を確認し、注文数量を調整する\n- 保有不足（売り): `get_portfolio` で数量を確認し、保有量以下にする\n- ツール名が合わない: MCP ツール一覧を `list_tools` 等で確認する\n\nFile v0.1.0:skill-card.md\n\n## Description:\n\nPortfolio Optimizer combines virtual-trading MCP price data with news analysis scores to recommend and execute virtual buy, sell, hold, and rebalance decisions.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[kackyt](https://clawhub.ai/user/kackyt)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal users and developers use this skill to operate a virtual portfolio strategy that reads recent market-news sentiment, checks virtual portfolio state and prices, places virtual trades, and reports the resulting allocation and strategy state.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill can change a connected virtual portfolio by placing buy and sell orders.\n\nMitigation: Require confirmation or dry-run review before order execution, especially when testing a new strategy configuration.\n\nRisk: The skill can overwrite persistent strategy state used by later runs.\n\nMitigation: Review proposed strategy_state.md changes before writing them and keep recoverable history for prior state.\n\nRisk: The skill fetches mutable external news-analysis content through unpinned git updates.\n\nMitigation: Use a trusted analysis source and pin or review the exact revision before relying on its scores.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/kackyt/skills/portfolio-optimizer)\n- [News analysis format](references/news-analysis-format.md)\n- [Virtual Trading MCP API reference](references/virtual-trading-api.md)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, shell commands, API calls, files, guidance]\n\n**Output Format:** [Markdown report with inline commands, virtual-trading MCP tool calls, and strategy state updates]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Produces virtual trading actions and may update strategy_state.md between runs.]\n\n## Skill Version(s):\n\n0.1.0 (source: server release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment.","readmeExcerpt":"Skill: Portfolio Optimizer Owner: kackyt Summary: virtual-trading MCPの価格情報とautomatic-investment-strategy/analysisのニュース分析を 組み合わせてポートフォリオを最適化し、割安資産の購入・割高資産の売却を実行する。 年率7%以上を目標とし、買い判断・売り判断・リバランス提案を行う。 ユーザーが「ポートフ... Tags: latest:0.1.0 Version history: v0.1.0 | 2026-05-17T10:15:08.176Z | user Initial release of portfolio-optimizer - Integrates virtual-trading MCP price data with news analysis (automatic-investment-strategy","codeSnippets":[],"executableExamples":[{"language":"text","snippet":"1. 現状把握   → ポートフォリオ残高・価格取得\n2. 分析読込   → 直近のニュース分析スコア集計\n3. バリュエーション → 価格トレンド＋ニューススコアで割安/割高判定\n4. 判断       → 買い/売り/ホールドの資産リスト作成\n5. 執行       → virtual-trading MCP で注文\n6. サマリー   → 実行結果と次回推奨をレポート"},{"language":"text","snippet":"get_portfolio   → 保有資産一覧・数量・平均取得コスト\nget_prices      → 対象資産の現在価格（または PromQL で過去1週間の高値/安値）\nget_balance     → 現金残高"},{"language":"text","snippet":"git clone git@github.com:kackyt/automatic-investment-strategy.git"},{"language":"text","snippet":"R = (現在価格 - 直近7日安値) / (直近7日高値 - 直近7日安値)  // 0なら底値、1なら高値\nモメンタムスコア = R × 100\n\n総合確信度スコア = (ニューススコア平均 × 5) + モメンタムスコア"},{"language":"markdown","snippet":"## 最適化レポート (YYYY-MM-DD HH:MM)\n\n### 市場環境サマリー\n- Stocks センチメント: [スコア] (Risk-[On/Off])\n- Crypto センチメント: [スコア] (Risk-[On/Off])\n\n### 実行した取引 (Threshold 15% filter applied)\n| 資産 | 売/買 | 数量 | 金額 | 理由 |\n|------|-------|------|------|------|\n（※ 取引なしの場合は「なし（不感帯内）」と記載）\n\n### ポートフォリオ変化\n- 総額 $X / 現金 $Y\n\n### 戦略状態の更新 (strategy_state.md へ反映)\n- **長期軸**: [マクロトレンドの評価]\n- **短期軸**: [直近のアクション理由と次の注目点]"},{"language":"markdown","snippet":"* **影響評価**:\n  * **株式 (Stocks)**: +7 (説明文)\n  * **債券 (Bonds)**: -3 (説明文)\n  * **為替 (Forex)**: +4 (説明文)"}],"parameters":null,"dependencies":[],"permissions":[],"extractedFiles":[{"path":"SKILL.md","content":"---\nname: portfolio-optimizer\ndescription: >-\n  virtual-trading MCPの価格情報とautomatic-investment-strategy/analysisのニュース分析を\n  組み合わせてポートフォリオを最適化し、割安資産の購入・割高資産の売却を実行する。\n  年率7%以上を目標とし、買い判断・売り判断・リバランス提案を行う。\n  ユーザーが「ポートフォリオを最適化して」「割安な資産を買って」「リバランスして」\n  「投資戦略を実行して」などと依頼したときにトリガーすること。\n---\n\n# ポートフォリオ最適化 Workflow\n\nvirtual-trading MCP の価格データと analysis/ のニュース分析スコアを統合し、\nS&P500を上回るリターンを目標とした売買判断・注文執行を行う。\n\n## ワークフロー概要\n\n```\n1. 現状把握   → ポートフォリオ残高・価格取得\n2. 分析読込   → 直近のニュース分析スコア集計\n3. バリュエーション → 価格トレンド＋ニューススコアで割安/割高判定\n4. 判断       → 買い/売り/ホールドの資産リスト作成\n5. 執行       → virtual-trading MCP で注文\n6. サマリー   → 実行結果と次回推奨をレポート\n```\n\n## Step 1: 現状把握\n\n以下の virtual-trading MCP ツールで現状を取得する。\n\n```\nget_portfolio   → 保有資産一覧・数量・平均取得コスト\nget_prices      → 対象資産の現在価格（または PromQL で過去1週間の高値/安値）\nget_balance     → 現金残高\n```\n\nPromQL で価格トレンドを見る場合: [references/virtual-trading-api.md](./references/virtual-trading-api.md) 参照。\n\n## Step 2: ニュース分析スコア集計\n\ngit pull あるいは \n\n```\ngit clone git@github.com:kackyt/automatic-investment-strategy.git\n```\n\nを実行して最新のニュース分析を取得する\n\n`analysis/` ディレクトリの構造と読み方: [references/news-analysis-format.md](./references/news-analysis-format.md) 参照。\n\n- 直近 3〜7 日分の bloomberg.md / coindesk.md を読む\n- 投資対象となる資産クラスの **平均スコア** を算出する\n  - 株式 (Stocks): bloomberg スコア (株式) の平均\n  - 暗号資産 (Crypto): coindesk スコアの平均\n  *(注: 現金は USD で保有し、債券は取引対象外のためスコア集計から除外する)*\n\n## Step 3: 戦略の一貫性維持（Stateful Strategy Memory の読み込み）\n\n10分ごとの実行（Tick）において方針がブレるのを防ぐため、前回の戦略状態を読み込む。\n- `automatic-investment-strategy/analysis/strategy_state.md` ファイルを確認する（存在しなければ新規作成を想定）。\n- 記載されている「長期軸（Long-term View）」と「短期軸（Short-term View）」を読み込み、直近の動きとの差分をとらえ、適宜更新していく。\n\n## Step 4: マクロ環境による「Risk-On / Risk-Off」の判定\n\n各アセットクラスの `news_score` を用いて、相場全体の地合いを判定し、攻めと守りのスイッチを切り替える。ベンチマークである「SPYの100%バイアンドホールド」のドローダウンを回避することが目的である。\n\n- **Risk-On（強気相場）**: アセットクラスの `news_score` が **0より大きい** 場合。このクラスの銘柄への投資を許可する。\n- **Risk-Off（弱気相場）**: `news_score` が **0以下** の場合。暴落回避のため、このクラスの銘柄は**すべて売却し、100%現金（USD）に退避**する。\n\n## Step 5: 個別銘柄のモメンタム判定と目標配分計算\n\n売買対象銘柄（`SPY`, `BKCH`, `MSFT`, `GOOGL`, `BTC`, `ETH`, `LINK`）について、価格の勢い（モメンタム）を評価し、強い銘柄に資金を集中させる。\n\n```text\nR = (現在価格 - 直近7日安値) / (直近7日高値 - 直近7日安値)  // 0なら底値、1なら高値\nモメンタムスコア = R × 100\n\n総合確信度スコア = (ニューススコア平均 × 5) + モメンタムスコア\n```\n\n- **投資条件**: 総合確信度スコアが **+60 以上** の銘柄のみを投資対象とする。\n- **目標割合(%)**: `確信度スコア` の数値そのままを目標割合(%)とする（例: スコア70なら70%）。\n- **上限設定**: 分散を強制するため、**1銘柄あたりの上限は 30%** とする。\n- **現金バッファ**: 条件を満たす銘柄の割合合計が100%に満たない場合は、残りをUSD（現金）として保持する。合計が100%を超える場合のみ、100%になるよう等比率で縮小（正規化）する。\n\n## Step 6: 取引コストと決済ラグへの対応（Hysteresis）\n\n10分周期の実行に対して毎回細かく売買すると、取引手数料（0.25%）により資金（初期$10,000）が枯渇する（Fee Bleed）。また、株式の翌日決済により資金ロックが発生する。\n\n- **リバランス閾値（不感帯）**: 各銘柄の「現在の保有割合」と「目標割合」の差が**絶対値で 15% 以上**乖離していない限り、売買は実行しない（ホールド継続）。これにより微細なノイズによる取引を防止する。\n- **注文時の残高確認（決済対応）**: `buy_asset` 発注前に必ず利用可能なUSD残高（Settled Cash）を確認する。株式の売却代金が未決済（翌日反映）である場合は、手元の現金残高の範囲内でのみ買い注文を出す。\n\n## Step 7: 注文執行\n\nvirtual-trading MCP の `sell_asset` および `buy_asset` で注文を執行する。\n（※ 売り注文を先に行い、現金を確保してから買い注文を行うこと）\n執行後は `get_portfolio` で最新の状況を確認する。\n\n## Step 8: サマリーレポートと戦略の更新\n\n以下の形式でレポートを出力するとともに、次回のTickに向けて `strategy_s"},{"path":"_meta.json","content":"{\n  \"ownerId\": \"kn73mne930v2mg1peg6pkb9ann86wqam\",\n  \"slug\": \"portfolio-optimizer\",\n  \"version\": \"0.1.0\",\n  \"publishedAt\": 1779012908176\n}"},{"path":"references/news-analysis-format.md","content":"# ニュース分析ファイルのフォーマット\n\n`automatic-investment-strategy/analysis/<YYYY-MM-DD>/` に毎日 2 ファイルが生成される。\n\n## ファイル一覧\n\n| ファイル | 内容 |\n|----------|------|\n| `bloomberg.md` | 日本・米国の株式/債券/為替に関するニュース分析 |\n| `coindesk.md` | 暗号資産市場のニュース分析 |\n\n## bloomberg.md のスコア読み取り方\n\n各記事に以下の形式でスコアが記載される:\n\n```markdown\n* **影響評価**:\n  * **株式 (Stocks)**: +7 (説明文)\n  * **債券 (Bonds)**: -3 (説明文)\n  * **為替 (Forex)**: +4 (説明文)\n```\n\n- スコア範囲: -10〜+10\n- 複数記事のスコアを**算術平均**して資産クラスのセンチメントとする\n\n## coindesk.md のスコア読み取り方\n\n```markdown\n* **評価スコア**: **+8**\n```\n\n- ファイル末尾の `**総合スコア: +X**` を使うと効率的\n- なければ全記事の評価スコアを平均する\n\n## 資産クラスとスコアのマッピング\n\n| 資産クラス | 参照ファイル | 使用するスコア | 備考 |\n|------------|-------------|---------------|------|\n| 株式 (VOO, 個別株) | bloomberg.md | 株式 (Stocks) スコア平均 | 投資対象 |\n| 暗号資産 (BTC/ETH/SOL) | coindesk.md | 総合スコア or 個別平均 | 投資対象 |\n| 債券 | bloomberg.md | 債券 (Bonds) スコア平均 | 取引不可（参考値） |\n| 円/ドル | bloomberg.md | 為替 (Forex) スコア平均 | 現金はUSD保有のため参考値 |\n\n## 分析ファイルが存在しない場合\n\n- 直近の日付フォルダを使う (例: 休日は前営業日分)\n- 7 日以上古い場合はニューススコアを 0 (中立) として扱い、\n  モメンタムスコアのみで判断する"},{"path":"references/virtual-trading-api.md","content":"# Virtual Trading MCP API リファレンス\n\nvirtual-trading MCP で利用可能なツール群。実際のツール名は MCP 接続時に確認すること。\n\n## 主要ツール\n\n| ツール名 | 用途 |\n|----------|------|\n| `get_portfolio` | 保有資産一覧 (銘柄, 数量, 平均取得価格) |\n| `get_prices` | 資産の現在価格一覧 |\n| `get_balance` | 現金残高 |\n| `place_order` | 買い/売り注文の発行 |\n| `query_metrics` | PromQL でメトリクス時系列取得 |\n\n## PromQL で価格トレンドを取得する例\n\n7 日間の高値/安値を取得する PromQL:\n\n```promql\n# 過去 7 日の高値\nmax_over_time(asset_price{asset=\"BTC\"}[7d])\n\n# 過去 7 日の安値\nmin_over_time(asset_price{asset=\"BTC\"}[7d])\n\n# 現在価格\nasset_price{asset=\"BTC\"}\n```\n\n`query_metrics` ツールに上記クエリを渡し、レスポンスの value を使う。\n\n## place_order パラメータ例\n\n```json\n{\n  \"asset\": \"BTC\",\n  \"side\": \"buy\",\n  \"quantity\": 0.01,\n  \"order_type\": \"market\"\n}\n```\n\n- `side`: `\"buy\"` または `\"sell\"`\n- `quantity`: 数量（通貨・株式の単位）\n- `order_type`: `\"market\"` (成行) / `\"limit\"` (指値)\n\n## エラー対処\n\n- 残高不足: `get_balance` で現金を確認し、注文数量を調整する\n- 保有不足（売り): `get_portfolio` で数量を確認し、保有量以下にする\n- ツール名が合わない: MCP ツール一覧を `list_tools` 等で確認する"},{"path":"skill-card.md","content":"## Description:\n\nPortfolio Optimizer combines virtual-trading MCP price data with news analysis scores to recommend and execute virtual buy, sell, hold, and rebalance decisions.\n\nThis skill is ready for commercial/non-commercial use.\n\n## Publisher:\n\n[kackyt](https://clawhub.ai/user/kackyt)\n\n### License/Terms of Use:\n\nMIT-0\n\n## Use Case:\n\nExternal users and developers use this skill to operate a virtual portfolio strategy that reads recent market-news sentiment, checks virtual portfolio state and prices, places virtual trades, and reports the resulting allocation and strategy state.\n\n### Deployment Geography for Use:\n\nGlobal\n\n## Known Risks and Mitigations:\n\nRisk: The skill can change a connected virtual portfolio by placing buy and sell orders.\n\nMitigation: Require confirmation or dry-run review before order execution, especially when testing a new strategy configuration.\n\nRisk: The skill can overwrite persistent strategy state used by later runs.\n\nMitigation: Review proposed strategy_state.md changes before writing them and keep recoverable history for prior state.\n\nRisk: The skill fetches mutable external news-analysis content through unpinned git updates.\n\nMitigation: Use a trusted analysis source and pin or review the exact revision before relying on its scores.\n\n## Reference(s):\n\n- [ClawHub skill page](https://clawhub.ai/kackyt/skills/portfolio-optimizer)\n- [News analysis format](references/news-analysis-format.md)\n- [Virtual Trading MCP API reference](references/virtual-trading-api.md)\n\n## Skill Output:\n\n**Output Type(s):** [text, markdown, shell commands, API calls, files, guidance]\n\n**Output Format:** [Markdown report with inline commands, virtual-trading MCP tool calls, and strategy state updates]\n\n**Output Parameters:** [1D]\n\n**Other Properties Related to Output:** [Produces virtual trading actions and may update strategy_state.md between runs.]\n\n## Skill Version(s):\n\n0.1.0 (source: server release evidence)\n\n## Ethical Considerations:\n\nUsers should evaluate whether this skill is appropriate for their environment, review any generated or modified files before relying on them, and apply their organization's safety, security, and compliance requirements before deployment."}],"languages":[],"docsSourceLabel":"CLAWHUB","editorialOverview":"virtual-trading MCPの価格情報とautomatic-investment-strategy/analysisのニュース分析を 組み合わせてポートフォリオを最適化し、割安資産の購入・割高資産の売却を実行する。 年率7%以上を目標とし、買い判断・売り判断・リバランス提案を行う。 ユーザーが「ポートフ... Skill: Portfolio Optimizer Owner: kackyt Summary: virtual-trading MCPの価格情報とautomatic-investment-strategy/analysisのニュース分析を 組み合わせてポートフォリオを最適化し、割安資産の購入・割高資産の売却を実行する。 年率7%以上を目標とし、買い判断・売り判断・リバランス提案を行う。 ユーザーが「ポートフ... Tags: latest:0.1.0 Version history: v0.1.0 | 2026-05-17T10:15:08.176Z | user Initial release of portfolio-optimizer - Integrates virtual-trading MCP price data with news analysis (automatic-investment-strategy","editorialQuality":{"score":100,"threshold":65,"status":"ready","wordCount":910,"uniquenessScore":54,"reasons":[]}},"media":{"evidence":{"source":"no-media","verified":false,"confidence":"low","updatedAt":"2026-10-11T05:43:04.468Z","emptyReason":"No screenshots, media assets, or demo links are available."},"primaryImageUrl":null,"mediaAssetCount":0,"assets":[],"demoUrl":null},"ownerResources":{"evidence":{"source":"unclaimed","verified":false,"confidence":"low","updatedAt":"2026-10-11T05:43:04.468Z","emptyReason":"This page has not been claimed by the agent owner."},"hasCustomPage":false,"customPageUpdatedAt":null,"customLinks":[],"structuredLinks":{"docsUrl":null,"demoUrl":null,"supportUrl":null,"pricingUrl":null,"statusUrl":null},"customPage":null},"relatedAgents":{"evidence":{"source":"protocol-neighbors","verified":false,"confidence":"medium","updatedAt":"2026-10-11T07:36:30.201Z","emptyReason":null},"items":[{"id":"8ebccd8e-3863-4187-8355-c3f14e1f9edf","entityType":"agent","canonicalPath":"/agent/iofficeai-aionui","slug":"iofficeai-aionui","name":"AionUi","description":"Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!","url":"https://github.com/iOfficeAI/AionUi","homepage":"https://www.aionui.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-10-09T19:11:12.944Z","createdAt":"2026-02-25T03:38:16.584Z","downloads":null},{"id":"b917f68a-ebff-438e-84f8-3f4b2494c0bc","entityType":"agent","canonicalPath":"/agent/activepieces-activepieces","slug":"activepieces-activepieces","name":"activepieces","description":"AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents","url":"https://github.com/activepieces/activepieces","homepage":"https://www.activepieces.com","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-15T02:22:12.426Z","createdAt":"2026-02-25T03:38:12.412Z","downloads":null},{"id":"5cb26759-3a39-483f-94cf-276a98c13bb8","entityType":"agent","canonicalPath":"/agent/cherryhq-cherry-studio","slug":"cherryhq-cherry-studio","name":"cherry-studio","description":"AI productivity studio with smart chat, autonomous agents, and 300+ assistants. Unified access to frontier LLMs","url":"https://github.com/CherryHQ/cherry-studio","homepage":"https://cherry-ai.com","source":"GITHUB_REPOS","protocols":["MCP","OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-04-11T14:38:40.986Z","createdAt":"2026-02-25T03:38:19.379Z","downloads":null},{"id":"6f6582d0-5d76-4f0f-b81d-86520247950b","entityType":"agent","canonicalPath":"/agent/copilotkit-copilotkit","slug":"copilotkit-copilotkit","name":"CopilotKit","description":"The Frontend for Agents & Generative UI. React + Angular","url":"https://github.com/CopilotKit/CopilotKit","homepage":"https://docs.copilotkit.ai","source":"GITHUB_REPOS","protocols":["OPENCLAW"],"capabilities":[],"safetyScore":100,"overallRank":70,"updatedAt":"2026-03-25T09:50:57.846Z","createdAt":"2026-02-25T03:39:14.617Z","downloads":null}],"links":{"hub":"/agent","source":"/agent/source/clawhub","protocols":[{"label":"OpenClaw","href":"/agent/protocol/openclew"}]}}}