简介
连接 Trading212 实盘/模拟账户,提供投资组合全景分析、智能交易建议与一键下单执行,支持分红追踪与再平衡策略。
原始描述
Analyzes Trading212 portfolio, generates daily summaries with P&L and top gainers/losers, makes trade proposals based on configurable rules, and can place or...
通过你的 Agent 添加
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
中文使用说明 来自收录源
核心功能
Trading212 Skill 是一款面向个人投资者的综合性交易助手,深度集成 Trading212 经纪商 API,覆盖从 portfolio 监控到订单执行的全链路需求。
主要用法
-
每日组合摘要(summary):自动生成持仓总览,包含组合市值、现金余额、当日盈亏(EUR 金额 + 百分比)、逐持仓明细(数量、成本价、现价、浮动盈亏)、今日涨跌榜、关键事件(成交订单、分红到账)及多周期业绩(1 周/1 月/3 月/1 年)。
-
智能交易建议(propose):基于可配置规则引擎生成买卖建议,支持低/高风险偏好切换。内置规则包括:大跌减仓、止盈离场、定投买入(DCA)、止损保护、单一持仓上限控制、成本摊低策略、现金储备预警等。所有建议需用户确认后方可执行。
-
订单执行(execute_trade):支持市价/限价单,自动校验资金/持仓充足性。安全设计:默认连接模拟盘(paper-trading),切换实盘需显式设置
TRADING212_DEMO=false;每笔订单执行前必须获得用户二次确认,并明确提示「模拟交易」或「真实资金」状态。 -
分红统计(dividends):汇总历史累计及近 12 个月分红收入,按标的拆解,提供最近付息日及估算年化收益率。
-
交易历史(history):查询全部或指定标的的历史订单,支持时间范围过滤,自动计算已实现盈亏。
-
价格监控(watchlist):读取用户配置的 watchlist.yaml,实时比对当前价格与设定阈值,触发高低价警报。
-
资产配置分析(allocation):对比当前持仓权重与目标配置(allocation.yaml),输出偏离度分析;开启
--rebalance后自动生成调仓方案。
显著优点
- 端到端闭环:从数据获取、分析洞察到交易执行一气呵成,无需切换平台。
- 规则可扩展:YAML 配置驱动,用户可自定义风控与再平衡逻辑。
- 安全第一:默认模拟盘、双重确认机制、显式风险提示,降低误操作风险。
- 多维度业绩追踪:除当日盈亏外,提供多周期回望,便于长期复盘。
潜在局限
- 依赖 Trading212 API:仅支持 Trading212 账户,无法跨券商聚合持仓。
- 配置门槛:规则文件(rules.yaml、allocation.yaml、watchlist.yaml)需用户手动维护,对非技术用户有一定学习成本。
- 市场覆盖:受 Trading212 可交易标的范围限制,部分小众市场或衍生品可能不支持。
- 实时性:API 延迟可能影响高频场景,更适合日频或低频决策。
适合人群
- Trading212 活跃用户,尤其是采用定投、再平衡等系统化策略的被动投资者
- 希望减少情绪化交易、依赖规则自动化辅助决策的散户
- 需要统一监控多维度业绩(价格、分红、实现/浮动盈亏)的精细化管理者
常规风险
- API 密钥泄露:
TRADING212_API_KEY与TRADING212_API_SECRET需安全存储,避免硬编码或误提交至版本控制。 - 误触实盘:切换
TRADING212_DEMO时务必仔细核对,防止以真实资金执行测试策略。 - 规则失效风险:市场极端行情下,预设规则可能产生连续不利信号,需定期回检与人工复核。
- 流动性与滑价:市价单在波动剧烈时可能以不利价格成交,大额订单建议拆单或使用限价单。
技能正文
name: trading212 description: Analyzes Trading212 portfolio, generates daily summaries with P&L and top gainers/losers, makes trade proposals based on configurable rules, and can place orders. Also supports dividend overview, order history, watchlist with price alerts, and portfolio allocation analysis with rebalancing proposals. Use when the user asks about portfolio, daily performance, trade actions, or requests a portfolio overview. metadata: {"openclaw":{"requires":{"bins":["python3"],"env":["TRADING212_API_KEY","TRADING212_API_SECRET"]},"primaryEnv":"TRADING212_API_KEY"}}
Trading212 Skill
Connects to the Trading212 API to provide portfolio analysis, trade proposals, and order execution.
Important: By default all operations run against the demo (paper-trading) environment. Set TRADING212_DEMO=false only when you are absolutely sure the user wants to trade with real money.
Prerequisites
Install dependencies once from the skill's script directory:
pip install -r {baseDir}/requirements.txt
Available Modes
1. summary -- Daily portfolio overview
python3 {baseDir}/scripts/trading212_skill.py --mode summary
Returns structured JSON with:
- Total portfolio value, cash, daily change (EUR + %)
- Per-position details (quantity, avg price, current price, unrealised P&L)
- Top gainers and top losers
- Notable events (orders filled today, dividends received)
- Multi-period performance (1 week, 1 month, 3 months, 1 year)
Use this when the user asks: "How did my portfolio do today?", "Give me a summary", "What happened in my portfolio?"
Present the JSON output as a readable English summary. Highlight the daily change prominently, list top gainers and losers, and mention notable events.
2. propose -- Trade proposals
python3 {baseDir}/scripts/trading212_skill.py --mode propose
python3 {baseDir}/scripts/trading212_skill.py --mode propose --risk low
python3 {baseDir}/scripts/trading212_skill.py --mode propose --risk high
Returns a list of suggested actions (buy, sell, reduce, hold) with quantities and reasons. Rules are configured in config/rules.yaml.
Active rules:
- Reduce on drop: Propose reducing positions that dropped significantly today with large weight
- Take profit: Propose selling small positions with high unrealised gain
- DCA buy: Propose buying tickers on the DCA list when enough cash is available
- Stop-loss: Propose selling when price drops below stop-loss threshold vs average purchase price
- Max exposure: Propose reducing when a single position exceeds maximum portfolio weight
- Cost averaging: Propose buying more when price is significantly below average purchase price
- Cash reserve: Warn when cash falls below minimum percentage of portfolio
Use this when the user asks: "What should I do?", "Any trade suggestions?", "Should I buy or sell anything?"
Present proposals clearly. Always ask the user for confirmation before executing any proposed trade. Never execute trades automatically.
3. execute_trade -- Place an order
python3 {baseDir}/scripts/trading212_skill.py --mode execute_trade --params '{"symbol":"AAPL_US_EQ","side":"buy","quantity":5,"order_type":"market"}'
Parameters (JSON):
symbol(required): Trading212 ticker, e.g. "AAPL_US_EQ"side(required): "buy" or "sell"quantity(required): positive number of sharesorder_type: "market" (default) or "limit"limit_price: required when order_type is "limit"
Pre-trade validation is performed automatically:
- Buy orders: checks if enough cash is available
- Sell orders: checks if enough shares are held
CRITICAL SAFETY RULES:
- NEVER execute a trade without explicit user confirmation.
- Always show the user exactly what will be executed (symbol, side, quantity, order type) and ask "Shall I place this order?" before running.
- If
TRADING212_DEMO=true(the default), remind the user this is a paper-trade. - If
TRADING212_DEMO=false, warn the user clearly that this is a REAL order with real money.
4. dividends -- Dividend overview
python3 {baseDir}/scripts/trading212_skill.py --mode dividends
Returns structured JSON with:
- Total dividends received (all time and last 12 months)
- Per-ticker breakdown with totals, last payment date, and estimated annual yield
- Dividend calendar (most recent payment per ticker)
Use this when the user asks: "How much dividend did I receive?", "What are my dividends?", "When was my last dividend?"
5. history -- Order history
python3 {baseDir}/scripts/trading212_skill.py --mode history
python3 {baseDir}/scripts/trading212_skill.py --mode history --params '{"ticker":"AAPL_US_EQ","days":30}'
Returns structured JSON with:
- Total number of historical orders
- Realized P&L per ticker and overall
- Full order list with dates, prices, and quantities
Optional parameters (JSON):
ticker: Filter by specific tickerdays: Limit to orders from the last N days
Use this when the user asks: "Show my order history", "How much profit did I realize?", "What did I trade last month?"
6. watchlist -- Price monitoring
python3 {baseDir}/scripts/trading212_skill.py --mode watchlist
Reads config/watchlist.yaml and checks price alerts for each ticker. Returns:
- List of watchlist items with current prices (if held)
- Triggered alerts (price above or below configured thresholds)
Configure the watchlist in config/watchlist.yaml:
watchlist:
- ticker: "NVDA_US_EQ"
alert_below: 100.0
alert_above: 150.0
Use this when the user asks: "Check my watchlist", "Any price alerts?", "What are my watched stocks doing?"
7. allocation -- Portfolio allocation analysis
python3 {baseDir}/scripts/trading212_skill.py --mode allocation
python3 {baseDir}/scripts/trading212_skill.py --mode allocation --rebalance
Returns structured JSON with:
- Current weight per position vs target allocation
- Deviation from target per position
- Missing target tickers (in target but not held)
- Cash allocation vs target
With --rebalance flag, also generates buy/sell proposals to move toward target allocation.
Configure target allocation in config/allocation.yaml:
target_allocation:
"VWCE.UK": 40.0
"IWDA.UK": 30.0
_cash: 5.0
Use this when the user asks: "How is my portfolio allocated?", "Am I balanced?", "What should I rebalance?"
Output Format
All modes return structured JSON to stdout. Parse it and present a human-readable English summary to the user.
Additional Resources
For full output schemas and API details, see reference.md.
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。