SuperAPI AI Directory

quantflow-skill

Data & analytics

View repository

Updated 10-16 10:16

About this skill

quantflow-skill

Turn natural language financial data requests into executable Akshare data workflows.

This is a financial data research skill for natural language.

What this skill is for

Use cases:

  • View stock, index, and ETF trends
  • Check company profiles, valuations, and financial trends
  • Cross-sectional comparison of multiple instruments
  • View capital flows and sector strength
  • Review announcements, news, and policies
  • View macroeconomic data
  • View real-time futures quotes and historical data
  • View futures main contract data
  • View options data
  • View fund data
  • View forex data
  • View bond data
  • View cryptocurrency data
  • View industry economic data
  • View global economic data
  • View new energy data
  • View digital economy data
  • View financial market data
  • View real estate data
  • View transportation data
  • View agriculture data
  • View real-time stock quote data
  • Export data for analysis or backtesting
  • Use AKQuant for strategy backtesting

What this skill is NOT for

Not suitable for:

  • Directly giving buy or sell advice or acting as an investment advisor
  • Automatically placing orders or executing trades
  • Millisecond-level real-time trading decisions
  • Implementation of complex backtesting engines
  • Fabricating data when there is no network support

Environment check

Pre-checks:

  1. Check that Python 3.7+ is available
  2. Check that the akshare package is installed
  3. Check that the akquant package is installed when necessary

When packages are missing, prompt with the installation command:

  • pip install akshare
  • pip install akquant

Intent taxonomy

Task types and core interfaces:

1. Quotes / Trends

  • Core interfaces:stock_zh_a_hist, stock_zh_a_spot, stock_zh_a_daily, get_real_time_data (real-time data acquisition)

2. Basic profiles / Instrument identification

  • Core interfaces:stock_info_a_code_name, stock_company_info_em

3. Financials / Company quality

  • Core interfaces:stock_financial_analysis_indicator, stock_balance_sheet_by_report_em

4. Valuation / Fundamental indicators

  • Core interfaces:stock_zh_a_spot, stock_financial_analysis_indicator

5. Capital flows / Market behavior

  • Core interfaces:stock_em_flows, stock_hsgt_hold, stock_top_inst

6. Sectors / Indices / Themes

  • Core interfaces:stock_board_industry_spot_em, stock_board_concept_spot_em

7. Limit-up trading / Sentiment / Activity

  • Core interfaces:stock_limit_up_board_em, stock_market_activity_em

8. Announcements / News / Research reports / Policies

  • Core interfaces:stock_news_em, stock_announcement

9. Macro / Cross-market

  • Core interfaces:macro_china_cpi, macro_china_pmi, stock_us_spot, stock_hk_spot

10. Futures data

  • Core interfaces:futures_zh_realtime(real-time futures quotes), futures_zh_daily(futures daily data), futures_contract_info_shfe(futures contract information), get_futures_real_time_data (real-time futures data acquisition)

11. Options data

  • Core interfaces:option_zh_sina_spot(real-time options quotes), option_zh_sina_daily(options daily data)

12. Fund data

  • Core interfaces:fund_open_fund_info_em(open-end fund information), fund_etf_hist_sina(ETF historical data)

13. Forex Data

  • Core interfaces:forex_spot_quote(forex spot quotes), forex_rate_history(exchange rate historical data)

14. Bond Data

  • Core interfaces:bond_zh_cn_basic(China bond basic information), bond_zh_cn_hist(China bond historical data)

15. Cryptocurrency Data

  • Core interfaces:crypto_currency_hist(cryptocurrency historical data), crypto_currency_spot(cryptocurrency real-time quotes)

16. Industry Economic Data

  • Core interfaces:industry_energy_thermal_power_generation(thermal power generation), industry_energy_thermal_power_installed_capacity(thermal power installed capacity)

17. Global Economic Data

  • Core interfaces:global_economic_indicator(global economic indicators), global_economic_indicator_country(national economic indicators)

18. New Energy Data

  • Core interfaces:new_energy_vehicle_sales(new energy vehicle sales), new_energy_vehicle_production(new energy vehicle production)

19. Digital Economy Data

  • Core interfaces:digital_economy_internet_user(number of internet users), digital_economy_mobile_user(number of mobile users)

