Turn 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:
- Look at the recent trend of a stock, index, or ETF
- Check company basic information, valuation, and financial trends
- Do horizontal comparison of multiple targets
- Look at capital flows, northbound capital, dragon-tiger list, and sector strength
- Sort out announcements, news, research reports, and policy clues
- View macroeconomic data such as CPI / PPI / PMI / social financing / interest rates
- Export CSV / parquet for subsequent analysis or backtesting
- Generate a concise research summary instead of only outputting raw field tables
First understand what problem the user wants to solve, then choose interfaces, retrieve data, organize, explain, and deliver.
When to use
When the user expresses the following intentions, prioritize using this skill:
Market / trend
- See how XX has been doing recently
- How much has XX risen during this period
- How has performance been so far this year
- Has there been any volume increase recently
- Has this stock been strong recently
Financials / valuation / company quality
- Check XX's financial report
- Profit trend over recent quarters
- How is the financial quality
- Is cash flow good
- Is the current valuation considered high
- Help me look at PE / PB / ROE / gross margin
Comparison / ranking / screening
- Who is stronger, XX or YY
- Help me compare them horizontally
- Which companies have faster profit growth
- Help me screen for high ROE and low debt
- Give me a top ten ranking
Sectors / indices / themes
- Which sector has been strongest recently
- How have semiconductors been recently
- Why are robotics stocks rising
- What are the constituent stocks of the index
- Which themes are hottest
Capital flows / sentiment
- What has capital been buying recently
- Where has northbound capital been flowing recently
- Which sector is attracting the most capital
- Who has the largest main capital inflow
- What are the highlights on the dragon-tiger list
Announcements / news / research reports / policy
- What announcements have there been recently
- Help me sort out XX's announcements
- Have there been any catalysts recently
- How has the news side been recently
- What important policies have there been recently
Macro / cross-market
- How has the macroeconomic environment been recently
- How should we view CPI / PMI recently
- What is the current market style leaning toward
- Is the overall market environment bullish or bearish
- How have Hong Kong stocks / US stocks / US Treasuries been recently
Data export / research preparation
- Export a market data file for me
- Pull the past two years of daily bars into CSV
- Generate a backtestable data table
- Pull a research table for subsequent analysis
What this skill is NOT for
This skill is not suitable for:
- Directly give buy/sell advice or act as an investment advisor substitute
- Automatically place orders or execute trades
- Scenarios requiring millisecond-level real-time trading decisions
- The implementation of complex backtesting engines and portfolio optimization systems themselves (that is another engineering project)
- Forcibly fabricating data without Tushare permission/points support
If data permissions are insufficient, the interface is unavailable, or the time range is unreasonable, clearly state the limitations; do not hard-code.
Natural-language trigger guide
Even if the user does not say tushare、financials、macro these terms at all, as long as the intent matches the following meanings, this skill should also be triggered.
Common colloquial triggers
- See how this stock has been doing recently
- Give me a quick study of XX
- What is the situation now with that stock mentioned last time
- Help me look at the financial report
- Which sector has been strongest recently
- What has northbound been buying recently
- What catalytic news is there
- Is this company worth focusing on
- Pull a dataset for me
- Export to CSV
- Help me screen a batch of stocks
- Compare these companies
Chinese natural language priority principle
When the user speaks plainly, first understand the task; do not first fall back to interface names and field names. Prioritize interpreting:
- "recently" as a reasonable time window
- "financial report" as the most recent 8 quarters / most recent fiscal year
- "strong or not" as trend + relative strength + activity
- "capital attention" as net inflow, active trading, Dragon-Tiger List/northbound and other available measures
If the task has multiple reasonable interpretations, then do minimal clarification.
Environment check
Before actually requesting data, do pre-checks first:
- Check whether Python is available, version requirement 3.7+
- Check whether the
tusharepackage is installed· - Check whether
TUSHARE_TOKENandTUSHARE_PROXY_URLexist. - When necessary, do a lightweight interface smoke test (such as trading calendar / basic interfaces)
- If the user requests a high-permission interface, warn in advance that there may be points/permission limits
If the token is missing, directly indicate the shortest repair path, for example:
export TUSHARE_TOKEN=your_token
export TUSHARE_PROXY_URL=https://your-proxy-host/dataapi
After initializing pro , add the setting:
pro._DataApi__http_url = os.getenv("TUSHARE_PROXY_URL", "")
Do not wait until the main query fails before exposing environment problems.
Intent taxonomy
First identify the task type, then decide the interface combination.
1. Market data / trend
Typical questions:
- How has the trend been recently
- How much has it risen this year
- Has volatility been high recently
- Has there been any volume surge recently
Commonly used interfaces:
dailypro_barweeklymonthlystk_minsrt_k/rt_min(if a real-time measure is truly needed and permissions allow)daily_basic
2. Basic information / instrument identification
Typical questions:
- What company / what index / what fund is this
- Is it on ChiNext / is it ST / when did it list
Commonly used interfaces:
stock_basicfund_basicindex_basicstock_companystock_st/st
3. Financials / company quality
Typical questions:
- Profit trend over the last few quarters
- Revenue and net profit trend over the last few quarters
- How is the financial quality
- How are ROE / gross margin / cash flow
Commonly used interfaces:
income(revenue / net profit trend takes priority)fina_indicator(Supplementary quality indicators such as ROE / gross margin / net margin)balancesheetcashflowforecastexpressdisclosure_date
4. Valuation / fundamental indicators
Typical questions:
- Is the current valuation high
- Which is cheaper
- What are the PE / PB / dividend yield
Commonly used interfaces:
daily_basicfina_indicator
5. Capital flows / market behavior
Typical questions:
- What has northbound been buying recently
- Main capital flow direction
- Dragon-Tiger List situation
Commonly used interfaces:
moneyflowmoneyflow_hsgthsgt_top10top_listtop_instmoneyflow_ind_dcmoneyflow_mkt_dc
6. Sectors / indices / themes
Typical questions:
- Which sector has been strongest recently
- How is industry rotation
- What constituent stocks does a certain sector have
Commonly used interfaces:
index_basicindex_dailyindex_classifyindex_member_allsw_dailyths_indexths_memberdc_indexdc_member
7. Limit-up trading / sentiment / activity
Typical questions:
- Today's limit-up ladder
- Consecutive limit-up structure
- Failed limit-up rate / sentiment strength
Commonly used interfaces:
limit_list_dlimit_stepkpl_listdc_hotths_hot
8. Announcements / news / research reports / policy
Typical questions:
- What announcements or catalysts have there been recently
- What research reports have there been recently
- What has happened recently on the policy front
Commonly used interfaces:
anns_dnewsmajor_newsresearch_reportnprirm_qa_shirm_qa_sz
9. Macro / cross-market
Typical questions:
- CPI / PMI / social financing / M2
- Interest rates and yield curve
- Hong Kong stocks / US stocks / US Treasury data
Commonly used interfaces:
cn_cpicn_ppicn_pmicn_gdpcn_msf_monthshiborshibor_lprus_tycrus_dailyhk_dailyindex_global
10. Export / research preparation
Typical questions:
- Export the market data of a certain security over a period of time
- Generate a data table for backtesting
- Output CSV / parquet
Commonly used interfaces:
- Depends on the upstream task; the core is unified output rules and naming conventions
Entity resolution rules
Security resolution
- Prioritize identifying stock names, stock codes, index names, ETF names, and fund names
- For Chinese abbreviations, first try to match standard objects
- If there are duplicate names or multiple interpretations, list the candidates and make minimal clarification
- Securities codes are internally unified into a standard format, such as:
600519.SH、000001.SZ
Market identification
- By default, understand it as A-shares first, unless the user explicitly mentions Hong Kong stocks / US stocks / funds / bonds / futures
- Indices, ETFs, and individual stocks should be judged separately; do not mix interfaces
Default time values
If the user does not explicitly give a time range, use reasonable defaults:
- "Recent trend" → defaults to the last 20 trading days
- "This period / recent period" → defaults to the last 3 months
- "Financial report / performance" → defaults to the last 8 quarters + the most recent year
- "How have capital flows been recently" → defaults to the last 5–20 trading days, adjusted according to task granularity
- "How has the macro situation been recently" → defaults to the last 6–12 periods
Default sector scope
If the user only says "sector / industry / concept" but does not specify a classification system:
- For industries, prioritize relatively stable scopes such as Shenwan / CITIC
- For concepts, prioritize thematic scopes such as Tonghuashun / East Money
- If the conclusion depends on differences in specific scopes, clearly state which classification was used
Input normalization rules
Normalize before requesting data:
- Dates are unified as
YYYYMMDD - Check
start_date <= end_date - When the user inputs a future date, automatically trim it to the nearest available date and notify them.
- Bare code such as
000001Do not guess blindly; if it can be completed, explain the completion rule; if not, ask for clarification. - For conflicting parameters (such as
trade_dateandstart_date/end_dategiven at the same time), resolve the conflict first; do not just pass them through arbitrarily.
Data retrieval rules
Documentation first
Before writing request code, first confirm:
- Whether the API name is correct
- Required parameters
- Optional parameters
- Return fields
- Quota / rate limits
Do not hard-code field names based on memory alone.
Field confirmation
For the fields parameter, prefer using a known field whitelist or API documentation for confirmation.
If the field requested by the user does not exist, state this clearly instead of searching blindly.
Pull in segments by default
Do not pull long-range data all at once. Recommended:
- Daily / weekly / monthly bars: slice by year or quarter
- Financial reports: slice by year / reporting period
- Minute data: slice by month / week
- Large batches of multiple instruments: batch by instrument + segment by date
Retries and rate limiting
- Only perform limited retries for transient errors (network jitter, timeouts, 429)
- Do not blindly retry parameter errors, insufficient permissions, or field errors
- Add throttling during batch pulls to avoid hitting rate limits at high frequency
Segment merging
After segmented pulling:
- 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 the raw table, prioritize outputting according to this structure:
- One-sentence conclusion
- Data range and definitions
- Key metrics / key tables
- Anomalies / risk points / limitations of interpretation
- If there is local output, provide the file path
Result delivery format
Choose according to task complexity:
- Small results: Markdown summary + short table
- Medium-sized data tables: CSV
- Large-scale / follow-up analysis: Parquet
- Need a reusable process: attach a Python script
- When visualization is needed: output chart PNG or explain that a chart can be drawn
Metadata
When generating data files, try to also record:
- API name
- Request parameters
- Pull time
- Number of data rows
- Field list
- Whether there are failed segments / missing data
Workflow templates
The following templates are the core of this skill. Do not start by thinking of APIs; start by thinking of task templates.
1. Single-instrument market analysis
Applicable to:
- How has XX been doing recently?
- Has this stock been strong recently?
- How has it performed so far this year?
Default process:
- Parse the instrument
- Determine the time range
- Fetch market data + necessary basic indicators
- Summarize interval return, trading activity, highs and lows, and volatility
- Output a one-sentence conclusion + key numbers
2. Cross-sectional comparison of multiple instruments
Applicable to:
- Who is stronger, XX or YY
- Compare these companies
Default process:
- Lock the targets
- Unify the time basis
- Choose 3–5 key indicators
- Output a comparison table
- Give a summary of "who is stronger in which aspect"
3. Financial quality snapshot
Applicable:
- Take a look at XX's financial report
- Profit trend over the last few quarters
- How is the financial quality
Default process:
- Pull the core financial data for the last 8 quarters + the most recent annual period
- Distinguish revenue, profit, gross margin, ROE, and cash flow
- Mark improvement / deterioration / fluctuation points
- Explain cumulative values, single-quarter values, and year-over-year basis
4. Valuation analysis / screening
Applicable:
- Is the current valuation high
- Who is cheaper
- Screen for low valuation and high dividend yield
Default process:
- Clarify the target pool
- Pull
daily_basicand other valuation indicators - Link to financial quality when necessary
- Output rankings, extremes, and basis explanations
5. Capital flow tracking
Applicable:
- What has capital been buying recently
- Where has northbound flow been going recently
- Who has the largest main-force capital inflow
Default process:
- Clarify the capital flow basis (northbound / main force / dragon-tiger list / sector capital)
- Determine the time window
- Pull net inflow / active trading / persistence
- Explain in conjunction with price performance
- Avoid describing single-day noise as a trend
6. Sector / theme rotation analysis
Applicable:
- Which sector has been strongest recently
- Where has robotics been strong recently
- Which constituent stocks are in a certain concept sector
Default process:
- Determine the classification basis
- Pull sector interval performance
- Link to constituent stocks, capital flow, and limit-up tiers when necessary
- Output strong sector rankings and representative targets
7. Announcements / news / events review
Applicable:
- What announcements have there been recently
- Are there any catalysts
- How has the news side been recently
Default process:
- Clarify the target and time window
- Pull announcements / news / research reports / policy data
- Denoise and distill 3–5 main threads
- Distinguish facts, announcements, and media interpretation
- Combine with abnormal stock price movements for weak causal explanation when necessary
8. Data export and research preparation
Applicable:
- Pull a CSV
- Make a backtest data table
- Export market/financial data for a certain period
Default process:
- Clarify the data scope, frequency, and fields
- Use a segmented strategy to retrieve data
- Clean, deduplicate, and unify field types
- Output CSV / parquet
- Provide the file path and metadata
9. Comprehensive research brief
Applicable:
- Give me a quick study of XX
- Make an investor-perspective brief
- First give a panoramic judgment
Default workflow:
- One-sentence conclusion
- Market performance
- Financial trends
- Valuation level
- Capital flow situation
- Announcements / news catalysts
- Risk points
- Questions worth digging into further
Data quality rules
After the pull is complete, at minimum do these checks:
- Schema validation
- Key field existence check
- Primary key deduplication
- Fixed sorting
- Date normalization
- Numeric field type normalization
Empty result handling
An empty table is not necessarily a failure; distinguish:
- Non-trading day
- No data for the interval
- Stock not yet listed
- Parameter error
- Insufficient API permissions
Do not call every empty result "the API is broken".
Cache and reuse rules
To make the skill reusable over the long term, prioritize supporting:
- Base table caching (such as
stock_basic, trading calendar, index basic information) - Incremental updates, rather than a full re-pull every time
- Resume large tasks from checkpoints
- Standardized naming of result files
Recommended naming format:
daily_600519.SH_20230101_20231231_20260322.csvfina_indicator_300750.SZ_20260322.parquet
When there is a cache hit, it is best to indicate which data comes from the cache and which is newly pulled.
Error handling
Output errors in a layered manner of "plain language + debugging details".
User-visible layer
- Token not configured
- The current API may require higher credits/permissions
- The time range is too large and has been automatically changed to segmented pulling
- The stock name is not unique; please confirm which one it is
- The current result is empty, possibly because the date is a non-trading day / the security is not listed / there is no permission
Debug layer
Add when necessary:
- API name
- Parameters
- Failed segments
- Raw exception text
Partial success principle
If some segments fail, do not say "completed successfully". You should clearly say:
- Which parts succeeded
- Which parts failed
- Whether an incomplete result has been generated
Recommended minimal interface set
Do not stuff hundreds of APIs into the main skill body. Prioritize remembering the core API 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 APIs, please refer to references/数据接口.md。
Best practices
- Understand the task first, then choose APIs
- Fetch as little as possible; core data first, then expand
- Give the conclusion first, then the evidence
- By default speak plain language, do not pile up field names
- For vague Chinese expressions such as "recent / financial report / strong or not / capital attention", there should be reasonable default criteria
- For large tasks, give an execution plan first, then start running
- For export tasks, try to keep scripts, metadata, and file paths for easy reuse
Examples
Single-stock market data
- Look at CATL's trend over the last three months
- How much has Moutai risen so far this year
- Roughly how much was China Merchants Bank's maximum drawdown over the past two years
Financials / valuation
- Look at BYD's revenue and net profit trends over the last 8 quarters
- Is Moutai's valuation high now
- Help me find companies with high ROE and low debt
Comparison
- Compare the gains and valuations of Moutai, Wuliangye, and Luzhou Laojiao over the past year
- Compare the performance of CSI 300, CSI 500, and ChiNext this year
Capital flows / sectors
- Which stocks had the largest northbound capital inflows today
- Which sector has been the strongest recently
- Has the semiconductor sector been strong over the past month
Announcements / events
- Help me review Cambricon's recent important announcements
- What news catalysts have there been in the robotics sector recently
Macro
- Take a look at recent changes in CPI, PPI, and PMI
- Is the current market style tilted toward growth or value
Export
- Export the daily candlestick data of CSI 300 constituent stocks over the past two years as CSV
- Download CATL's adjusted price data from 2020 to now
- Pull the past 3 years of ROE, PE, PB, and revenue growth into a table
Quick rule
When the user is saying:
- View trends
- Check financial reports
- Compare companies
- View sectors
- View capital flows
- Review announcements and news
- View macro
- Pull data and export
Don't first think "what APIs are there". First think: What task is this? Which data workflow should it follow by default? How should the result be delivered to be truly useful?