🎁 Get the FREE AI Skills Starter GuideSubscribe →
BytesAgainBytesAgain
🦀 ClawHub

Precise T Trading

by @yang77160

Professional T+0 intraday trading system for Chinese A-shares. Uses Bayesian inference, Kelly criterion, and VaR risk management to optimize day-trading deci...

TERMINAL
clawhub install precise-t-trading

📖 About This Skill


name: precise-t-trading description: Professional T+0 intraday trading system for Chinese A-shares. Uses Bayesian inference, Kelly criterion, and VaR risk management to optimize day-trading decisions. Supports real-time quotes from Tencent Finance API. Ideal for active traders seeking quantitative edge in volatile markets. Includes risk control, position sizing, and automated monitoring. version: 1.0.0 author: Kemi (yang77160) license: MIT tags: [trading, stocks, quantitative, A-share, T+0, risk-management] required_env_vars: [] optional_env_vars: - T_TRADING_DEFAULT_STOCK - T_TRADING_TOTAL_SHARES network: - qt.gtimg.cn writes: - ./cache/ (optional caching) - ./monitor_logs/ (if using monitor script) install: pip install numpy scipy requests colorama

Precise T+0 Trading System (精算做T系统)

Professional quantitative trading skill for Chinese A-share intraday T+0 trading. Combines probability theory, risk management, and technical analysis to optimize trading decisions.

