SuperAPI AI Directory

tencent-finance

Coding & development

View repository

Updated 10-16 03:10

About this skill

Tencent Finance CLI

A Python CLI for fetching stock data from Tencent Finance API.

Features

  • ✅ No API key required - No API Key required
  • ✅ Works in mainland China - Optimized for the mainland China network environment, directly accesses the Tencent Finance API
  • ✅ Fast & Stable - More stable than the Yahoo Finance API, not affected by rate limiting
  • ✅ Multi-market support - Supports US stocks, A-shares, and Hong Kong stocks

Installation

chmod +x /path/to/skills/tencent-finance/tfin
ln -sf /path/to/skills/tencent-finance/tfin /usr/local/bin/tfin  # Optional: global access

Commands

Price (quick check)

tfin AAPL              # Quick price
tfin price AAPL        # Same as above

Quote (detailed)

tfin quote MSFT

Compare

tfin compare AAPL,MSFT,GOOGL
tfin compare TSLA,NVDA

Search

tfin search "tesla"
tfin search "bitcoin"

Help

tfin help
tfin --help

Symbol Format

  • US stocks: AAPL, MSFT, GOOGL, TSLA, NVDA
  • China A-Shares: sh000001 (Shanghai Composite Index), sz399001 (Shenzhen Component Index), sh600519 (Moutai)
  • Hong Kong: hk00700 (Tencent), hk09988 (Alibaba), hk03690 (Meituan)
  • Crypto: BTC-USD, ETH-USD

Examples

# Quick price check
tfin AAPL
tfin TSLA

# Detailed quote
tfin quote NVDA

# Compare tech giants
tfin compare AAPL,MSFT,GOOGL,META,AMZN

# Search
tfin search "apple"
tfin search "bitcoin"

# China stocks
tfin sh000001           # 上证指数
tfin quote hk00700      # 腾讯控股

Data Source

This tool uses Tencent Finance API (Tencent Finance API).

Why Tencent API?

  • Can be accessed directly in the mainland China network environment without a proxy
  • More stable than the Yahoo Finance API, not affected by rate limiting
  • Data covers multiple markets such as US stocks, A-shares, and Hong Kong stocks

Data includes:

  • Current price (real-time price)
  • Price change (absolute & percentage) (change amount/change percentage)
  • Open, High, Low prices (open/high/low prices)
  • Previous close (previous close)
  • Volume (trading volume)
  • Market cap (market capitalization)
  • P/E ratio (price-to-earnings ratio)
  • P/B ratio (price-to-book ratio)

Supported Markets

Market Example Status
US Stocks AAPL, TSLA, NVDA ✅ Supported
China A-Shares sh000001, sz399001 ✅ Supported
Hong Kong hk00700, hk09988 ✅ Supported
Crypto BTC-USD, ETH-USD ✅ Supported
India NSE/BSE RELIANCE.NS, TCS.BO ❌ Not supported

Comparison with Yahoo Finance

Feature Yahoo Finance (yfinance) Tencent Finance (tfin)
Mainland China Access Often blocked/restricted ✅ Direct access
Rate Limiting Frequent ✅ Stable
US Stocks ✅ Supported ✅ Supported
China A-Shares Limited ✅ Full support
Hong Kong Stocks Supported ✅ Supported
Indian Stocks ✅ Supported ❌ Not supported
Options/Dividends Supported ❌ Not supported

Requirements

  • Python 3.7+
  • requests
  • rich
pip3 install requests rich

Troubleshooting

"No data found"

  • Verify the symbol format
  • Try with prefix: usAAPL instead of AAPL
  • Some international markets may not be supported

Connection errors

  • Check internet connection
  • Tencent API is optimized for mainland China and generally very stable

License

MIT License

Author

Created by Menrfa