Communitygithub.com

baneeishaque/ljt-520_openclaw-backup

透過 SnapTrade SDK 連接使用者的投資帳戶,並產生投資組合報告(例如每日總價值)。適用於使用者需要基於 SnapTrade 的經紀商連線(Webull、E*TRADE 等)、連線入口連結、帳戶註冊或自動化投資組合摘要時。

ljt-520_openclaw-backup 是什麼?

此技能「SnapTrade Portfolio」讓 AI 代理能透過 SnapTrade API,安全地連接多家券商帳戶,並自動化擷取投資組合資料。它使用官方的 SnapTrade Python SDK 處理請求簽章,支援帳戶註冊、生成連線入口連結、買賣股票與 ETF、監控訂單狀態,以及計算彙總的投資組合總價值。使用者只需建立免費的 SnapTrade 帳戶、取得 API 金鑰,並執行一系列命令列腳本即可開始使用。此技能特別適合用於自動化產生日報表(例如透過 cron 排程執行),並將結果格式化為簡潔的 WhatsApp 訊息發送給使用者。支援的券商包含 Webull、E*TRADE 等。在處理持股資料時,建議優先使用 `get_user_account_positions` 而非 `get_user_holdings`,以提高效率與正確性。

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

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

SnapTrade Portfolio

概覽

透過 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 (Client ID) 和消費者金鑰 (Consumer Key),然後將其加入技能設定。

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 — 各券商總計(含匯率換算)

備註

  • SDK 會透過 request_after_hook 搭配 consumer_key 自動處理請求簽章。
  • 總價值是透過加總每個帳戶的 account.balance.total(來自 holdings)來計算;這可以避免在新增或移除帳戶時發生錯誤。
  • 如果存在多種貨幣,腳本會使用遇到的第一種貨幣。
  • 請將秘密資訊保存在本地設定檔中,並使用 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.

相關技能