Communitygithub.com

SnapTradeポートフォリオ

SnapTrade SDKを介してユーザーの投資口座に接続し、ポートフォリオレポート(例:日次総額)を生成します。ユーザーがSnapTradeベースの証券会社連携(Webull、E*TRADEなど)、接続ポータルリンク、口座登録、または自動ポートフォリオサマリーを必要とする場合に使用します。

SnapTradeポートフォリオ とは?

このスキルは、SnapTrade SDKを使用して証券会社の口座に接続し、ポートフォリオの日次総額レポートを生成します。開発者は、ユーザーが投資口座のリンク、自動レポート、または売買注文の発注を希望する場合にこのスキルを利用できます。対応プラットフォームとしては、SnapTradeと連携する証券会社(Webull、E*TRADEなど)が含まれます。スキルのワークフローは、SnapTradeアカウントの作成とAPIキーの設定から始まり、依存関係のインストール、資格情報の構成、ユーザー登録と接続ポータルリンクの生成、そしてポートフォリオ総額の取得へと進みます。また、売買注文の発注と監視、無効になった接続の再接続、利用可能な証券会社の一覧表示、通貨換算を含む証券会社ごとの残高取得もサポートしています。内部では、SnapTrade Python SDK(`snaptrade_client`)を使用してリクエスト署名が自動的に処理され、ポートフォリオ総額は各口座の残高から計算されます。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/baneeishaque/ljt-520_openclaw-backup/tree/HEAD/skills/brendanwood/portfolio-trader

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

SnapTradeポートフォリオ は何をしますか?

概要

SnapTradeを介して証券会社の口座に接続し、日次総額レポートを生成します。このスキルは公式のSnapTrade Python SDK(snaptrade_client)を使用し、リクエスト署名は自動的に処理されます。

ワークフロー

2d) 買い/売り注文の発注(株式/ETF)

実行:

python3 scripts/snaptrade_order.py buy|sell TICKER UNITS --account-id <ACCOUNT_ID> [--order-type market|limit] [--limit-price <PRICE>] [--tif Day|GTC|IOC|FOK]

デフォルト:

  • 注文タイプ: market
  • 有効期間: Day
  • 指値価格: 指値注文の場合のみ必須

オプションの監視(最近の注文をポーリング):

python3 scripts/snaptrade_order.py buy|sell TICKER UNITS --account-id <ACCOUNT_ID> --watch
  • デフォルトでは10秒ごとに最大120秒間ポーリング
  • --watch-interval と --watch-seconds で調整可能

既存の注文をIDで監視:

python3 scripts/snaptrade_watch_order.py --account-id <ACCOUNT_ID> --order-id <BROKERAGE_ORDER_ID>
  • 同じ10秒/120秒のデフォルト、--watch-interval と --watch-seconds で調整可能

ユーザーから問われた場合、口座注文エンドポイントを使用して約定を確認し、未約定の注文を報告します。

0) SnapTradeアカウントとAPIキーの作成

証券会社に接続するにはSnapTradeアカウントが必要です。https://snaptrade.com で無料アカウントを作成し、クライアントID と コンシューマーキー を生成して、スキル設定に追加してください。

1) 依存関係のインストール

pip3 install -r requirements.txt

2) 資格情報の設定(一度だけ)

資格情報をローカルの設定ファイルに保存します(コミットしないでください)。user_id は初回実行時に自動生成されます:

/home/openclaw/.openclaw/workspace/secrets/snaptrade.json

例:

{
  "client_id": "YOUR_CLIENT_ID",
  "consumer_key": "YOUR_CONSUMER_KEY",
  "user_id": "<auto-generated-uuid>"
}

2) ユーザー登録と接続ポータルリンクの生成

実行:

python3 scripts/snaptrade_portal.py

これにより:

  • user_secret がない場合はユーザーを登録
  • user_secret を設定ファイルに保存
  • 口座をリンクするためにユーザーが開く必要がある接続ポータルURLを表示

2b) 無効になった接続の再接続

実行:

python3 scripts/snaptrade_reconnect.py [brokerage-name]

これにより:

  • 無効になった接続を一覧表示
  • 再接続リンクを生成(証券会社名で一致させることも可能)
  • ユーザーが接続を再有効化するための再接続URLを表示

2c) 利用可能な証券会社の一覧表示(許可された接続)

実行:

python3 scripts/snaptrade_brokers.py

これにより /snaptrade/partners を呼び出し、allowed_brokerages リスト(表示名)を返します。

3) ポートフォリオ総額の取得

実行:

python3 scripts/snaptrade_total.py

出力は以下のようなJSONです:

{"total_value": 123456.78, "currency": "CAD"}

3b) 証券会社ごとの残高(通貨換算)

実行:

python3 scripts/snaptrade_broker_totals.py --currency CAD

出力JSONには、選択した通貨での証券会社ごとの残高と、使用された為替レートが含まれます。

