PyWenCai: Natural Language Financial Data Query for Openclaw

A Python-based library that enables querying of Chinese financial market data using natural language sentences via the Tonghuashun Wencai platform.

coderwpf
v1.0.3
Mar 23, 2026
1
1.6k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install pywencai

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install pywencai using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is PyWenCai: Natural Language Financial Data Query?

PyWenCai is a sophisticated Python wrapper designed to interface with the Tonghuashun Wencai natural language search engine. It allows developers to retrieve comprehensive market data—including A-shares, indices, funds, HK/US stocks, and convertible bonds—by simply passing Chinese natural language strings as queries. This tool is a vital component for quantitative researchers and developers leveraging Openclaw Skills to build financial intelligence applications.

The library handles the complexity of interacting with web-based financial data sources by internally executing necessary JavaScript code through Node.js. By providing a structured way to access one of China's most popular financial query platforms, it empowers users within the Openclaw Skills ecosystem to automate data collection and market monitoring without writing complex scrapers.

PyWenCai: Natural Language Financial Data Query Use Cases

  • Automated screening of stocks based on financial metrics like ROE, PE ratios, or revenue growth.
  • Real-time monitoring of technical patterns such as MACD golden crosses or KDJ oversold signals.
  • Cross-market data aggregation for comparison between A-shares, Hong Kong stocks, and US markets.
  • Building automated alerting systems for market anomalies like sudden volume spikes or limit-up movements.
  • Exporting historical market data and financial statements directly into Pandas DataFrames for research.

How PyWenCai: Natural Language Financial Data Query Works

  1. The user initializes a query using a natural language string in Chinese, such as 'stocks with PE less than 20'.
  2. The system requires a valid session cookie from iwencai.com to authenticate the request.
  3. PyWenCai utilizes a Node.js environment to execute internal JavaScript logic required for data signing and request validation.
  4. The library sends the query to the Wencai backend and retrieves the raw market data.
  5. The tool parses the response and returns a structured Pandas DataFrame or a dictionary for easy manipulation within Python environments.

PyWenCai: Natural Language Financial Data Query Setup

To get started with this tool in the context of Openclaw Skills, ensure you have Python 3.7+ and Node.js v16+ installed. Install the package via pip:

pip install pywencai --upgrade

You must also manually obtain a Cookie from iwencai.com by logging in via a browser and inspecting the Network tab in Developer Tools (F12) to find the Cookie value in requests sent to iwencai.com.

PyWenCai: Natural Language Financial Data Query Data Schema & Taxonomy

The data returned by this skill is organized based on the nature of the query and the specified query_type. Most results are returned as structured tabular data.

Data Type Description Return Format
List Queries Returns lists of stocks, funds, or indices matching criteria. pandas.DataFrame
Detail Queries Provides in-depth information about a specific stock or entity. dict
Financial Data Structured columns covering ROE, revenue, and profit margins. pandas.DataFrame
Market Metadata Includes stock codes, names, and real-time pricing fields. pandas.DataFrame

Users can force consistent DataFrame output by setting the no_detail=True parameter.

PyWenCai: Natural Language Financial Data Query Advanced Features

  • Multi-market support including A-shares, HK stocks, US stocks, futures, and insurance products.
  • Automatic pagination handling through the loop parameter to fetch thousands of results in one call.
  • Built-in retry mechanism and sleep intervals to manage request frequency and avoid IP blocking.
  • Proxy integration via request_params to facilitate high-volume data scraping tasks.
  • Specialized 'Pro' mode support for users with paid Wencai subscriptions for even deeper data access.
  • Seamless integration with AI Agents for dynamic, autonomous market analysis and strategy execution.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*