What This Skill Does

  • Real-time Quotes: Fetches live stock data from Tencent Finance (domestic, stable)
  • Bayesian Win Rate: Updates trading success probability based on recent performance
  • Expected Value Model: Calculates E(T) = p×profit - (1-p)×loss
  • Kelly Criterion: Optimizes position sizing for maximum growth
  • VaR Risk Control: Calculates Value at Risk for downside protection
  • Technical Scoring: 100-point technical analysis system
  • Automated Monitoring: Price alert system with logging
  • Web Dashboard: Real-time visualization (HTML)
  • When to Use

    Use this skill when:

  • User asks about T+0 intraday trading strategies
  • User wants quantitative analysis for specific stocks
  • User needs risk management calculations
  • User wants automated price monitoring
  • User requests backtesting or strategy optimization
  • Quick Start

    1. Run T+0 Analysis

    python scripts/t_trading_analysis.py sz000981
    

    Output:

    ======================================================================
      Precise T+0 Trading System v2.0
    ======================================================================

    【Real-time Quote】 Stock: 山子高科 (000981) Price: 4.06 CNY Change: -1.69% ...

    【Quantitative Analysis】 Win Rate: 65.0% → 75.5% (Bayesian) Expected Profit: +0.0481 CNY/share PASS Kelly Position: 50.0% → Conservative 30.0% Technical Score: 85/100 VaR(95%): 269.43 CNY

    【Final Decision】 GO - Execute T+0 Trade Action Plan: Buy Zone: 4.01 - 4.04 Sell Zone: 4.39 - 4.72 Position: 360 shares Expected Profit: +17.33 CNY Stop Loss: 3.96

    2. Start Price Monitoring

    python scripts/stock_monitor.py
    

    Monitors stocks every 60 minutes and logs alerts.

    3. Open Web Dashboard

    open scripts/dashboard.html
    

    Real-time visualization with auto-refresh every 30 seconds.

    Configuration

    Environment Variables

    | Variable | Default | Description | |----------|---------|-------------| | T_TRADING_DEFAULT_STOCK | sz000981 | Default stock code | | T_TRADING_TOTAL_SHARES | 1200 | Total share position |

    Edit scripts/config.py

    class Config:
        SUPPORT_LEVEL = 4.01      # Support price
        RESISTANCE_LEVEL = 4.72   # Resistance price
        MAX_POSITION_RATIO = 0.3  # Max 30% per trade
    

    Mathematical Models

    1. Expected Value

    E(T) = p × profit - (1-p) × loss
    
  • If E(T) > 0: Worth trading
  • If E(T) < 0: Avoid trading
  • 2. Bayesian Update

    p_new = α × p_recent + (1-α) × p_historical
    
  • α = 0.7 (recent weight)
  • Dynamically adjusts win rate
  • 3. Kelly Criterion

    f* = (p × b - q) / b
    
  • b = profit/loss ratio
  • Optimal position sizing
  • 4. Value at Risk

    VaR = z × σ × position_value
    
  • 95% confidence: z = 1.645
  • Maximum daily loss estimate
  • File Structure

    precise-t-trading/
    ├── SKILL.md                    # This file
    ├── _meta.json                  # Skill metadata
    └── scripts/
        ├── t_trading_analysis.py   # Main analysis script
        ├── stock_monitor.py        # Automated monitoring
        ├── dashboard.html          # Web dashboard
        └── config.py               # Configuration
    

    Trading Rules

    Entry Criteria

    1. Expected profit E(T) > 0 2. Win rate > 50% 3. Technical score > 60/100 4. Price near support/resistance

    Position Sizing

  • Kelly recommendation: Calculated automatically
  • Conservative cap: 30% of position
  • Single trade max: 50%
  • Risk Control

  • Daily stop loss: 3% of portfolio
  • Consecutive losses: 3 losses → pause 1 day
  • Total loss: 10% → halve position
  • Exit Strategy

  • Take profit: At resistance level
  • Stop loss: 0.05 below support
  • Time limit: Close by market close (15:00)
  • Example Workflows

    Analyze Specific Stock

    User: "分析山子高科的做T机会"
    → Run: python scripts/t_trading_analysis.py sz000981
    → Show analysis results
    → Provide trading recommendation
    

    Set Up Monitoring

    User: "帮我监控山子高科和隆基绿能"
    → Edit scripts/config.py with stock list
    → Run: python scripts/stock_monitor.py
    → Check logs for alerts
    

    Check Dashboard

    User: "打开监控面板"
    → Open: scripts/dashboard.html
    → Browser shows real-time prices
    

    Tips for Best Results

    1. Update Historical Data: Replace mock data with real T+0 records 2. Adjust Parameters: Tune α (Bayesian weight) based on performance 3. Monitor Multiple Stocks: Add more stocks to monitoring list 4. Backtest Strategy: Use historical data to validate edge 5. Paper Trade First: Test with virtual money before real trading

    Troubleshooting

    | Problem | Solution | |---------|----------| | "Data fetch failed" | Check internet connection | | "Module not found" | Run pip install -r requirements.txt | | "GBK encoding error" | Use UTF-8 terminal or PowerShell | | "Permission denied" | Run as administrator on Windows |

    Performance Notes

  • Data Source: Tencent Finance (domestic China, very stable)
  • Latency: < 100ms for quote fetch
  • Accuracy: Depends on historical data quality
  • Update Frequency: Real-time quotes, 60-min monitoring
  • Disclaimer

    ⚠️ Trading involves risk. Past performance does not guarantee future results.

  • This skill is for educational and research purposes
  • Always paper trade before using real money
  • Never risk more than you can afford to lose
  • Consult a financial advisor for personalized advice
  • Version History

    v1.0.0 (2026-04-03)

  • Initial release
  • Bayesian win rate optimization
  • Kelly criterion position sizing
  • VaR risk management
  • Real-time Tencent API integration
  • Web dashboard
  • Automated monitoring
  • Author

    Kemi (yang77160)

  • Quantitative trading enthusiast
  • Focus on probability-based strategies
  • OpenClaw skill developer
  • 💰 Support This Project

    If this skill helps you make money, consider supporting its development!

    WeChat Pay / Alipay:

    !扫码支持作者

    Your support helps me:

  • Add more advanced features
  • Improve accuracy with machine learning
  • Provide priority support
  • Build community tools
  • 🤝 Community & Cross-Skill Boost

  • GitHub Issues: Report bugs or request features
  • WeChat Group: Join our trading community
  • Email: yang77160@example.com
  • ⚡ Pro Tip: Use my Weekly Report Genius to finish your work early, so you have more energy to monitor the market!
  • License

    MIT License - Free to use, modify, and distribute.


    _Happy Trading! Remember: Risk management first._ 📊

    **⭐ 如果这个技能对你有帮助,请在 ClawHub 上给它点个星!

    🎁 推荐奖励计划

    邀请好友使用,双方都得奖励!

    1. 你推荐朋友安装此 Skill 2. 朋友在 clawhub 上给你点赞/评论 3. 截图发给我(微信/邮件) 4. 你获得: - ✅ Pro 版本优先体验资格 - ✅ 1对1 量化策略咨询(30分钟) - ✅ 加入核心用户群(获取最新策略)

    每推荐5人,额外获得

  • 🎯 个性化参数调优服务
  • 📊 专属回测报告
  • 📊 用户见证

    > "用了一周,做T胜率从50%提升到70%,太香了!" - 张先生,上海

    > "终于不用凭感觉交易了,数据说话,心里有底" - 李女士,深圳

    > "VaR风控帮我躲过一次大跌,少亏2000+" - 王先生,北京

    你也用得好?欢迎分享你的故事! 发邮件到 yang77160@example.com 或加微信**

    ⚡ When to Use

    TriggerAction
    - User asks about T+0 intraday trading strategies
    - User wants quantitative analysis for specific stocks
    - User needs risk management calculations
    - User wants automated price monitoring
    - User requests backtesting or strategy optimization

    💡 Examples

    1. Run T+0 Analysis

    python scripts/t_trading_analysis.py sz000981
    

    Output:

    ======================================================================
      Precise T+0 Trading System v2.0
    ======================================================================

    【Real-time Quote】 Stock: 山子高科 (000981) Price: 4.06 CNY Change: -1.69% ...

    【Quantitative Analysis】 Win Rate: 65.0% → 75.5% (Bayesian) Expected Profit: +0.0481 CNY/share PASS Kelly Position: 50.0% → Conservative 30.0% Technical Score: 85/100 VaR(95%): 269.43 CNY

    【Final Decision】 GO - Execute T+0 Trade Action Plan: Buy Zone: 4.01 - 4.04 Sell Zone: 4.39 - 4.72 Position: 360 shares Expected Profit: +17.33 CNY Stop Loss: 3.96

    2. Start Price Monitoring

    python scripts/stock_monitor.py
    

    Monitors stocks every 60 minutes and logs alerts.

    3. Open Web Dashboard

    open scripts/dashboard.html
    

    Real-time visualization with auto-refresh every 30 seconds.

    ⚙️ Configuration

    Environment Variables

    | Variable | Default | Description | |----------|---------|-------------| | T_TRADING_DEFAULT_STOCK | sz000981 | Default stock code | | T_TRADING_TOTAL_SHARES | 1200 | Total share position |

    Edit scripts/config.py

    class Config:
        SUPPORT_LEVEL = 4.01      # Support price
        RESISTANCE_LEVEL = 4.72   # Resistance price
        MAX_POSITION_RATIO = 0.3  # Max 30% per trade
    

    📋 Tips & Best Practices

    | Problem | Solution | |---------|----------| | "Data fetch failed" | Check internet connection | | "Module not found" | Run pip install -r requirements.txt | | "GBK encoding error" | Use UTF-8 terminal or PowerShell | | "Permission denied" | Run as administrator on Windows |