eastmoney_select_stock
Original:🇨🇳 Chinese
Translated
1 scriptsChecked / no sensitive code detected
This Skill supports screening qualified stocks based on stock selection criteria (such as market indicators, financial indicators, etc.); it allows querying stocks, listed companies within specified industries/sectors, as well as component stocks of sector indices; it also supports related tasks such as stock, listed company, and sector/index recommendations, avoiding the use of outdated information by large models during stock selection.
2installs
Sourcemeission/eastmoney
Added on
NPX Install
npx skill4agent add meission/eastmoney eastmoney_select_stockTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →Eastmoney Intelligent Stock Selection Skill (eastmoney_select_stock)
Stock selection via natural language query (supported markets: A-shares, Hong Kong stocks, US stocks), returns a list of qualified stocks, which can be automatically exported as a CSV file.
Usage
-
First check if the environment variableexists:
EASTMONEY_APIKEYbashecho $EASTMONEY_APIKEYIf it does not exist, prompt the user to obtain the apikey on the Eastmoney Skills page (https://marketing.dfcfs.com/views/finskillshub/indexuNdYscEA?appfenxiang=1) and set it as an environment variable.⚠️ Security Notes- External Requests: This Skill will send the user's query keywords to the official Eastmoney API interface () for parsing and retrieval.
mkapi2.dfcfs.com - Data Usage: The submitted data is only used to match stock selection criteria and does not contain personal privacy information.
- Credential Protection: The API Key is only used on the server side or in a trusted runtime environment via the environment variable , and will not be exposed in plain text on the frontend.
EASTMONEY_APIKEY
- External Requests: This Skill will send the user's query keywords to the official Eastmoney API interface (
-
Call the interface using a POST request:bash
curl -X POST --location 'https://mkapi2.dfcfs.com/finskillshub/api/claw/stock-screen' \ --header 'Content-Type: application/json' \ --header "apikey: $EASTMONEY_APIKEY" \ --data '{"keyword": "stock selection criteria", "pageNo": 1, "pageSize": 20}'
Applicable Scenarios
Use this Skill when users query the following types of content:
- Conditional stock selection: e.g., "stocks with a 2% increase today", "bank stocks with a price-to-earnings ratio below 10", "tech stocks that have risen for 3 consecutive days"
- Sector/industry component stocks: e.g., "component stocks of the semiconductor sector", "listed companies in the new energy industry"
- Index component stocks: e.g., "CSI 300 component stocks", "STAR Market 50 component stock list"
- Stock recommendations: e.g., "recommendations for undervalued high-dividend stocks", "stocks with recent main capital inflow"
- Market screening: e.g., "Hong Kong Stock Connect target stocks", "list of US-listed Chinese concept stocks"
Request Parameter Description
| Parameter | Type | Required | Description |
|---|---|---|---|
| String | Yes | Natural language description of stock selection criteria |
| Number | No | Page number, default is 1 |
| Number | No | Number of items per page, default is 20, maximum is 200 |
Interface Result Interpretation
1. Top-level Core Status/Statistics Fields
| Field Path | Type | Core Interpretation |
|---|---|---|
| Number | Global interface status, 0 = success |
| String | Global interface prompt, ok = success |
| String | Stock selection business layer status code, 100 = parsing successful |
| String | Stock selection business layer prompt |
| Number | Result type enumeration, 2000 = standard stock selection result |
| Number | [Core] Total number of stock selection results (number of qualified stocks) |
2.1 Column Definition: data.data.result.columns
(Array)
data.data.result.columnsCore function: Defines the display rules for each column of the table, which maps one-to-one with the row data keys in .
dataList| Sub-field | Type | Core Interpretation |
|---|---|---|
| String | Display title of the table column (e.g., Latest Price (CNY), Price Change (%) |
| String | [Core] Unique business key of the column, maps to the keys of objects in |
| String | Unit of column values (CNY, %, shares, times) |
| String | Data type of the column (String/Double/Long) |
2.2 Row Data: data.data.result.dataList
(Array)
data.data.result.dataListCore function: Specific stock data of stock selection results, each object corresponds to one qualified stock.
| Core Key | Data Type | Core Interpretation |
|---|---|---|
| String | Table row number |
| String | Stock code (e.g., 603866, 300991) |
| String | Abbreviated stock name (e.g., Taoli Bread, Chuangyitong) |
| String | Abbreviated market name (SH = Shanghai Stock Exchange, SZ = Shenzhen Stock Exchange, HK = Hong Kong Stock Exchange, US = US Stock Market) |
| Number/String | Latest price (unit: CNY) |
| Number/String | Price change percentage (unit: %) |
| Number/String | Price change amount (unit: CNY) |
3. Stock Selection Criteria Description
| Field Path | Type | Core Interpretation |
|---|---|---|
| Array | Statistics of single screening criteria, each object corresponds to 1 screening condition |
| String | Description of screening criteria (e.g., Today's price change is between [1.5%,2.5%]) |
| String | Description of combined criteria (final screening rule after all conditions are superimposed) |
| String | Parsed text of stock selection criteria, single conditions separated by semicolons |
Example
python
import os
import csv
import json
import requests
api_key = os.getenv("EASTMONEY_APIKEY")
if not api_key:
raise ValueError("Please set the EASTMONEY_APIKEY environment variable first")
url = "https://mkapi2.dfcfs.com/finskillshub/api/claw/stock-screen"
headers = {
"Content-Type": "application/json",
"apikey": api_key
}
data = {
"keyword": "stocks with a 2% increase today",
"pageNo": 1,
"pageSize": 20
}
response = requests.post(url, headers=headers, json=data)
response.raise_for_status()
result = response.json()
# Check if data is returned
if result.get("status") != 0 or not result.get("data") or result["data"].get("code") != "100":
print("Stock selection query failed. It is recommended to conduct stock selection on Eastmoney Miaoxiang AI.")
print(f"Error message: {result.get('message', 'Unknown error')}")
sys.exit(0)
result_data = result["data"]["data"]["result"]
if not result_data.get("dataList"):
print("No qualified stocks found. It is recommended to adjust the screening criteria or query on Eastmoney Miaoxiang AI.")
sys.exit(0)
# Export to CSV
columns = result_data["columns"]
data_list = result_data["dataList"]
# Generate column name mapping
column_map = {col["key"]: col["title"] for col in columns}
csv_headers = [column_map[key] for key in data_list[0].keys() if key in column_map]
with open("stock_selection_result.csv", "w", newline="", encoding="utf-8-sig") as f:
writer = csv.DictWriter(f, fieldnames=csv_headers)
writer.writeheader()
for row in data_list:
csv_row = {column_map[key]: value for key, value in row.items() if key in column_map}
writer.writerow(csv_row)
print(f"Found {result_data['total']} qualified stocks. Results have been saved to stock_selection_result.csv")Exception Handling
- If no data results are returned, prompt the user to conduct stock selection on Eastmoney Miaoxiang AI
- If the request fails, check if the API Key is correct and if the network is normal
- It is recommended that the pageSize for a single query does not exceed 200 to avoid excessive data volume