Tencent Finance CLI
A Python CLI for fetching stock data from Tencent Finance API.
Features
- ✅ No API key required - 无需申请 API Key
- ✅ Works in mainland China - 针对中国大陆网络环境优化,直接访问腾讯财经 API
- ✅ Fast & Stable - 比 Yahoo Finance API 更稳定,不受限流影响
- ✅ Multi-market support - 支持美股、A股、港股
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 (上证指数), sz399001 (深证成指), sh600519 (茅台)
- Hong Kong: hk00700 (腾讯), hk09988 (阿里), hk03690 (美团)
- 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 (腾讯财经 API).
Why Tencent API?
- 在中国大陆网络环境下可直接访问,无需代理
- 比 Yahoo Finance API 更稳定,不受限流影响
- 数据覆盖美股、A股、港股等多个市场
Data includes:
- Current price (实时价格)
- Price change (absolute & percentage) (涨跌额/涨跌幅)
- Open, High, Low prices (开盘/最高/最低价)
- Previous close (昨收)
- Volume (成交量)
- Market cap (市值)
- P/E ratio (市盈率)
- P/B 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
1---
2name: tencent-finance
3description: Get stock prices, quotes, and compare stocks using Tencent Finance API. No API key required. Supports US stocks, China A-Shares, Hong Kong stocks. Optimized for use in mainland China.
4metadata:
5 source: https://skillmd.com/skills/modbender/tencent-finance
6---
7
8# Tencent Finance CLI
9
10A Python CLI for fetching stock data from Tencent Finance API.
11
12## Features
13
14- ✅ **No API key required** - 无需申请 API Key
15- ✅ **Works in mainland China** - 针对中国大陆网络环境优化,直接访问腾讯财经 API
16- ✅ **Fast & Stable** - 比 Yahoo Finance API 更稳定,不受限流影响
17- ✅ **Multi-market support** - 支持美股、A股、港股
18
19## Installation
20
21```bash
22chmod +x /path/to/skills/tencent-finance/tfin
23ln -sf /path/to/skills/tencent-finance/tfin /usr/local/bin/tfin # Optional: global access
24```
25
26## Commands
27
28### Price (quick check)
29```bash
30tfin AAPL # Quick price
31tfin price AAPL # Same as above
32```
33
34### Quote (detailed)
35```bash
36tfin quote MSFT
37```
38
39### Compare
40```bash
41tfin compare AAPL,MSFT,GOOGL
42tfin compare TSLA,NVDA
43```
44
45### Search
46```bash
47tfin search "tesla"
48tfin search "bitcoin"
49```
50
51### Help
52```bash
53tfin help
54tfin --help
55```
56
57## Symbol Format
58
59- **US stocks:** AAPL, MSFT, GOOGL, TSLA, NVDA
60- **China A-Shares:** sh000001 (上证指数), sz399001 (深证成指), sh600519 (茅台)
61- **Hong Kong:** hk00700 (腾讯), hk09988 (阿里), hk03690 (美团)
62- **Crypto:** BTC-USD, ETH-USD
63
64## Examples
65
66```bash
67# Quick price check
68tfin AAPL
69tfin TSLA
70
71# Detailed quote
72tfin quote NVDA
73
74# Compare tech giants
75tfin compare AAPL,MSFT,GOOGL,META,AMZN
76
77# Search
78tfin search "apple"
79tfin search "bitcoin"
80
81# China stocks
82tfin sh000001 # 上证指数
83tfin quote hk00700 # 腾讯控股
84```
85
86## Data Source
87
88This tool uses **Tencent Finance API** (腾讯财经 API).
89
90**Why Tencent API?**
91- 在中国大陆网络环境下可直接访问,无需代理
92- 比 Yahoo Finance API 更稳定,不受限流影响
93- 数据覆盖美股、A股、港股等多个市场
94
95Data includes:
96- Current price (实时价格)
97- Price change (absolute & percentage) (涨跌额/涨跌幅)
98- Open, High, Low prices (开盘/最高/最低价)
99- Previous close (昨收)
100- Volume (成交量)
101- Market cap (市值)
102- P/E ratio (市盈率)
103- P/B ratio (市净率)
104
105## Supported Markets
106
107| Market | Example | Status |
108|--------|---------|--------|
109| US Stocks | AAPL, TSLA, NVDA | ✅ Supported |
110| China A-Shares | sh000001, sz399001 | ✅ Supported |
111| Hong Kong | hk00700, hk09988 | ✅ Supported |
112| Crypto | BTC-USD, ETH-USD | ✅ Supported |
113| India NSE/BSE | RELIANCE.NS, TCS.BO | ❌ Not supported |
114
115## Comparison with Yahoo Finance
116
117| Feature | Yahoo Finance (yfinance) | Tencent Finance (tfin) |
118|---------|--------------------------|------------------------|
119| Mainland China Access | Often blocked/restricted | ✅ Direct access |
120| Rate Limiting | Frequent | ✅ Stable |
121| US Stocks | ✅ Supported | ✅ Supported |
122| China A-Shares | Limited | ✅ Full support |
123| Hong Kong Stocks | Supported | ✅ Supported |
124| Indian Stocks | ✅ Supported | ❌ Not supported |
125| Options/Dividends | Supported | ❌ Not supported |
126
127## Requirements
128
129- Python 3.7+
130- requests
131- rich
132
133```bash
134pip3 install requests rich
135```
136
137## Troubleshooting
138
139### "No data found"
140- Verify the symbol format
141- Try with prefix: `usAAPL` instead of `AAPL`
142- Some international markets may not be supported
143
144### Connection errors
145- Check internet connection
146- Tencent API is optimized for mainland China and generally very stable
147
148## License
149
150MIT License
151
152## Author
153
154Created by Menrfa