tushare-data
Convert natural language financial data requests into executable Tushare data workflows.
This is a natural language-oriented financial data research skill.
What this skill is for
Typical scenarios for using this skill:
- Check the recent performance of a specific stock, index, or ETF
- Look up a company's basic information, valuation, and financial trends
- Conduct horizontal comparisons of multiple target assets
- Track capital flows, northbound funds, Dragon & Tiger List, and sector strength
- Organize announcements, news, research reports, and policy clues
- View macroeconomic data such as CPI / PPI / PMI / social financing / interest rates
- Export data to CSV / parquet for subsequent analysis or backtesting
- Generate concise research summaries instead of just raw field tables
First understand the problem the user wants to solve, then select interfaces, retrieve data, organize, explain, and deliver results.
When to use
Prioritize using this skill when users express the following intents:
Market Trends / Performance
- How has XX been doing lately?
- How has XX performed during this period?
- How has it performed since the beginning of the year?
- Has there been a recent volume surge?
- Is this stock performing strongly lately?
Finance / Valuation / Company Quality
- Check XX's financial report
- Profit trends in recent quarters
- How is the financial quality?
- Is the cash flow healthy?
- Is the current valuation high?
- Help me check PE / PB / ROE / gross profit margin
Comparison / Ranking / Screening
- Which is stronger, XX or YY?
- Help me make a horizontal comparison
- Which companies have faster profit growth?
- Help me screen for companies with high ROE and low debt
- Give me a top 10 ranking
Sectors / Indices / Themes
- Which sector is the strongest recently?
- How has the semiconductor sector been performing lately?
- Why are robot stocks rising?
- What are the components of this index?
- Which themes are the hottest right now?
Capital Flows / Market Sentiment
- What are funds buying recently?
- Where are northbound funds flowing lately?
- Which sector is attracting the most capital?
- Which stocks have the largest main capital inflows?
- What are the key points from the Dragon & Tiger List?
Announcements / News / Research Reports / Policies
- What announcements have been released recently?
- Help me organize XX's announcements
- Are there any catalytic events lately?
- How is the news sentiment recently?
- What important policies have been issued lately?
Macroeconomics / Cross-Market
- How is the recent macroeconomic environment?
- What's the outlook for recent CPI / PMI?
- What's the current market style leaning towards?
- Is the broader market bullish or bearish?
- How have Hong Kong stocks / US stocks / US bonds been performing lately?
Data Export / Research Preparation
- Export a market data report for me
- Pull the daily data of the past two years into a CSV
- Generate a data table for backtesting
- Create a research table for subsequent analysis
What this skill is NOT for
This skill is NOT suitable for:
- Providing direct trading advice or replacing investment advisors
- Automatic order placement or trade execution
- Scenarios requiring millisecond-level real-time trading decisions
- Implementing complex backtesting engines or portfolio optimization systems (that's a separate project)
- Forcing fake data when there's no Tushare permission/point support
If data permissions are insufficient, interfaces are unavailable, or time ranges are unreasonable, clearly state the limitations instead of fabricating data.
Natural-language trigger guide
Even if users never mention terms like
,
, or
, this skill should be triggered as long as their intent matches the following meanings.
Common spoken triggers
- How has this stock been performing lately?
- Give me a quick analysis of XX
- How is that stock we talked about last time doing now?
- Help me check the financial report
- Which sector is the strongest recently?
- What are northbound funds buying lately?
- Are there any catalytic events?
- Is this company worth focusing on?
- Pull some data for me
- Export to CSV
- Help me screen a batch of stocks
- Compare these companies for me
Chinese natural language priority principle
When users speak in plain language, first understand the task, don't jump to interface names and field names first.
Prioritize interpreting:
- "Recently" as a reasonable time window
- "Financial report" as the latest 8 quarters / latest annual report
- "Strong or not" as performance + relative strength + activity
- "Capital attention" as net inflow, active trading, available calibers like Dragon & Tiger List / northbound funds
If there are multiple reasonable interpretations for a task, make minimal clarifications.
Environment check
Before requesting data, perform pre-checks:
- Check if Python is available, version requirement: 3.7+
- Check if the package is installed
- Check if exists, or run the Python script
import tushare as ts; print(ts.get_token())
to check local configuration
- Perform a lightweight interface smoke test if necessary (e.g., trading calendar / basic interface)
- If the user requests a high-permission interface, remind them in advance of possible point/permission limitations
If the token is missing, directly provide the shortest fix path, for example:
bash
export TUSHARE_TOKEN=your_token
Don't wait until the main query fails to expose environment issues.
Intent taxonomy
First identify the task type, then determine the interface combination.
1. Market Trends / Performance
Typical questions:
- How has the performance been lately?
- How much has it risen this year?
- Has there been high volatility recently?
- Has there been a volume surge lately?
Common interfaces:
- / (only if real-time caliber is required and permitted)
2. Basic Information / Target Resolution
Typical questions:
- What company / index / fund is this?
- Is it a ChiNext stock / ST stock? When was it listed?
Common interfaces:
3. Finance / Company Quality
Typical questions:
- Profit trends in recent quarters
- Revenue and net profit trends in recent quarters
- How is the financial quality?
- How are ROE / gross profit margin / cash flow?
Common interfaces:
- (priority for revenue / net profit trends)
- (supplementary for quality indicators like ROE / gross profit margin / net profit margin)
4. Valuation / Fundamental Indicators
Typical questions:
- Is the current valuation high?
- Which is cheaper?
- How are PE / PB / dividend yield?
Common interfaces:
5. Capital Flows / Market Behavior
Typical questions:
- What are northbound funds buying lately?
- Main capital flow directions
- Dragon & Tiger List status
Common interfaces:
6. Sectors / Indices / Themes
Typical questions:
- Which sector is the strongest recently?
- How is sector rotation?
- What are the components of this sector?
Common interfaces:
7. Price Limit / Sentiment / Activity
Typical questions:
- Today's price limit ladder
- Continuous price limit structure
- Price limit failure rate / sentiment strength
Common interfaces:
8. Announcements / News / Research Reports / Policies
Typical questions:
- Are there any recent announcements or catalytic events?
- What research reports have been released lately?
- What policy changes have occurred recently?
Common interfaces:
9. Macroeconomics / Cross-Market
Typical questions:
- CPI / PMI / social financing / M2
- Interest rates and yield curves
- Hong Kong stock / US stock / US bond data
Common interfaces:
10. Export / Research Preparation
Typical questions:
- Export market data for a target over a period
- Generate a data table for backtesting
- Output to CSV / parquet
Common interfaces:
- Depends on upstream tasks, core is unified output rules and naming conventions
Entity resolution rules
Target Resolution
- Prioritize identifying stock names, stock codes, index names, ETF names, fund names
- First try to match standard objects with Chinese abbreviations
- If there are duplicate names or multiple interpretations, list candidates and make minimal clarifications
- Unify securities codes into standard formats, e.g.: ,
Market Identification
- Default to A-shares unless the user explicitly mentions Hong Kong stocks / US stocks / funds / bonds / futures
- Distinguish between indices, ETFs, and individual stocks, do not mix interfaces
Default Time Values
If the user does not specify a time range, use reasonable defaults:
- "Recent performance" → default to the last 20 trading days
- "This period / recent period" → default to the last 3 months
- "Financial report / performance" → default to the latest 8 quarters + latest annual report
- "Recent capital flows" → default to 5~20 trading days, adjusted based on task granularity
- "Recent macroeconomics" → default to the latest 6~12 periods
Default Sector Caliber
If the user only mentions "sector / industry / concept" without specifying a classification system:
- Prioritize stable calibers like Shenwan / CITIC for industries
- Prioritize theme calibers like Tonghuashun / East Money for concepts
- If conclusions depend on specific caliber differences, clearly state which classification is used
Input normalization rules
Normalize inputs before requesting data:
- Unify dates into format
- Check that
- If the user inputs a future date, automatically adjust to the latest available date and notify the user
- Do not guess bare codes like ; if it can be completed, explain the completion rule; if not, ask for clarification
- Resolve conflicting parameters (e.g., and provided simultaneously) before sending requests
Data retrieval rules
Documentation First
Before writing request code, confirm:
- Correct interface name
- Required parameters
- Optional parameters
- Returned fields
- Point / frequency limits
Do not write field names based on memory alone.
Field Confirmation
For the
parameter, prioritize using known field whitelists or interface documentation for confirmation.
If the user requests a non-existent field, clearly state this instead of blindly querying.
Default Segment Retrieval
Do not retrieve long-range data all at once.
Recommendations:
- Daily / weekly / monthly data: slice by year or quarter
- Financial reports: slice by year / reporting period
- Minute-level data: slice by month / week
- Large batches of multiple targets: batch by target + slice by date
Retry & Rate Limiting
- Only perform limited retries for transient errors (network jitter, timeouts, 429)
- Do not blindly retry for parameter errors, insufficient permissions, or field errors
- Add throttling during batch retrieval to avoid hitting rate limits due to high frequency
Segment Merging
After segment retrieval:
- Merge data
- Remove duplicates
- Sort by primary key
- Record failed segments
- If partially successful, clearly tell the user which segments failed
Output contract
Unless the user explicitly requests only raw tables, prioritize outputting in this structure:
- One-sentence conclusion
- Data scope & caliber
- Key indicators / key tables
- Anomalies / risk points / interpretation limitations
- If there's local output, provide the file path
Result Delivery Format
Choose based on task complexity:
- Small results: Markdown summary + short table
- Medium data tables: CSV
- Large-scale / subsequent analysis: Parquet
- Reusable workflows: Attach Python script
- Visualization needed: Output chart PNG or explain that charts can be generated
Metadata
When generating data files, try to record:
- Interface name
- Request parameters
- Retrieval time
- Number of data rows
- Field list
- Whether there are failed segments / missing data
Workflow templates
These templates are the core of this skill.
Don't start with interfaces, start with task templates.
1. Single Target Market Analysis
Applicable to:
- How has XX been performing lately?
- Is this stock performing strongly lately?
- How has it performed since the beginning of the year?
Default workflow:
- Resolve the target
- Determine the time range
- Retrieve market data + necessary basic indicators
- Summarize interval price changes, trading activity, highs & lows, volatility
- Output a one-sentence conclusion + key figures
2. Multi-Target Horizontal Comparison
Applicable to:
- Which is stronger, XX or YY?
- Compare these companies for me
Default workflow:
- Lock the targets
- Unify the time caliber
- Select 3~5 key indicators
- Output a comparison table
- Provide a summary of "who is stronger in which aspects"
3. Financial Quality Snapshot
Applicable to:
- Check XX's financial report
- Profit trends in recent quarters
- How is the financial quality?
Default workflow:
- Retrieve core financial data for the latest 8 quarters + latest annual report
- Distinguish between revenue, profit, gross profit margin, ROE, cash flow
- Mark improvement / deterioration / volatility points
- Explain cumulative values, single-quarter values, year-over-year calibers
4. Valuation Analysis / Screening
Applicable to:
- Is the current valuation high?
- Which is cheaper?
- Screen for low valuation and high dividend yield
Default workflow:
- Clarify the target pool
- Retrieve valuation indicators like
- Link with financial quality if necessary
- Output rankings, extreme values, and caliber explanations
5. Capital Flow Tracking
Applicable to:
- What are funds buying recently?
- Where are northbound funds flowing lately?
- Which stocks have the largest main capital inflows?
Default workflow:
- Clarify the capital caliber (northbound / main / Dragon & Tiger List / sector capital)
- Determine the time window
- Retrieve net inflow / active trading / sustainability
- Link with price performance for interpretation
- Avoid treating single-day noise as a trend
6. Sector / Theme Rotation Analysis
Applicable to:
- Which sector is the strongest recently?
- Why are robot stocks performing strongly?
- What are the components of this concept sector?
Default workflow:
- Determine the classification caliber
- Retrieve sector interval performance
- Link with components, capital flows, price limit ladder if necessary
- Output rankings of strong sectors and representative targets
7. Announcement / News / Event Organization
Applicable to:
- What announcements have been released recently?
- Are there any catalytic events?
- How is the news sentiment lately?
Default workflow:
- Clarify the target and time window
- Retrieve announcement / news / research report / policy data
- Remove noise and extract 3~5 main themes
- Distinguish between facts, announcements, and media interpretations
- Combine with stock price fluctuations for weak causal interpretation if necessary
8. Data Export & Research Preparation
Applicable to:
- Pull a CSV report
- Create a backtesting data table
- Export market/financial data for a specific period
Default workflow:
- Clarify data scope, frequency, and fields
- Use a segment retrieval strategy
- Clean, deduplicate, and unify field types
- Output to CSV / parquet
- Provide the file path and metadata
9. Comprehensive Research Brief
Applicable to:
- Give me a quick analysis of XX
- Create an investor perspective brief
- Give a panoramic judgment first
Default workflow:
- One-sentence conclusion
- Market performance
- Financial trends
- Valuation level
- Capital flow situation
- Announcement / news catalysts
- Risk points
- Issues worth further exploration
Data quality rules
After retrieval, perform at least 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 doesn't always mean failure; distinguish between:
- Non-trading day
- No data in the interval
- Stock not listed yet
- Parameter error
- Insufficient interface permissions
Don't claim "the interface is broken" for all empty results.
Cache and reuse rules
To make the skill reusable long-term, prioritize supporting:
- Basic table caching (e.g., , trading calendar, index basic information)
- Incremental updates instead of full re-retrieval every time
- Breakpoint resumption for large tasks
- Standardized naming of result files
Recommended naming format:
daily_600519.SH_20230101_20231231_20260322.csv
fina_indicator_300750.SZ_20260322.parquet
When cache is hit, it's best to explain which data comes from cache and which is newly retrieved.
Error handling
Prioritize outputting errors in a "plain language + layered debugging details" format.
User-Visible Layer
- Token not configured
- Current interface may require higher points/permissions
- Time range is too large, automatically adjusted to segment retrieval
- Stock name is not unique, please confirm which one it is
- Current result is empty, possibly due to non-trading day / target not listed / insufficient permissions
Debug Layer
Supplement if necessary:
- Interface name
- Parameters
- Failed segments
- Original exception text
Partial Success Principle
If some segments fail, don't say "completed successfully".
Clearly state:
- Which parts succeeded
- Which parts failed
- Whether an incomplete result has been generated
Recommended minimal interface set
Don't stuff hundreds of interfaces into the main skill.
Prioritize remembering the core interface set for 80% of common tasks:
For all data interfaces, refer to
.
Best practices
- First understand the task, then select interfaces
- Retrieve only necessary data, start with core data then expand
- Provide conclusions first, then evidence
- Default to plain language, don't stack field names
- Have reasonable default calibers for vague Chinese expressions like "recently / financial report / strong or not / capital attention"
- For large tasks, provide an execution plan first before starting
- For export tasks, try to retain scripts, metadata, and file paths for easy reuse
Examples
Single Stock Market Analysis
- Check the performance of CATL in the past three months
- How much has Moutai risen since the beginning of the year?
- What's the maximum drawdown of China Merchants Bank in the past two years?
Finance / Valuation
- Check the revenue and net profit trends of BYD in the latest 8 quarters
- Is Moutai's current valuation high?
- Help me find companies with high ROE and low debt
Comparison
- Compare the annual gains and valuations of Moutai, Wuliangye, and Luzhou Laojiao
- Compare the performance of CSI 300, CSI 500, and ChiNext this year
Capital Flows / Sectors
- Which stocks have the largest northbound fund inflows today?
- Which sector is the strongest recently?
- How has the semiconductor sector been performing in the past month?
Announcements / Events
- Help me organize important recent announcements of Cambricon
- What news catalysts are there for the robot sector lately?
Macroeconomics
- Check the recent changes in CPI, PPI, and PMI
- Is the current market style leaning towards growth or value?
Export
- Export the daily data of CSI 300 components in the past two years to CSV
- Download the adjusted market data of CATL from 2020 to now
- Pull a table of ROE, PE, PB, and revenue growth rate for the past 3 years
Quick rule
When the user is saying:
- Check performance trends
- Look up financial reports
- Compare companies
- Analyze sectors
- Track capital flows
- Organize announcements & news
- Analyze macroeconomics
- Pull and export data
Don't first think "what interfaces are there".
First think:
What task is this? Which data workflow should be followed by default? How should the results be delivered to be truly useful?