agentleFS
JerryLiu369JerryLiu369/awesome-quant-skills/skills/china-markets/wencai-screener/SKILL.md

wencai-screener

Skill5 starsChanged 4 days agoMITView on GitHub

Query Chinese A-share market data using the pywencai library. Supports natural language queries for real-time prices, financial indicators, technical analysis, and sector information. Basic usage pattern: Critical requirement: Cookie parameter is mandatory. Users must provide their cookie from https://www.iwencai.com/ Before first use, verify dependencies: Required: - Node.js v16+ (pywencai executes JS code internally) - pywencai package: pip install pywencai Every query requires a valid cookie parameter. Guide users to obtain cookie: 1. Visit https://www.iwencai.com/ and login 2. Open browser DevTools…

  • Installs packages

The file

We split this skill into the rules it gives an agent

5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 2

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before first use, verify dependencies:

    line 34
  2. Very specific:

    Use no_detail=True to always return DataFrame or None

    line 129
  3. Distinctive:

    Low frequency usage: - Avoid high-frequency calls to prevent blocking

    line 133
  4. Very specific:

    Rate limiting: - Use sleep parameter for batch queries

    line 136
  5. Distinctive:

    Data validation: - Check if result is None or empty DataFrame

    line 137

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md
<!-- Imported from: https://github.com/raidery/quant-skills Source Path: wencai/SKILL.md Curated for awesome-quant-skills -->

name: wencai description: "Query Chinese A-share market data using pywencai library with natural language queries. Use when users need to: (1) Query real-time stock prices, financial indicators, or technical analysis data for A-share stocks, (2) Search for stocks by conditions (e.g., 市盈率小于20的科技股, 昨日涨幅前10), (3) Get sector/industry information, (4) Query indices, funds, convertible bonds, or other financial instruments, (5) Analyze financial statements or technical indicators. Triggers on mentions of: A股, 同花顺, 问财,wencai, pywencai, A股, Chinese stocks, or natural language stock queries in Chinese."

Wencai - A股市场数据查询

Overview

Query Chinese A-share market data using the pywencai library. Supports natural language queries for real-time prices, financial indicators, technical analysis, and sector information.

Quick Start

Basic usage pattern:

import pywencai

# Simple query
result = pywencai.get(query='昨日涨幅前10', cookie='your_cookie_here')
print(result)

Critical requirement: Cookie parameter is mandatory. Users must provide their cookie from https://www.iwencai.com/

Environment Setup

Before first use, verify dependencies:

python scripts/check_environment.py

Required:

  • Node.js v16+ (pywencai executes JS code internally)
  • pywencai package: pip install pywencai

Cookie Authentication

Every query requires a valid cookie parameter.

Guide users to obtain cookie:

  1. Visit https://www.iwencai.com/ and login
  2. Open browser DevTools (F12)
  3. Go to Network tab
  4. Copy the Cookie header value from any request

Store cookie securely (environment variable or config file recommended).

Common Query Patterns

Market Screening

# By valuation
pywencai.get(query='市盈率小于20且市值大于50亿', cookie=cookie)

# By performance
pywencai.get(query='近5日涨幅超过20%', cookie=cookie)

# By sector
pywencai.get(query='新能源汽车板块', cookie=cookie)

# By technical indicators
pywencai.get(query='MACD金叉', cookie=cookie)

Advanced Multi-Condition Screening

# Complex technical analysis (verified working example)
query = """
涨幅大于1%,大单金额大于5000万,10日内ma10金叉ma60,
月macd大于0,流通市值大于50亿,收盘价大于ma10,ma10向上角度大于40度
""".replace("\n", "").strip()

result = pywencai.get(
    query=query,
    cookie=cookie,
    loop=True,      # Get all pages
    perpage=100,    # Max 100 per page
    log=True        # Show debug logs
)

if result is not None:
    print(f"Found {len(result)} stocks")
    print(result.head())

Sorted Results

pywencai.get(
    query='科技股',
    sort_key='涨跌幅',
    sort_order='desc',
    cookie=cookie
)

Multiple Pages

# Get all data
pywencai.get(query='A股', loop=True, cookie=cookie)

# Get first 3 pages
pywencai.get(query='A股', loop=3, cookie=cookie)

Non-Stock Queries

# Indices
pywencai.get(query='上证指数', query_type='zhishu', cookie=cookie)

# Funds
pywencai.get(query='科技类基金', query_type='fund', cookie=cookie)

# Convertible bonds
pywencai.get(query='可转债', query_type='conbond', cookie=cookie)

Return Values

  • List queries → pandas.DataFrame
  • Detail queries → dict (contains text and DataFrames)
  • Use no_detail=True to always return DataFrame or None

Best Practices

  1. Low frequency usage - Avoid high-frequency calls to prevent blocking
  2. Cookie management - Store cookie securely, refresh when expired
  3. Error handling - Wrap calls in try-except for network/auth errors
  4. Rate limiting - Use sleep parameter for batch queries
  5. Data validation - Check if result is None or empty DataFrame

Detailed References

  • API parameters: See api_reference.md for complete parameter documentation
  • Query examples: See query_examples.md for comprehensive query patterns

Troubleshooting

"Cookie required" error: User must provide valid cookie parameter

"Node.js not found": Install Node.js v16+ from https://nodejs.org/

Empty results: Query may be too restrictive or cookie expired

Rate limiting: Reduce query frequency or add sleep parameter

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.