20. Financial Market Data

  • Core interfaces:financial_market_interbank_rate(interbank rates), financial_market_shibor(Shanghai Interbank Offered Rate)

21. Real Estate Data

  • Core interfaces:real_estate_house_price(housing price data), real_estate_investment(real estate investment data)

22. Transportation Data

  • Core interfaces:transportation_air_passenger(air passenger volume), transportation_railway_freight(railway freight volume)

23. Agricultural Data

  • Core interfaces:agriculture_grain_production(grain output), agriculture_crop_planting_area(crop planting area)

24. Export / Research Preparation

  • Core: unified output rules and naming conventions

25. Quantitative Strategy Backtesting

  • Core interfaces:stock_zh_a_daily, stock_zh_a_hist, futures_zh_daily, akquant library

Entity resolution rules

Underlying Parsing

  • Prioritize identifying stock names, codes, index names, ETF names, fund names
  • For Chinese abbreviations, first try to match standard objects
  • When names are duplicated, list candidates and clarify
  • Unify securities codes into standard format

Market Identification

  • Default to understanding as A-shares unless other markets are explicitly mentioned
  • Judge indices, ETFs, and individual stocks separately

Time Defaults

  • "recent trend" → last 20 trading days
  • "recent period" → last 3 months
  • "financial report / performance" → last 8 quarters + most recent year
  • "recent capital flow" → last 5–20 trading days
  • "recent macro" → last 6–12 periods

Default Sector Caliber

  • For industries, prioritize Shenwan / CITIC caliber
  • For concepts, prioritize Tonghuashun / East Money caliber
  • Clearly explain when relying on caliber differences

Input normalization rules

Normalize before data requests:

  • Unify dates as YYYY-MM-DD
  • Check start_date <= end_date
  • Automatically trim future dates to the most recent available date
  • Bare codes such as 000001 need clarification or explanation of completion rules
  • Resolve conflicting parameters before passing them

Data retrieval rules

Documentation First

  • Confirm the interface name, required parameters, optional parameters, and return fields

Field confirmation

  • Confirm using a known field whitelist or interface documentation
  • Clearly state when a field does not exist

Default segmented fetching

  • Daily/weekly/monthly: slice by year or quarter
  • Financial reports: slice by year/reporting period
  • Minute data: slice by month/week
  • Large batches of multiple symbols: batch by symbol + segment by date

Retry and rate limiting

  • Retry only limited times for transient errors (network jitter, timeout, 429)
  • Add throttling during batch fetching

Segment merging

  • Merge, deduplicate, sort by primary key
  • Record failed segments and clearly inform the user

Output contract

Default output structure:

  1. One-sentence conclusion
  2. Data range and scope
  3. Key metrics/tables
  4. Anomalies/risk points/explanation limitations
  5. Local output file path

Result delivery format

  • Small results: Markdown summary + brief table
  • Medium data tables: CSV
  • Large-scale analysis: Parquet
  • Reusable workflow: attach Python script
  • Visualization: output charts or explanations

Metadata

When generating data files, record:

  • Interface name, request parameters, fetch time
  • Number of data rows, field list
  • Failed segments/missing situations

Data quality rules

After data fetching, check:

  • Schema validation
  • Key field existence check
  • Primary key deduplication
  • Fixed sorting
  • Date standardization
  • Numeric field type normalization

Empty result handling

Distinguish the reasons for an empty table:

  • Non-trading day
  • No data in the range
  • Stock not yet listed
  • Parameter error

Cache and reuse rules

Support:

  • Base table caching (stock list, trading calendar, index basic information)
  • Incremental updates to avoid full re-fetching
  • Resume large tasks from breakpoints
  • Standardized naming of result files

Recommended naming format:

  • daily_600519_2023-01-01_2023-12-31_2026-03-22.csv
  • financial_300750_2026-03-22.parquet

State the source when there is a cache hit.


Error handling

Output errors using a layered approach of "plain language + debugging details".

User-visible layer

  • akshare package is not installed
  • The current interface requires a network connection
  • The time range is too large; segmented fetching has been performed automatically
  • The stock name is not unique, please confirm
  • The result is empty, possibly because it is a non-trading day/the symbol is not listed

