Throughnatural language queriesfor stock screening, with data from the Miaoxiang large model service, supporting the following types:
- A-shares、Hong Kong stocks、US stocks
- Funds、ETF、Convertible bonds、Sectors
Feature Scope
Basic Stock Screening Capabilities
- By stock price, market cap, price change, P/E ratio, etc.financial/market indicatorsscreening
- Bytechnical signalsscreening (such as consecutive gains, breaking through moving averages, etc.)
- Bymain business, main productsscreening
- Byindustry/concept sectorscreening constituent stocks
- Getindex constituent stocks
- Recommendstocks, funds, sectors
- By multiplecompound conditionslogical combination screening (such as AND, OR, NOT, sorting, etc.)
Advanced A-share Queries (Some Scenarios)
In addition to basic stock screening, the following query scenarios for A-share listed companies are also supported:
- Executive information, shareholder information
- Dragon-Tiger List data
- Dividends, mergers and acquisitions, additional issuance, buybacks
- Main business regions
- Brokerage top picks
Note: The above are only some examples; the conditions actually supported are far more than those listed
Query Examples
| Type | query | select-type |
|---|---|---|
| Select A-shares | Stocks with a share price greater than 500 yuan, the 50 ChiNext stocks with the lowest P/E ratios | A-shares |
| Select Hong Kong stocks | Hong Kong tech leaders | Hong Kong stocks |
| Select US stocks | Top 30 Nasdaq companies by market cap, US stocks in the Apple supply chain | US stocks |
| Select sectors | Sector with the largest gain today | Sectors |
| Select funds | Baijiu-themed funds, ranking of new energy mixed funds by return over the past year | Funds |
| Select ETFs | Power ETFs with assets over 200 million | ETF |
| Select convertible bonds | Convertible bonds priced below 110 yuan with a premium rate over 5 points | Convertible bonds |
Quick Start
1. Command-line invocation
python3 {baseDir}/scripts/get_data.py --query 股价大于100元,主力流入,成交额排名前50 --select-type A股
Output Example
CSV: /path/to/miaoxiang/mx_stocks_screener/mx_stocks_screener_9535fe18.csv
描述: /path/to/miaoxiang/mx_stocks_screener/mx_stocks_screener_9535fe18_description.txt
行数: 42
Parameter Description:
| Parameter | Description | Required |
|---|---|---|
--query |
Natural language query conditions | ✅ |
--select-type |
Query domain | ✅ |
2. Code invocation
import asyncio
from pathlib import Path
from scripts.get_data import query_mx_stocks_screener
async def main():
result = await query_mx_stocks_screener(
query="A股半导体板块市值前20",
selectType="A股",
output_dir=Path("miaoxiang/mx_stocks_screener"),
)
if "error" in result:
print(result["error"])
else:
print(result["csv_path"], result["row_count"])
asyncio.run(main())
Output File Description
| File | Description |
|---|---|
mx_stocks_screener_<查询ID>.csv |
Full data table, column names areChinese(mapped by the returned columns), UTF-8 encoded, can be opened with Excel or pandas |
mx_stocks_screener_<查询ID>_description.txt |
Data description: query content, number of rows, column name descriptions, etc. |
Environment variables
| Variable | Description | Default |
|---|---|---|
MX_STOCKS_SCREENER_OUTPUT_DIR |
Output directory for the CSV and description file (optional) | miaoxiang/mx_stocks_screener |
FAQ
How do I specify the output directory?
export MX_STOCKS_SCREENER_OUTPUT_DIR="/path/to/output"
python3 {baseDir}/scripts/get_data.py --query "查询内容" --select-type "查询领域"