SuperAPI AI Directory

tushare-finance

Data & analytics

View repository

Updated 10-15 23:39

About this skill

Tushare Financial Data Skill

This skill retrieves Chinese financial market data via the Tushare Pro API, supporting 220+ data interfaces.

Quick Start

1. Token Configuration

Ask the user: Have you configured a Tushare Token?

If not configured, guide the user:

  1. Visit https://tushare.pro to register
  2. Get Token
  3. Configure environment variables:export TUSHARE_TOKEN="your_token"

2. Verify dependencies

Check the Python environment:

python -c "import tushare, pandas; print('OK')"

If an error occurs, install dependencies:

pip install tushare pandas

Common Interfaces Quick Reference

Data Type Interface Method Description
Stock list pro.stock_basic() Get all stock lists
Daily quotes pro.daily() Get daily quote data
Financial indicators pro.fina_indicator() Financial indicators (ROE, etc.)
Income statement pro.income() Income statement data
Index quotes pro.index_daily() Index daily data
Fund net value pro.fund_nav() Fund net value data
GDP data pro.gdp() Gross domestic product
CPI data pro.cpi() Consumer price index

Complete interface list: See Interface Documentation Index

Data Retrieval Process

  1. Find interface: According to requirements, in Interface Index find the corresponding interface
  2. Read documentation: See reference/接口文档/[接口名].md to learn about parameters
  3. Write code:
    import tushare as ts
    
    # 初始化(使用环境变量中的 Token)
    pro = ts.pro_api()
    
    # 调用接口
    df = pro.daily(ts_code='000001.SZ', start_date='20241201', end_date='20241231')
    
  4. Return result: DataFrame format

Parameter Format Description

  • Date: YYYYMMDD (e.g., 20241231)
  • Stock code: ts_code format (e.g., 000001.SZ, 600000.SH)
  • Return format:pandas DataFrame

Interface Documentation Reference

Interface Index:reference/README.md

Interface documentation is organized by category:

  • Stock data (39 interfaces)
  • Index data (18 interfaces)
  • Fund data (11 interfaces)
  • Futures and options (16 interfaces)
  • Macroeconomics (10 interfaces)
  • Hong Kong and US stocks (23 interfaces)
  • Bond data (16 interfaces)

Reference Resources