実装上の注意: 可能な限り get_user_holdings は避けてください。代わりに get_user_account_positions(ポジションエンドポイント)をポートフォリオ/ポジションデータに使用してください。ユーザーから明示的に要求された場合のみ、ホールディングスの残高/キャッシュを使用し、それ以外の場合はホールディングスを呼び出さないでください。

4) 日次レポートのスケジュール

cronを使用して snaptrade_total.py を呼び出し、簡潔なWhatsAppメッセージをフォーマットして、ユーザーに送信します。総額のみが必要です。

スクリプト

  • scripts/snaptrade_common.py — 設定の読み込み/保存とクライアント作成
  • scripts/snaptrade_portal.py — ユーザー登録と接続ポータルリンクの生成
  • scripts/snaptrade_reconnect.py — 無効になった接続の再接続リンクを生成
  • scripts/snaptrade_brokers.py — このクライアントに許可された証券会社を一覧表示
  • scripts/snaptrade_order.py — 買い/売り注文の発注(成行/指値)、オプションの監視機能付き
  • scripts/snaptrade_watch_order.py — 既存の注文をIDで監視し、約定を確認
  • scripts/snaptrade_total.py — 全口座の合計値を計算
  • scripts/snaptrade_broker_totals.py — 証券会社ごとの残高(通貨換算あり)

注意事項

  • リクエスト署名は、consumer_key を使用してSDKの request_after_hook によって処理されます。
  • 合計値は、各口座の account.balance.total をホールディングスから合計することで計算されます。これにより、口座が追加または削除された場合のエラーを回避できます。
  • 複数の通貨が存在する場合、スクリプトは最初に見つかった通貨を使用します。
  • シークレットは chmod 600 のパーミッションでローカル設定ファイルに保管してください。

Individual skills in this repo

This repo contains 13 individual skills — each has its own dedicated page.

baneeishaque/ljt-520_openclaw-backup

Complete investment portfolio risk management system. Analyze positions, calculate risk metrics, stress test scenarios, optimize allocations, and generate institutional-grade risk reports — all without external APIs.

baneeishaque/ljt-520_openclaw-backup

Balance tracking, order overview, and market data across exchanges using OpenMM.

baneeishaque/ljt-520_openclaw-backup

Balance tracking, order overview, and market data across exchanges using OpenMM.

baneeishaque/ljt-520_openclaw-backup

An investment portfolio tracker that runs entirely locally. All data stays in ~/.portfolio-tracker/.

baneeishaque/ljt-520_openclaw-backup

Discover and register autonomous AI agents. Use when: browsing the agent registry, submitting an agent for verification, or embedding agent badges. NOT for: general web search or agent capability analysis.

baneeishaque/ljt-520_openclaw-backup

Query land ownership, leases, landlord info, and land payments. Write operations for payment management and lease renewals.

baneeishaque/ljt-520_openclaw-backup

Build high-converting landing pages and product sales pages using proven 10-section conversion frameworks. Includes Hero → Social Proof → Benefits → CTA flow for both lead capture and e-commerce pages.

baneeishaque/ljt-520_openclaw-backup

Generate complete, responsive HTML landing pages from a product name, tagline, and description. Clean CSS, mobile-ready, with hero, features, CTA, and footer sections.

baneeishaque/ljt-520_openclaw-backup

Optimize conversion pages for paid traffic from Meta (Facebook/Instagram), Google Ads, TikTok Ads, YouTube Ads, Amazon Ads, and Shopify Ads journeys.

baneeishaque/ljt-520_openclaw-backup

Perform a structured conversion rate optimization (CRO) audit of a landing page. Use when a user shares a landing page URL, pastes their page copy, describes their page content, or uploads a screenshot and asks for a conversion audit, CRO review, conversion analysis, landing page feedback, or wants to know why their page isn't converting. Produces a scored 8-factor audit (0–80 total), prioritized fix list with quick wins and strategic recommendations, and an executive summary. Covers: headline clarity, supporting copy, social proof, CTA effectiveness, visual hierarchy, trust signals, mobile/speed signals, and offer clarity.

baneeishaque/ljt-520_openclaw-backup

Generate landing page content from PRD — hero section, features, A/B headline variants, CTA, and SEO meta tags. Use when user says "create landing page", "write landing copy", "hero section", "A/B headlines", or "landing content". Can scaffold actual pages for astro-static. Do NOT use for SEO auditing (use /seo-audit).

baneeishaque/ljt-520_openclaw-backup

Build high-converting landing pages with proven structure, persuasive copy, and conversion optimization.

baneeishaque/ljt-520_openclaw-backup

Track a crypto portfolio across Binance, Hyperliquid, and Polymarket. Calculates NAV, unrealized P&L, daily drawdown, win rate, and equity curve. Use when you need portfolio tracking, NAV calculation, drawdown monitoring, or multi-venue position management.

関連スキル