
tushare
PopularA Tushare data research skill for Chinese natural language queries. It converts requests like 'How's this stock doing lately?', 'Check financial trends', 'Which sector is strongest?', 'What are northbound funds buying?', or 'Export market data' into executable data retrieval, cleaning, comparison, filtering, export, and brief analysis workflows. Suitable for A-shares, indices, ETFs/funds, financials, valuations, money flows, announcements/news, sector/concept themes, and macro data research scenarios.
Related Skills
A Tushare data research skill for Chinese natural language queries. It converts requests like 'How's this stock doing lately?', 'Check financial trends', 'Which sector is strongest?', 'What are northbound funds buying?', or 'Export market data' into executable data retrieval, cleaning, comparison, filtering, export, and brief analysis workflows. Suitable for A-shares, indices, ETFs/funds, financials, valuations, money flows, announcements/news, sector/concept themes, and macro data research scenarios.
tushare
Converts natural language financial data requests into executable Tushare data workflows.
This is a natural language financial data research skill.
What this skill is for
Typical use cases:
- Check recent performance of a stock, index, or ETF
- Look up company fundamentals, valuation, financial trends
- Cross-compare multiple instruments
- Analyze money flows, northbound funds, top list, sector strength
- Review announcements, news, research reports, policy clues
- View macro data like CPI/PPI/PMI/social financing/interest rates
- Export CSV/parquet for further analysis or backtesting
- Generate concise research summaries instead of raw field tables
Understand the user's problem first, then select interfaces, fetch data, organize, explain, and deliver.
When to use
Use this skill when the user expresses the following intents:
Market / Trend
- How's XX doing lately?
- How much has XX risen over this period?
- How has it performed this year?
- Has volume picked up recently?
- Is this stock strong lately?
Financials / Valuation / Company Quality
- Check XX's financial reports
- Profit trend over recent quarters
- How's the financial quality?
- How's the cash flow?
- Is the valuation high now?
- Show me PE/PB/ROE/gross margin
Comparison / Ranking / Screening
- Which is stronger, XX or YY?
- Do a horizontal comparison for me
- Which companies have faster profit growth?
- Screen for high ROE and low debt
- Give me a top 10
Sector / Index / Theme
- Which sector is strongest lately?
- How's the semiconductor sector doing?
- Why is robotics up?
- What are the index constituents?
- Which themes are hottest?
Money Flow / Sentiment
- What are funds buying lately?
- Where are northbound funds flowing?
- Which sector is attracting the most capital?
- Who has the largest main capital inflow?
- Any highlights on the top list?
Announcements / News / Research / Policy
- Any recent announcements?
- Summarize XX's announcements for me
- Any catalysts recently?
- How's the news landscape?
- Any important policy changes?
Macro / Cross-Market
- How's the macro environment lately?
- How do CPI/PMI look?
- What's the current market style?
- Is the overall market bullish or bearish?
- How are Hong Kong/US stocks/Treasuries doing?
Data Export / Research Prep
- Export market data for me
- Pull daily data for the last two years into CSV
- Generate a backtest-ready data table
- Pull a research table for further analysis
What this skill is NOT for
This skill is not suitable for:
- Giving direct buy/sell advice or acting as an investment advisor
- Automated order placement or trade execution
- Millisecond-level real-time trading decisions
- Implementing complex backtesting engines or portfolio optimization systems (that's another engineering task)
- Fabricating data without proper Tushare permissions/credits
If data permissions are insufficient, interfaces are unavailable, or time ranges are unreasonable, clearly state the limitations—do not fabricate.
Natural-language trigger guide
Even if the user never says tushare, financials, or macro, trigger this skill as long as the intent matches the meanings below.
Common spoken triggers
- How's this stock doing lately?
- Give me a quick research on XX
- What's the status of that stock we talked about?
- Check the financial reports
- Which sector is strongest lately?
- What are northbound funds buying recently?
- Any catalyst news?
- Is this company worth a closer look?
- Pull some data for me
- Export to CSV
- Screen a batch of stocks for me
- Compare these companies
Chinese natural language priority
When the user speaks naturally, understand the task first—don't jump to interface names and field names.
Prioritize interpreting:
- "recently" as a reasonable time window
- "financial reports" as the last 8 quarters / latest fiscal year
- "strong" as price trend + relative strength + activity
- "fund attention" as net inflow, active trading, top list/northbound flows where available
If the task has multiple reasonable interpretations, ask for minimal clarification.
Environment check
Before actually requesting data, perform prerequisite checks:
- Check Python availability (3.7+)
- Check if
tusharepackage is installed - Check if
TUSHARE_TOKENexists - Optionally run a lightweight smoke test (e.g., trade calendar / basic interface)
- If the user requests a high-permission interface, warn about potential credit/permission limits
If the token is missing, directly suggest the shortest fix, e.g.:
export TUSHARE_TOKEN=your_token
Don't wait until the main query fails to reveal environment issues.
Intent taxonomy
Identify the task type first, then decide the interface combination.
1. Market / Trend
Typical questions:
- How's the recent trend?
- How much has it risen this year?
- Is volatility high recently?
- Has volume picked up?
Common interfaces:
dailypro_barweeklymonthlystk_minsrt_k/rt_min(if real-time is needed and permissions allow)daily_basic
2. Basic Info / Instrument Identification
Typical questions:
- What company/index/fund is this?
- Is it on ChiNext? Is it ST? When was it listed?
Common interfaces:
stock_basicfund_basicindex_basicstock_companystock_st/st
3. Financials / Company Quality
Typical questions:
- Profit trend over recent quarters
- Revenue and net profit trend over recent quarters
- How's the financial quality?
- How are ROE/gross margin/cash flow?
Common interfaces:
income(revenue/net profit trend preferred)fina_indicator(ROE/gross margin/net margin etc. as supplements)balancesheetcashflowforecastexpressdisclosure_date
4. Valuation / Fundamental Metrics
Typical questions:
- Is the valuation high now?
- Which is cheaper?
- How are PE/PB/dividend yield?
Common interfaces:
daily_basicfina_indicator
5. Money Flow / Market Behavior
Typical questions:
- What are northbound funds buying recently?
- Main capital flow direction
- Top list situation
Common interfaces:
moneyflowmoneyflow_hsgthsgt_top10top_listtop_instmoneyflow_ind_dcmoneyflow_mkt_dc
6. Sector / Index / Theme
Typical questions:
- Which sector is strongest lately?
- How is sector rotation?
- What are the constituents of a certain sector?
Common interfaces:
index_basicindex_dailyindex_classifyindex_member_allsw_dailyths_indexths_memberdc_indexdc_member
7. Limit-up / Sentiment / Activity
Typical questions:
- Today's limit-up tier structure
- Consecutive limit-up pattern
- Limit-up break rate / sentiment strength
Common interfaces:
limit_list_dlimit_stepkpl_listdc_hotths_hot
8. Announcements / News / Research / Policy
Typical questions:
- Any recent announcements or catalysts?
- Any recent research reports?
- What's happened on the policy front?
Common interfaces:
anns_dnewsmajor_newsresearch_reportnprirm_qa_shirm_qa_sz
9. Macro / Cross-Market
Typical questions:
- CPI/PMI/social financing/M2
- Interest rates and yield curves
- Hong Kong/US stock/Treasury data
Common interfaces:
cn_cpicn_ppicn_pmicn_gdpcn_msf_monthshiborshibor_lprus_tycrus_dailyhk_dailyindex_global
10. Export / Research Prep
Typical questions:
- Export market data for a certain instrument over a period
- Generate a backtest data table
- Output CSV/parquet
Common interfaces:
- Depends on the upstream task; core is unified output rules and naming conventions
Entity resolution rules
Instrument resolution
- Prioritize identifying stock names, stock codes, index names, ETF names, fund names
- For Chinese abbreviations, first try to match standard objects
- If ambiguous or multiple matches, list candidates and ask for minimal clarification
- Standardize securities codes internally, e.g.,
600519.SH,000001.SZ
Market identification
- Default to A-shares unless the user explicitly mentions Hong Kong/US stocks, funds, bonds, or futures
- Distinguish between indices, ETFs, and individual stocks; do not mix interfaces
Time defaults
If the user does not specify a time range, use reasonable defaults:
- "Recent trend" → default last 20 trading days
- "This period / recently" → default last 3 months
- "Financial reports / earnings" → default last 8 quarters + latest fiscal year
- "How's money flow recently" → default last 5–20 trading days, adjust by task granularity
- "How's macro recently" → default last 6–12 periods
Sector classification defaults
If the user only says "sector/industry/concept" without specifying a classification system:
- For industries, prefer stable systems like Shenwan/CITIC
- For concepts, prefer Tonghuashun/East Money theme classifications
- If conclusions depend on specific classification differences, clearly state which classification was used
Input normalization rules
Normalize before requesting data:
- Unify dates to
YYYYMMDD - Check
start_date <= end_date - If the user inputs a future date, automatically clip to the latest available date and notify
- For bare codes like
000001, do not guess blindly; if you can complete, explain the completion rule; otherwise, clarify - For conflicting parameters (e.g., both
trade_dateandstart_date/end_date), resolve first—do not pass them incorrectly
Data retrieval rules
Documentation first
Before writing request code, confirm:
- Correct interface name
- Required parameters
- Optional parameters
- Return fields
- Credit/frequency limits
Do not hardcode field names from memory alone.
Field confirmation
For the fields parameter, prefer using a known field whitelist or confirm via interface documentation.
If the user requests a non-existent field, clearly state that—do not blindly query.
Default segmented fetching
Do not fetch all data for a long range at once.
Recommendations:
- Daily/weekly/monthly: slice by year or quarter
- Financials: slice by year/report period
- Minute data: slice by month/week
- Large batch of multiple instruments: batch by instrument + date segmentation
Retry and rate limiting
- Only retry on transient errors (network jitter, timeout, 429)
- Do not blindly retry on parameter errors, permission issues, or field errors
- Add throttling during batch fetching to avoid hitting rate limits
Merge segments
After segmented fetching:
- Merge
- Deduplicate
- Sort by primary key
- Record failed segments
- If partially successful, clearly tell the user which segments failed
Output contract
Unless the user explicitly wants only raw tables, prefer this structure:
- One-sentence conclusion
- Data range and scope
- Key metrics / key tables
- Anomalies / risks / limitations
- If local output, provide file path
Delivery format
Choose based on task complexity:
- Small results: Markdown summary + short table
- Medium data table: CSV
- Large scale / further analysis: Parquet
- Reusable workflow: attach Python script
- When visualization is needed: output chart PNG or describe what can be plotted
Metadata
When generating data files, also record where possible:
- Interface name
- Request parameters
- Fetch time
- Number of rows
- Field list
- Whether any failed segments / missing data exist
Workflow templates
These templates are the core of this skill.
Do not start from interfaces; start from task templates.
1. Single instrument market analysis
Applicable:
- How's XX doing lately?
- Is this stock strong recently?
- How has it performed this year?
Default workflow:
- Resolve instrument
- Determine time range
- Fetch market data + necessary basic metrics
- Summarize range change, trading activity, highs/lows, volatility
- Output one-sentence conclusion + key numbers
2. Multi-instrument horizontal comparison
Applicable:
- Which is stronger, XX or YY?
- Compare these companies
Default workflow:
- Lock targets
- Unify time scope
- Select 3–5 key metrics
- Output comparison table
- Summarize "who is stronger in what aspect"
3. Financial quality snapshot
Applicable:
- Check XX's financial reports
- Profit trend over recent quarters
- How's the financial quality?
Default workflow:
- Fetch core financial data for last 8 quarters + latest fiscal year
- Distinguish revenue, profit, gross margin, ROE, cash flow
- Highlight improvement/deterioration/volatility points
- Explain cumulative, single-quarter, YoY scopes
4. Valuation analysis / screening
Applicable:
- Is the valuation high now?
- Which is cheaper?
- Screen for low valuation high dividend
Default workflow:
- Clarify target pool
- Fetch
daily_basicand other valuation metrics - Cross-reference with financial quality if needed
- Output ranking, extremes, scope explanation
5. Money flow tracking
Applicable:
- What are funds buying lately?
- Where are northbound funds flowing?
- Who has the largest main capital inflow?
Default workflow:
- Clarify money flow scope (northbound/main capital/top list/sector flow)
- Determine time window
- Fetch net inflow / active trading / persistence
- Cross-reference with price performance
- Avoid calling single-day noise a trend
6. Sector/theme rotation analysis
Applicable:
- Which sector is strongest lately?
- Why is robotics strong?
- What are the constituents of a certain concept sector?
Default workflow:
- Determine classification scope
- Fetch sector interval performance
- Cross-reference with constituents, money flow, limit-up tiers if needed
- Output strong sector rankings and representative instruments
7. Announcement/news/event review
Applicable:
- Any recent announcements?
- Any catalysts?
- How's the news landscape?
Default workflow:
- Clarify target and time window
- Fetch announcement/news/research/policy data
- Denoise, extract 3–5 main threads
- Distinguish facts, announcements, media interpretations
- If needed, provide weak causal explanation with price anomalies
8. Data export and research prep
Applicable:
- Pull a CSV
- Make a backtest data table
- Export market/financial data for a period
Default workflow:
- Clarify data range, frequency, fields
- Use segmented strategy to fetch
- Clean, deduplicate, unify field types
- Output CSV/parquet
- Provide file path and metadata
9. Comprehensive research brief
Applicable:
- Give me a quick research on XX
- Make an investor perspective brief
- Give a panoramic view first
Default workflow:
- One-sentence conclusion
- Market performance
- Financial trends
- Valuation level
- Money flow situation
- Announcement/news catalysts
- Risk points
- Questions worth further exploration
Data quality rules
After fetching, at least perform these checks:
- Schema validation
- Key field existence check
- Primary key deduplication
- Fixed sorting
- Date standardization
- Numeric field type normalization
Empty result handling
An empty table is not necessarily a failure; distinguish:
- Non-trading day
- No data in range
- Stock not yet listed
- Parameter error
- Insufficient interface permissions
Do not say "interface broken" for all empty results.
Cache and reuse rules
To make the skill reusable long-term, prefer:
- Caching base tables (e.g.,
stock_basic, trade calendar, index basic info) - Incremental updates instead of full reloads each time
- Checkpoint resume for large tasks
- Standardized result file naming
Recommended naming format:
daily_600519.SH_20230101_20231231_20260322.csvfina_indicator_300750.SZ_20260322.parquet
When cache is hit, indicate which data is from cache and which is newly fetched.
Error handling
Prefer outputting errors in "human language + debug details" layered format.
User-visible layer
- Token not configured
- This interface may require higher credits/permissions
- Time range too large, automatically switched to segmented fetching
- Stock name not unique, please confirm which one
- Current result is empty, possibly due to non-trading day / instrument not listed / no permission
Debug layer
If needed, supplement:
- Interface name
- Parameters
- Failed segments
- Original exception
Partial success principle
If some segments fail, do not say "completed successfully."
Clearly state:
- Which parts succeeded
- Which parts failed
- Whether an incomplete result has been generated
Recommended minimal interface set
Do not cram hundreds of interfaces into the main skill body.
Prioritize remembering the core interface set for 80% of common tasks:
stock_basictrade_caldailypro_bardaily_basicfina_indicatorincomebalancesheetcashflowforecastexpressmoneyflowmoneyflow_hsgthsgt_top10top_listindex_basicindex_dailyindex_classifysw_dailyths_indexths_memberlimit_list_dlimit_stepnewsmajor_newsresearch_reportanns_dcn_cpicn_pmius_tycr
For all data interfaces, refer to references/数据接口.md.
Best practices
- Understand the task first, then select interfaces
- Fetch as little as possible—core data first, then expand
- Give conclusions first, then evidence
- Default to human language, don't pile up field names
- For vague Chinese expressions like "recently / financial reports / strong / fund attention", have reasonable default scopes
- For large tasks, give an execution plan first, then start
- For export tasks, try to keep scripts, metadata, and file paths for reusability
Examples
Single stock market
- Check CATL's trend over the last three months
- How much has Moutai risen this year?
- What's the maximum drawdown for CMB in the last two years?
Financials / Valuation
- Check BYD's revenue and net profit trend over the last 8 quarters
- Is Moutai's valuation high now?
- Find companies with high ROE and low debt
Comparison
- Compare the one-year returns and valuations of Moutai, Wuliangye, and Luzhou Laojiao
- Compare the performance of CSI 300, CSI 500, and ChiNext this year
Money flow / Sector
- Which stocks have the highest northbound net inflow today?
- Which sector is strongest lately?
- Has the semiconductor sector been strong in the last month?
Announcements / Events
- Summarize Cambricon's important recent announcements
- Any news catalysts for the robotics sector recently?
Macro
- Check recent changes in CPI, PPI, PMI
- Is the current market style growth or value?
Export
- Export daily data for CSI 300 constituents over the last two years to CSV
- Download CATL's adjusted market data from 2020 to now
- Pull a table of ROE, PE, PB, and revenue growth for the last 3 years
Quick rule
When the user says:
- Check trend
- Look up financials
- Compare companies
- Check sector
- Check money flow
- Review announcements/news
- Check macro
- Pull data for export
Don't first think "which interfaces."
First think:
What task is this? What data workflow should be used by default? How should the result be delivered to be truly useful?





