agentleFS
wwumitwwumit/skills-stock/skills/trade-tracker/SKILL.md

trade-tracker

Skill0 starsChanged 3 months agoMITView on GitHub

交易追踪与归因分析 v1.1.0。从交易记录逐笔追踪盈亏、 按股票/月度/季度/年度归因、交易成本分析(佣金+滑点)、 持仓时间分析、策略标签归类、多策略对比、ASCII盈亏分布图。

The file

Files
SKILL.md

⚠️ 免责声明:本工具为辅助性参考工具,不构成投资建议,不构成法律建议。市场有风险,投资需谨慎;据此操作,风险自担。正式合规意见请咨询具备资质的律师。最终决策与责任由使用者自行承担。 仅供学习研究参考;> 仅供参考,不构成任何操作依据;市场有风险,投资需谨慎,据此操作风险自担。

💰 Trade Tracker

Overview

从交易记录中提取关键信息,按股票和时间维度进行归因分析。支持成本分析、持仓结构、策略标签归类,帮助你全面理解交易表现。

Usage

# 基本分析
python3 scripts/trade_tracker.py --file trades.csv

# 月度归因
python3 scripts/trade_tracker.py --file trades.csv --by month

# 交易成本分析
python3 scripts/trade_tracker.py --file trades.csv --cost

# 持仓时间分析
python3 scripts/trade_tracker.py --file trades.csv --hold

# 策略标签归类(需CSV有 tag 或 strategy 列)
python3 scripts/trade_tracker.py --file trades.csv --tag

# 多策略对比
python3 scripts/trade_tracker.py --file trades.csv --compare

# ASCII盈亏分布图
python3 scripts/trade_tracker.py --file trades.csv --chart

# 输出JSON
python3 scripts/trade_tracker.py --file trades.csv --output analysis.json

输出示例

📊 交易归因分析
    =======================================================
    总交易: 156 (买入82 / 卖出74)
    总盈亏: +45,280.00
    胜率:   58.3% (91/156)
    平均每笔: +290.26

    ── 月度归因 ──
    期间       交易      盈亏          胜率   最高盈亏       最低盈亏
    ---------------------------------------------------------------------------
    2026-01    18    +18,500.00   66.7%  比亚迪 (+12,500)    药明康德 (-8,200)
    2026-02    12     +8,200.00   58.3%  宁德时代 (+5,600)   茅台 (-2,300)

    ── 交易成本 ──
    总佣金: +12,450.00
    平均佣金率: 0.080%
    估算滑点: +15,600.00
    成本/盈亏比: 25.3%

    ── 持仓时间 ──
    平均持仓: 4.2天 (最短1天 / 最长22天)
    持仓区间    交易      盈亏
    ------------------------------
    0-1天       45     +12,000.00
    2-3天       38      -3,200.00
    4-7天       48     +18,500.00

    ── 策略标签归因 ──
    策略          交易      盈亏          胜率    平均每笔
    --------------------------------------------------
    突破追涨       45    +12,500.00   62.2%      +277.78
    低吸埋伏       38     +8,200.00   55.3%      +215.79
    日内短线       25     -2,100.00   48.0%       -84.00

命令详解

命令说明
(默认)综合交易分析
--by month/quarter/year归因周期
--cost交易成本分析
--hold持仓时间分析
--tag策略标签归类
--compare多策略对比
--chartASCII盈亏分布图

CSV列自动识别

字段匹配列名
盈亏pnl, profit, 盈亏, net_pnl
方向direction, action, 方向, side
日期date, 日期, trade_date
股票stock, 代码, symbol, name
价格price, 成交价, avg_price
佣金commission, 佣金, fee
策略tag, strategy, 策略

Security

  • ✅ 纯本地运行,无网络请求
  • ✅ 只读交易记录CSV
  • ❌ 无任意代码执行

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.