Debugging layer

When necessary, provide:

  • Interface name, parameters
  • Failed segments
  • Original exception text

Partial success principle

Clearly state:

  • Successful part
  • Failed part
  • Whether an incomplete result was generated

Recommended minimal interface set

Core interface set:

  • stock_zh_a_hist: A-share historical quotes
  • stock_zh_a_spot: A-share real-time quotes
  • stock_info_a_code_name: Stock codes and names
  • stock_financial_analysis_indicator: Financial analysis indicators
  • stock_balance_sheet_by_report_em: Balance sheet
  • stock_income_statement_by_report_em: Income statement
  • stock_em_flows: Capital flow data
  • stock_hsgt_hold: Shanghai-Hong Kong Stock Connect holdings
  • stock_board_industry_spot_em: Industry sector market conditions
  • stock_board_concept_spot_em: Concept sector market conditions
  • stock_limit_up_board_em: Limit-up board data
  • stock_news_em: Stock news
  • stock_announcement: Stock announcements
  • macro_china_cpi: China CPI data
  • macro_china_pmi: China PMI data
  • stock_us_spot: U.S. stock real-time quotes
  • stock_hk_spot: Hong Kong stock real-time quotes
  • futures_zh_realtime: Futures real-time quotes
  • futures_zh_daily: Futures daily data
  • futures_contract_info_shfe: Futures contract information
  • option_zh_sina_spot: Options real-time quotes
  • option_zh_sina_daily: Options daily data
  • fund_open_fund_info_em: Open-end fund information
  • fund_etf_hist_sina: ETF historical data
  • forex_spot_quote: Forex spot quotes
  • forex_rate_history: Exchange rate historical data
  • bond_zh_cn_basic: China bond basic information
  • bond_zh_cn_hist: China bond historical data
  • crypto_currency_hist: Cryptocurrency historical data
  • crypto_currency_spot: Cryptocurrency real-time quotes
  • industry_energy_thermal_power_generation: Thermal power generation
  • industry_energy_thermal_power_installed_capacity: Thermal power installed capacity
  • global_economic_indicator: Global economic indicators
  • global_economic_indicator_country: National economic indicators
  • new_energy_vehicle_sales: New energy vehicle sales
  • new_energy_vehicle_production: New energy vehicle production
  • digital_economy_internet_user: Number of internet users
  • digital_economy_mobile_user: Number of mobile users
  • financial_market_interbank_rate: Interbank rates
  • financial_market_shibor: Shanghai Interbank Offered Rate
  • real_estate_house_price: Housing price data
  • real_estate_investment: Real estate investment data
  • transportation_air_passenger: Air passenger volume
  • transportation_railway_freight: Railway freight volume
  • agriculture_grain_production: Grain output
  • agriculture_crop_planting_area: Crop planting area

Best practices

  • Understand the task first, then choose the interface
  • Core data first, then expand
  • Give conclusions first, then evidence
  • Speak plainly by default, do not pile up field names
  • Have reasonable default interpretations for vague Chinese expressions
  • For large tasks, provide an execution plan first
  • For export tasks, retain scripts, metadata, and file paths
  • For quantitative backtesting, clarify strategy logic, time range, and capital management
  • Analyze backtest results in combination with transaction costs and slippage
  • Avoid overfitting in strategy optimization, and use out-of-sample data for validation

Quick rule

When the user mentions:

  • Check trends
  • Check financial reports
  • Compare companies
  • Check sectors
  • Check capital flows
  • Sort out announcements and news
  • Check macroeconomics
  • Check futures market conditions
  • Check futures real-time quotes
  • Check futures main contracts
  • Check options data
  • Check fund data
  • Check forex data
  • Check bond data
  • Check cryptocurrency
  • Check industry economic data
  • Check global economic data
  • Check new energy data
  • Check digital economy data
  • Check financial market data
  • Check real estate data
  • Check transportation data
  • Check agriculture data
  • Check stock real-time quotes
  • Real-time price
  • Current price
  • Current market conditions
  • Pull data for export
  • Test trading strategies
  • Backtest quantitative models

First think: What is this task? Which data workflow should be followed by default? How should the results be delivered to be truly useful?