← 返回
数据分析 Key 中文

trading212 Skill

Analyzes Trading212 portfolio, generates daily summaries with P&L and top gainers/losers, makes trade proposals based on configurable rules, and can place or...
分析Trading212投资组合,生成每日盈亏及涨跌榜摘要,根据可配置规则提出交易建议并执行
nandichi
数据分析 clawhub v1.0.0 1 版本 99908.6 Key: 需要
★ 0
Stars
📥 1,093
下载
💾 18
安装
1
版本
#invest#latest#portfolio#stocks#trading#trading212

概述

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 shares
  • order_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:

  1. NEVER execute a trade without explicit user confirmation.
  2. Always show the user exactly what will be executed (symbol, side, quantity, order type) and ask "Shall I place this order?" before running.
  3. If TRADING212_DEMO=true (the default), remind the user this is a paper-trade.
  4. 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 ticker
  • days: 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.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 05:43 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

A股量化 AkShare

mbpz
A股量化数据分析工具,基于AkShare库获取A股行情、财务数据、板块信息等。用于回答关于A股股票查询、行情数据、财务分析、选股等问题。
★ 166 📥 60,294
data-analysis

Data Analysis

ivangdavila
{"answer":"数据分析与可视化。查询数据库、生成报告、自动化电子表格,将原始数据转化为清晰可行的见解。适用于:(1) 您……"}
★ 199 📥 65,286
data-analysis

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 368 📥 140,925