tushare
Tushare Pro 金融大数据平台 - 提供A股、指数、基金、期货、债券、宏观数据,Token认证方式访问。
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/coderwpf/tusharefreeTushare Pro(大数据开放社区)
Tushare Pro is a widely used financial data platform in China, serving over 300,000 users. It provides a standardized Python API covering A-shares, indices, funds, futures, bonds, and macro data. All interfaces return pandas.DataFrame.
⚠️ Token Required: Register at https://tushare.pro and obtain your personal Token from the User Center. Some interfaces require a higher credit level. See the Credit System section below.
安装
pip install tushare --upgrade
初始化与基本用法
import tushare as ts
# Set Token (only needs to be set once per session)
ts.set_token('your_token_here')
# Initialize the Pro API
pro = ts.pro_api()
# Call any data interface
df = pro.daily(ts_code='000001.SZ', start_date='20240101', end_date='20240630')
print(df)
You can also pass the Token directly during initialization:
# Initialize with Token directly
pro = ts.pro_api('your_token_here')
股票代码格式(ts_code)
- Shanghai:
600000.SH,601398.SH - Shenzhen:
000001.SZ,300750.SZ - Beijing:
430047.BJ - Indices:
000001.SH(SSE Composite Index),399001.SZ(SZSE Component Index)
沪深股票数据
股票列表
# Get basic information for all currently listed stocks
df = pro.stock_basic(
exchange='',
list_status='L', # L=Listed, D=Delisted, P=Suspended
fields='ts_code,symbol,name,area,industry,list_date'
)
Credit requirement: 120
日K线数据
# Get daily market data for a specified stock
df = pro.daily(
ts_code='000001.SZ',
start_date='20240101',
end_date='20240630'
)
# Returned fields: ts_code, trade_date, open, high, low, close, pre_close, change, pct_chg, vol, amount
Credit requirement: 120
周线/月线数据
# Get weekly data
df = pro.weekly(ts_code='000001.SZ', start_date='20240101', end_date='20240630')
# Get monthly data
df = pro.monthly(ts_code='000001.SZ', start_date='20240101', end_date='20240630')
分钟级K线数据
# Get minute-level K-line data
df = pro.stk_mins(
ts_code='000001.SZ',
freq='5min', # Options: 1min, 5min, 15min, 30min, 60min
start_date='2024-01-02 09:30:00',
end_date='2024-01-02 15:00:00'
)
Credit requirement: 2000+
复权因子
# Get adjustment factors for calculating forward/backward adjusted prices
df = pro.adj_factor(ts_code='000001.SZ', trade_date='20240102')
每日指标
# Get daily market indicator data (PE ratio, PB ratio, turnover rate, market cap, etc.)
df = pro.daily_basic(
ts_code='000001.SZ',
trade_date='20240102',
fields='ts_code,trade_date,turnover_rate,volume_ratio,pe,pe_ttm,pb,ps,ps_ttm,dv_ratio,dv_ttm,total_mv,circ_mv'
)
Credit requirement: 120
停复牌信息
# Get suspension & resumption info, S=Suspended
df = pro.suspend_d(ts_code='000001.SZ', suspend_type='S')
财务数据
利润表
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-coderwpf-tusharefree": {
"enabled": true,
"auto_update": true
}
}
}Related Skills
backtrader
Backtrader 开源量化回测框架 - 支持多数据源、多策略、多周期回测与实盘交易,纯Python实现。
pywencai
同花顺问财自然语言数据查询工具 - 使用中文自然语言查询A股、指数、基金、港美股、可转债等市场数据。
tqsdk
天勤量化TqSdk - 开源Python期货/期权交易SDK,提供实时行情、回测和实盘交易功能。
rqalpha
RQAlpha 米筐开源事件驱动回测框架 - 支持A股和期货,模块化架构,可自由扩展。
baostock
BaoStock 免费A股数据平台 - 支持K线、财务数据、行业分类查询,无需注册即可使用。