� Core Capabilities
This skill provides powerful stock data query and analysis capabilities, mainly including:
- Real-time Data: Provides real-time stock snapshots and real-time intraday quotes.
- Historical Data: Supports querying historical data (daily K-line, minute K-line, financial indicators, etc.) for instruments such as stocks, convertible bonds, ETFs, and indices.
- Custom Notifications(in development): Supports custom message notifications for unusual signals such as limit-up, limit-up opening (failed limit-up), large-volume surges, and large-amount trades at limit-up.
�📥 Installation Method
npx skills add https://github.com/1018466411/openclaw-stock-data-skill
During installation, select as prompted:
- Select openclaw
- Select global Apply to all Agents
- Copy to all agents: yes
This skill teaches the agent how to use your self-built stock data service (register an account https://data.diemeng.chat), authenticate via API Key , and query stock daily K-line, minute K-line, financial indicators and other data.
⚙️ API Key Configuration Convention
- OpenClaw will, according to
skills.entries.<key>configuration , inject the API Key and custom configuration into the process environment variables.- This skill conventionally uses the environment variable
STOCK_API_KEYas the primary key, and declares it inmetadata.openclaw.primaryEnvso that it can be configured uniformly viaskills.entries.openclaw-stock-skill.apiKey.- Recommended OpenClaw configuration example (
~/.openclaw/openclaw.json):{ skills: { entries: { "openclaw-stock-skill": { enabled: true, // 建议在 OpenClaw UI 的 Skill 参数面板里填写 apiKey, // Gateway 会自动将其写入 STOCK_API_KEY 环境变量 apiKey: { source: "env", provider: "default", id: "STOCK_API_KEY" }, env: { // 可在这里直接写死,或通过系统环境变量覆盖 STOCK_API_KEY: "YOUR_REAL_STOCK_API_KEY" }, config: { // 可选:覆盖默认域名 baseUrl: "https://data.diemeng.chat" } } } } }Reference documentation:Skills Config、Skills
⚠️ Important Notes
1. Permission Activation and 403 Errors
If the API returns a 403 error, it means your account does not have permission for the corresponding API.
Please be sure to visit the official website https://data.diemeng.chat/(overseas, please visit https://mg.diemeng.chat/), and activate the required permissions (such as stock quotes, real-time snapshots, convertible bonds, etc.) in the personal center.
2. Distinguishing API Types
- Real-time APIs:
get_stock_snapshot_daily(no date passed or today's date passed): Get the latest real-time snapshot (price, volume, five-level order book, etc.).get_stock_snapshot_push_history: Get the historical records of real-time push.get_call_auction: Get call auction data.get_future_realtime_history: Get real-time 1-minute intraday futures data, defaulting to the current day in Shanghai time zone, supporting the most recent 7 calendar days.
- Historical APIs:
get_daily_data: Get historical daily K-line.get_kline_data: Get historical periodic K-line (weekly K, monthly K).get_kline_adj_data: Get adjusted historical periodic K-line (weekly K, monthly K).get_history_data: Get historical minute K-line.get_finance_data: Get historical financial indicators.get_financial_indicator: Get financial indicator report data (stock_financial_indicator).get_income_statement: Get income statement data (stock_income).get_balancesheet: Get balance sheet data (stock_balancesheet).get_cashflow_statement: Get cash flow statement data (stock_cashflow).get_main_fund_flow: Get large and small order capital flow.get_main_fund_flow_overview: Get main capital flow overview.get_cyq_chips: Get chip distribution.get_holder_number: Get shareholder count data.get_pledge_stat: Get stock pledge statistics data.get_margin_detail: Get margin trading detailed data.get_stock_snapshot_daily(pass a historical date): Get historical snapshot.
- Index and Sector Interfaces:
get_index_history: Get minute-level historical data for an index.get_index_realtime_history: Get real-time 1-minute intraday data for the index on the current day.get_index_weight: Get monthly index constituents and weight data (index_code is required; can be filtered by stock_code and trade_date).get_ths_sector_categories: Get Tonghuashun sector classification data.get_ths_constituent_stocks: Get Tonghuashun constituent stock data.get_dc_blocks: Get the East Money sector list.get_dc_daily: Get East Money sector daily K-line (by trading date or sector code).get_dc_block_stocks: Get East Money sector constituent stocks (supports filtering by sector/date/stock; empty parameters default to the latest date).get_tdx_block_stocks: Get Tongdaxin sector constituent stocks, returning a paginated structuredata.total/page/page_size/list, wherelistitems includeblock_code、block_name、block_type、stock_code。
General Description
- Obtain the correct API Key and verify it:
- You must obtain the correct apiKey before you can call the interface.
- How to obtain: Preferentially read from the environment variable
STOCK_API_KEY, or obtain it from the current directory'sconfig.json. If configured in the Skill panel, it will also be injected into the environment variable.
- Base Domain: The default interface domain is
data.diemeng.chat,If it is an overseas IP, accessmg.diemeng.chat。 - Authentication Method: All interfaces that require permissions must carry the API Key, andmust be placed in the HTTP Header:
apiKey: <STOCK_API_KEY>(mandatory requirement)Content-Type: application/json
- Return Structure:
- Most interfaces return:
{ "code": 200, "msg": "成功", "data": { ... } } - A few list-type interfaces directly return an array or a simple structure; the actual response is subject to the JSON.
- Most interfaces return:
- Rate Limiting and Blacklist:
- API Keys and IPs both have strict rate limiting and blacklist logic:
- Multiple attempts with an invalid API Key will trigger a ban (see backend
DataAccessVerifierimplementation). - The same API Key should be cached and reused preferentially; do not switch it frequently in a loop.
- Multiple attempts with an invalid API Key will trigger a ban (see backend
- API Keys and IPs both have strict rate limiting and blacklist logic:
- ⚠️ Data Volume Limit: Unless otherwise specified,most list-type interfaces return at most 10000 records per request. If you need to obtain more data, please use pagination parameters.
Capability Overview (Suggested Tool Intents)
The agent should treat this skill as a set of HTTP capabilities, rather than a single interface:
- get_stock_daily_bars: Query the daily K-line data of a specified stock within a certain time range.
- get_stock_intraday_bars: Query minute-level (1/5/15/30/60 minute) historical data.
- get_stock_finance_factors: Query daily financial factors (PE, PB, turnover rate, etc.).
- get_stock_main_fund_flow: Query the details of main capital flow (by time range/stock code, supporting passing only one of them).
- get_stock_main_fund_flow_overview: Query the overview of main capital flow (net inflow rate and tiered statistics).
- get_stock_limit_up: Query limit-up details (seal orders, consecutive limit-ups, reasons for limit-up, etc.).
- get_stock_list: Query the basic stock information list, used for code/name search.
- get_stock_calendar_and_snapshot: Query the trading calendar and the current day's snapshot.
- get_stock_search: Use natural language conditions to search for stocks that meet the criteria (such as "PE<20 and turnover rate>3%").
- get_stock_call_auction: Query call auction data.
- get_stock_closing_snapshot: Query closing snapshot data.
- get_stock_snapshot_daily: Query real-time or historical stock snapshots (including Redis cache acceleration).
- get_stock_suspension: Query stock suspension information.
- get_stock_adj_factor: Query adjustment factors.
- get_stock_indicator: Query stock MACD, MAVOL, KDJ, RSI, BOLL, and MA technical indicators, supporting daily/minute lines and forward adjustment.
- get_etf_indicator: Query ETF MACD, MAVOL, KDJ, RSI, BOLL, and MA technical indicators.
- get_bond_technical_indicator: Query convertible bond MACD, MAVOL, KDJ, RSI, BOLL, and MA technical indicators.
- get_bond_daily: Query convertible bond daily line data.
- get_bond_indicator_daily: Query convertible bond daily indicator data.
- get_bond_list: Query convertible bond list information.
- get_index_realtime_history: Query the index's real-time 1-minute intraday data for the current day.
- get_index_weight: Query index monthly constituent and weight data (optionally filtered by constituent stocks).
- get_future_realtime_history: Query futures real-time 1-minute intraday data, filterable by contract, contract type, calendar day, or exact minute.
When planning calls, the agent should select and combine the above capabilities according to the user's natural language intent.
API Details and Calling Specifications
1. Daily line data:POST /api/stock/daily
- URL:
{baseUrl}/api/stock/daily - Method:
POST - Headers:
Content-Type: application/jsonapiKey: <STOCK_API_KEY>
- Request body JSON(backend
DailyDataRequest):
{
"stock_code": "000001.SZ",
"start_time": "2024-01-01",
"end_time": "2024-01-31",
"volType": "share",
"page": 0,
"page_size": 1000
}
- Description:
stock_codecan be a single string or an array of strings.start_time、end_timeformat isYYYY-MM-DD。volTypeOptional:share(default, returned by share) orlot(returned by lot,1手=100股)。- supports pagination,
pagestarts from 0.
- Response fields:
data.total: total record countdata.list: each record containsstock_code,stock_name,trade_date,open,high,low,close,vol,amountand other fields; prices and trading volume are uniformly rounded to 2 decimal places on the backend,volunit is determined byvolType.
- Response body (simplified):
data.total: total record countdata.list: each record containsstock_code,trade_date,open,high,low,close,vol,amountand other fields; prices and trading volume are uniformly rounded to 2 decimal places on the backend.
1.1 Adjusted daily line:POST /api/stock/daily_adj
- Request parameters are basically the same as
POST /api/stock/daily, additionally supportsalgo(recursive/factor)。 - Newly added
volTypeoptional parameter:share(default, by share) orlot(by lot). - For compatibility with historical calls, when
volTypeis not passed, the old behavior is maintained (returned by share).
When the agent needs "a certain stock's daily K-line for a certain period", it should preferentially choose this API.
2. Minute-level historical data:POST /api/stock/history
- URL:
{baseUrl}/api/stock/history - Method:
POST - Headers: same as above
- Request body JSON(backend
HistoryDataRequest):
{
"stock_code": "000001.SZ",
"level": "5min",
"start_time": "2024-01-01 09:30:00",
"end_time": "2024-01-01 15:00:00",
"page": 0,
"page_size": 1000
}
- Field description:
stock_code: only supports a single stock code string (arrays are not supported)level:"1min" | "5min" | "15min" | "30min" | "60min"start_time/end_time:- allows date only (automatically completes to 00:00:00 and 23:59:59)
- or a full timestamp
YYYY-MM-DD HH:MM:SS
- Response body (simplified) unit: lot:
data.listeach item contains:stock_code,trade_time,open,high,low,close,vol,amount。
Used for scenarios such as users asking about "minute-level market data or intraday data for a certain day/a certain period".
2.1 Technical indicators: stocks, ETFs, convertible bonds, indices
- Stock path:
POST /api/stock/macd|mavol|kdj|rsi|boll|ma - ETF path:
POST /api/etf/macd|mavol|kdj|rsi|boll|ma - Convertible bond path:
POST /api/bond/macd|mavol|kdj|rsi|boll|ma - Index path:
POST /api/index/macd|kdj|rsi|boll|ma, indices do not provide MAVOL - Skill tool:
get_stock_indicator、get_etf_indicator、get_bond_technical_indicator、get_index_indicator - Python convenience functions: stocks, ETFs, and convertible bonds provide
get_<market>_macd|mavol|kdj|rsi|boll|ma; indices provideget_index_macd|kdj|rsi|boll|ma。
General request example:
{
"indicator": "mavol",
"stock_code": "600000.SH",
"level": "daily",
"start_time": "2026-01-01",
"end_time": "2026-07-15",
"mavol_periods": [5, 10],
"vol_type": "share",
"page": 0,
"page_size": 10000
}
levelsupportsdaily/1min/5min/15min/30min/60min, only one code is supported at a time.- Stocks support
adjust=none/qfq; ETFs, convertible bonds, and indices are currently calculated based on unadjusted quotes. - Index requests use
index_code, for example000001.SH; the minute quote source does not include volume, so minute-level indicator responses do not returnvol。 - All parameters marked as optional with default values can be omitted; when not provided, the server uses the default values.
volTypecan be omitted, defaultshare(shares);pagecan be omitted, default0;page_sizecan be omitted, default10000, maximum10000。- MACD's
fast_period、slow_period、signal_periodcan all be omitted, with defaults of12、26、9, andslow_periodmust be greater thanfast_period。 - MAVOL default
mavol_periods=[5,10], returns fields such asmavol5、mavol10. - MA default
ma_periods=[5,10,20,30,60], returns fields such asma5、ma10. - The period parameters of MAVOL, MA, KDJ, RSI, and BOLL can also all be omitted, using the default values shown in the documentation respectively.
- MACD returns
dif/dea/macd; KDJ returnsk/d/j; RSI returnsrsi; BOLL returnsboll_mid/boll_upper/boll_lower。 - The indicator interface reads warm-up K-lines before the requested interval to ensure that the first indicator in the interval is as continuous as possible; pagination still returns based on the total number of records in the requested interval.
3. Real-time intraday data (supports the last 7 days):POST /api/realtime/history and /api/index/realtime/history
- URL:
{baseUrl}/api/realtime/historyor{baseUrl}/api/index/realtime/history - Method:
POST - Headers: same as above
- Request body JSON:
{
"stock_code": "000001.SZ",
"trade_time": "2026-03-15 09:31:00",
"date": "2026-03-15"
}
(For the index interface, the parameter name is index_code)
- Description:
- Get real-time 1-minute-level intraday data, supports the last 7 days, and supports the whole market or specified stocks/indices.
stock_code/index_codeortrade_timeat least one must be provided.- Returned data will be deduplicated based on code +
trade_time.
Calling recommendation (scheduled task pulling whole-market data):
- It is recommended to use the time (
trade_time) to obtain real-time intraday data; one call can obtain whole-market data for a certain minute.- Use a scheduled task to obtain data, getting the previous minute's data every minute.
- It is recommended to start obtaining 2 to 5 seconds after each minute.
- If it cannot be obtained, it is recommended to pause for 1 second and then continue obtaining; retry no more than 60 times to avoid an infinite loop.
- It is recommended to call the interface again to update the data after 15 seconds of each minute to ensure data accuracy.
3.1 Index constituents and weights:POST /api/index/weight
- URL:
{baseUrl}/api/index/weight - Method:
POST - Headers: same as above
- Request body JSON:
{
"index_code": "000300.SH",
"stock_code": "600519.SH",
"trade_date": "2026-03-31",
"page": 0,
"page_size": 2000
}
- Field description:
index_code(required): index codestock_code(optional): constituent stock code, supports a string or array (the backend filters bycon_code)trade_date(optional): supportsYYYY-MMorYYYY-MM-DD; queries filter only by year and monthtrade_dateWhen not provided, the latest month's data for the index is returned by default
- Returned fields:
index_code,stock_code,trade_date,weight
4. Financials and factors (quote factors):POST /api/stock/finance
- URL:
{baseUrl}/api/stock/finance - Method:
POST - Request body JSON(Backend
FinanceDataRequest):
{
"stock_code": "000001.SZ",
"start_time": "2024-01-01",
"end_time": "2024-03-31",
"page": 0,
"page_size": 1000
}
- Main returned fields (each item in the list):
stock_code,stock_name,trade_date,close,turnover_rate,turnover_rate_f,volume_ratio,pe,pe_ttm,pb,ps,ps_ttm,dv_ratio,dv_ttm,total_share,float_share,free_share,total_mv,circ_mv, etc.
Suitable for questions related to valuation analysis, turnover rate, transaction amount, market value, etc.
4.0 Financial indicator report data:POST /api/stock/financial_indicator
- URL:
{baseUrl}/api/stock/financial_indicator - Method:
POST - Request body JSON:
{
"stock_code": "600000.SH",
"end_date": "2025-12-31",
"ann_date": "2026-03-28",
"page": 0,
"page_size": 1000
}
- Field description:
stock_code: Stock code, supports string or arrayend_date: Last date of the reporting period, formatYYYY-MM-DDann_date: Announcement date, formatYYYY-MM-DDstock_code/end_date/ann_dateProvide at least one of the threepageStarts from 0,page_sizemaximum 10000
- Main returned fields (actually returns
stock_financial_indicatorall fields):- Basic identification:
stock_code,ann_date,end_date,update_flag,create_time - Profitability:
eps,dt_eps,profit_dedt,op_income,ebit,ebitda,gross_margin,grossprofit_margin,netprofit_margin - Return on assets:
roe,roe_dt,roe_yearly,roa,roa_yearly,roic,roic_yearly - Cash and per share:
bps,ocfps,cfps - Solvency:
current_ratio,quick_ratio,debt_to_assets - Growth ability:
basic_eps_yoy,netprofit_yoy,dt_netprofit_yoy,tr_yoy,or_yoy,q_sales_yoy,q_netprofit_yoy - R&D investment:
rd_exp
- Basic identification:
- Complete returned fields: returns
stock_financial_indicatorall fields (exceptupdate_flag、create_time)。
4.0.1 Income statement data:POST /api/stock/income
- URL:
{baseUrl}/api/stock/income - Method:
POST - Request body JSON:
{
"stock_code": "600000.SH",
"end_date": "2025-12-31",
"ann_date": "2026-03-28",
"page": 0,
"page_size": 1000
}
- Field description:
stock_code: Stock code, supports string or arrayend_date: Last date of the reporting period, formatYYYY-MM-DDann_date: Announcement date, formatYYYY-MM-DDstock_code/end_date/ann_dateProvide at least one of the threepageStarts from 0,page_sizemaximum 10000
- Complete returned fields: returns
stock_incomeall fields (exceptupdate_flag、create_time)。
4.0.2 Balance sheet data:POST /api/stock/balancesheet
- URL:
{baseUrl}/api/stock/balancesheet - Method:
POST - Request parameters are exactly the same as
/api/stock/income(stock_code/end_date/ann_dateProvide at least one of the three). - Complete returned fields: returns
stock_balancesheetall fields (exceptupdate_flag、create_time)。
4.0.3 Cash flow statement data:POST /api/stock/cashflow
- URL:
{baseUrl}/api/stock/cashflow - Method:
POST - Request parameters are exactly the same as
/api/stock/income(stock_code/end_date/ann_dateProvide at least one of the three). - Complete returned fields: returns
stock_cashflowall fields (exceptupdate_flag、create_time)。
4.1 Main force capital flow details:POST /api/stock/main_fund_flow
- URL:
{baseUrl}/api/stock/main_fund_flow - Method:
POST - Request body JSON:
{
"start_time": "2026-04-03",
"end_time": "2026-04-03",
"stock_code": ["600000.SH", "000001.SZ"],
"page": 0,
"page_size": 1000
}
- Field description:
start_time/end_time: Trading date range, formatYYYY-MM-DD, closed interval; whenstart_time = end_timethe current day's data can be queriedstock_code: Stock code, supports string or arraystock_codeand (start_time+end_time) provide at least onepageStarts from 0,page_sizemaximum 10000
- Tier classification:
- Small order: transaction amount < 50,000
- Medium order: transaction amount 50,000 ~ 200,000
- Large order: transaction amount 200,000 ~ 1,000,000
- Extra-large order: transaction amount >= 1,000,000
- Main returned fields:
trade_date,stock_codebuy_sm_vol,buy_sm_amount,sell_sm_vol,sell_sm_amountbuy_md_vol,buy_md_amount,sell_md_vol,sell_md_amountbuy_lg_vol,buy_lg_amount,sell_lg_vol,sell_lg_amountbuy_elg_vol,buy_elg_amount,sell_elg_vol,sell_elg_amountnet_mf_vol,net_mf_amount
4.2 Main force capital flow overview:POST /api/stock/main_fund_flow_overview
- URL:
{baseUrl}/api/stock/main_fund_flow_overview - Method:
POST - Request body JSON:
{
"start_time": "2026-04-03",
"end_time": "2026-04-03",
"stock_code": "600000.SH",
"page": 0,
"page_size": 1000
}
- Field description:
start_time/end_time: Trading date range, formatYYYY-MM-DD, closed interval; whenstart_time = end_timethe current day's data can be queriedstock_code: Stock code, supports string or arraystock_codeand (start_time+end_time), provide at least onepagestarts from 0,page_sizemaximum 10000
- Classification criteria:
- Small order: transaction amount < 50,000
- Medium order: transaction amount 50,000 ~ 200,000
- Large order: transaction amount 200,000 ~ 1,000,000
- Extra-large order: transaction amount >= 1,000,000
- Main returned fields:
trade_date,stock_code,name,close,pct_changenet_amount,net_amount_ratebuy_elg_amount,buy_elg_amount_ratebuy_lg_amount,buy_lg_amount_ratebuy_md_amount,buy_md_amount_ratebuy_sm_amount,buy_sm_amount_rate
4.3 Chip peak distribution:POST /api/stock/cyq_chips
- URL:
{baseUrl}/api/stock/cyq_chips - Method:
POST - Request body JSON:
{
"start_time": "2026-04-03",
"end_time": "2026-04-03",
"stock_code": "600000.SH",
"page": 0,
"page_size": 1000
}
- Field description:
start_time/end_time: trading date range, formatYYYY-MM-DD, closed interval; whenstart_time = end_timeyou can query the current day's datastock_code: stock code, supports string or arraystock_codeand (start_time+end_time), provide at least onepagestarts from 0,page_sizemaximum 10000
- Main returned fields:
trade_date,stock_code,price,percent
4.4 Stock basic information list:GET /api/stock/list
- URL:
{baseUrl}/api/stock/list - Method:
GET - Query parameters:
stock_code(optional): exact stock code filterpage: default 0page_size: default 20000
- Response (wrapped in the unified
successstructure):data.totaldata.list: includesstock_code,name,area,industry,list_date,symbol,list_status,delist_date,is_hs, etc.
When the user only gives descriptions such as stock name, region, industry, etc., you can first obtain the matching list through this interface, then prompt the user to select a specific code.
5. Trading calendar:GET/POST /api/basic/calendar
- URL:
{baseUrl}/api/basic/calendar - Method:
GET/POST - Request parameters:
start_time:YYYY-MM-DDend_time:YYYY-MM-DD
- Response:
datais an array, each item containsdate,is_open(1 for trading day, 0 for market closed).
When the user asks "which days in a certain period are trading days", "when is the next trading day", etc., this interface can be used.
6. Stock condition search:POST /api/stock/search
- URL:
{baseUrl}/api/stock/search - Method:
POST - Headers:
Content-Type: application/jsonapiKey: <STOCK_API_KEY>
- Request body JSON:
{
"query": "pe_ttm < 20 且 turnover_rate > 3%",
"stock_code": "000001.SZ",
"date": "2024-01-01",
"page": 0,
"page_size": 100,
"sort_by": "pe_ttm",
"sort_order": "asc"
}
- Field description:
query(required): search condition, supports natural language or expressions- Supported formats:
pe_ttm < 20、turnover_rate > 3%、pe_ttm < 20 且 turnover_rate > 3% - Supports Chinese:
市盈率小于20、换手率大于3% - Supported units:
circ_mv > 100亿、volume > 1000万
- Supported formats:
stock_code(optional): exact stock code filterdate(optional): date, formatYYYY-MM-DDorMM-DD(defaults to the current year)- No date provided: query
stock_snapshot_daily(latest real-time data) - Date provided: query
stock_finance_daily(historical financial data)
- No date provided: query
page: page number, starts from 0page_size: number per page,maximum 1000sort_by(optional): sort field, such aspe_ttm、turnover_ratesort_order(optional): sort directionascordesc(default desc)
- Supported fields:
price/close: stock price/closing pricepct_chg: price change percentageturnover_rate: turnover ratepe/pe_ttm: price-to-earnings ratiopb: price-to-book ratiototal_mv/circ_mv: total market value/circulating market valuetotal_share/float_share: total share capital/circulating share capitalvolume/turnover: trading volume/trading amountdividend_ratio: Dividend yield
- Response body:
data.total: Total record countdata.list: List of matching stocks
Important reminder: This endpoint per requestreturns at most 1000 records. If you need more results, use pagination.
Use cases: Users need to screen stocks based on financial indicators, such as "help me find stocks with PE<20", "which stocks have a turnover rate greater than 5%".
7. Futures data
- Get contract basic information (
get_future_basic): Get basic information data for futures contracts, including multiplier, delivery method, listing date, etc. - Get continuous main contract mapping (
get_future_mapping): Get the mapping relationship between futures main continuous or continuous contracts and actual monthly contracts. - Get real-time intraday (
get_future_realtime_history): CallPOST /api/future/realtime/historyto get real-time 1-minute intraday. Supportscontract_code(string or array),contract_type(main/contract)、trade_time、date、pageandpage_size; defaultpage=0、page_size=2000, maximum 10000 per page. When no date is passed, queries the current day in Shanghai time zone, and only supports the most recent 7 calendar days; when night trading crosses midnight, query by two calendar days separately. Returnsdata.date、data.totalanddata.list, list fields includecontract_code、contract_type、trade_time、OHLC、vol、amount、oi. This tool reuses futures minute K-line permissions. - Get minute K-line data (
get_future_minute): Get historical minute K-line data for futures contracts.
8. Call auction data:POST /api/stock/call_auction
- URL:
{baseUrl}/api/stock/call_auction - Method:
POST - Headers:
apiKey: <STOCK_API_KEY> - Request body JSON:
{
"stock_code": "000001.SZ",
"start_time": "2024-01-01 09:15:00",
"end_time": "2024-01-01 09:25:00",
"page": 0,
"page_size": 100
}
- Field description:
start_time/end_time: Time range, supports date only (automatically fills in time)page_size:maximum 10000
- Return fields:
stock_code,name,trade_time,close,open,high,low,pre_close,vol,amount,turnover_rate,pe,pb,pe_ttm,dv_ttm, etc.
Important reminder: Per requestreturns at most 10000 records。
9. Closing snapshot data:POST /api/stock/closing_snapshot
- URL:
{baseUrl}/api/stock/closing_snapshot - Method:
POST - Headers:
apiKey: <STOCK_API_KEY> - Request body JSON:
{
"stock_code": "000001.SZ",
"start_time": "2024-01-01 15:00:00",
"end_time": "2024-01-01 15:05:00",
"page": 0,
"page_size": 100
}
- Return fields: includes complete snapshot data such as price, volume, bid/ask, change percentage, etc.
Important reminder: Per requestreturns at most 10000 records。
10. Stock snapshot data (real-time/historical):POST /api/stock/snapshot_daily
- URL:
{baseUrl}/api/stock/snapshot_daily - Method:
POST - Headers:
apiKey: <STOCK_API_KEY> - Request body JSON:
{
"stock_code": "000001.SZ",
"date": "2024-01-01",
"page": 0,
"page_size": 10000
}
- Features:
- Real-time snapshot: If
dateis not provided or today's date is provided, the system preferentially reads the latest real-time snapshot data from the Redis cache. - Historical snapshot: If a historical date is provided, the system returns the historical snapshot data for that day.
- Return fields include 40+ indicators: price, volume, market value, PE, PB, bid/ask, etc.
page_size:maximum 10000。
- Real-time snapshot: If
Important reminder: This is the main endpoint for obtaining real-time market snapshots.
11. Push historical data:POST /api/stock/snapshot_push_history
- URL:
{baseUrl}/api/stock/snapshot_push_history - Method:
POST - Headers:
apiKey: <STOCK_API_KEY> - Description: Query WebSocket push history, returns an array of snapshots
12. Suspension information:GET /api/stock/suspension
- URL:
{baseUrl}/api/stock/suspension - Method:
GET - Headers:
apiKey: <STOCK_API_KEY> - Query parameters:
stock_code(optional)trade_date(optional)page,page_size
13. Adjustment factors:POST /api/stock/adj_factor
- URL:
{baseUrl}/api/stock/adj_factor - Method:
POST - Headers:
apiKey: <STOCK_API_KEY> - Request body JSON:
{
"stock_code": "000001.SZ",
"start_time": "2024-01-01",
"end_time": "2024-01-31",
"page": 0,
"page_size": 10000
}
- Returned fields:
stock_code,stock_name,trade_date,factor_a,factor_b(custom adjustment factor)
Important reminder: single requestreturns at most 10000 records。
14. Data download (full-day market data):POST /api/stock/daily_dump
- URL:
{baseUrl}/api/stock/daily_dump - Method:
POST - Headers:
apiKey: <STOCK_API_KEY> - Request body JSON:
{
"date": "2024-01-01",
"level": "daily"
}
levelParameters:daily|1min|5min|15min|30min|60min- Return: gzip-compressed JSON file (high-performance download via Nginx)
- Restrictions:
- Can only downloadthe most recent 90 daysof data
- The data volume is large; each user can download each date at most 10 timesper day. After exceeding this, downloading that date will be prohibited for three days; please contact customer service to unblock
- Current-day data can only be downloaded after market close (after 15:05)
15. Convertible bond daily line data:POST /api/bond/daily
- URL:
{baseUrl}/api/bond/daily - Method:
POST - Headers:
apiKey: <STOCK_API_KEY> - Request body JSON:
{
"stock_code": "128136.SZ",
"start_time": "2024-01-01",
"end_time": "2024-01-31",
"page": 0,
"page_size": 10000
}
- Field description:
stock_code(optional): convertible bond code, e.g.128136.SZ, supports arraysstart_time、end_time: format isYYYY-MM-DD
- Returned fields:
stock_code,stock_name,trade_date,open,high,low,close,prev_close,change,pct_chg,factor,vol,amount
Single requestreturns at most 10000 records。
16. Convertible bond daily indicator data:POST /api/bond/indicator_daily
- URL:
{baseUrl}/api/bond/indicator_daily - Method:
POST - Headers:
apiKey: <STOCK_API_KEY> - Request body JSON:
{
"stock_code": "128136.SZ",
"start_date": "2024-01-01",
"end_date": "2024-01-31",
"page": 0,
"page_size": 10000
}
- Field description:
stock_code(optional): convertible bond code, supports arraysstart_date、end_date(optional): date range, at least one must be provided
- Returned fields:
stock_code,stock_name,trade_date,name,pre_close,open,high,low,close,change,pct_chg,vol,amount,remain_size,pure_bond,pure_premium,conv_value,conv_premiumetc.
Single requestreturns at most 10000 records。
17. Convertible bond list:POST /api/bond/list
- URL:
{baseUrl}/api/bond/list - Method:
POST - Headers:
apiKey: <STOCK_API_KEY> - Request body JSON:
{
"bond_code": "128136.SZ",
"stock_code": "000001.SZ",
"exchange": "SZSE",
"page": 0,
"page_size": 10000
}
- Field description:
bond_code(optional): convertible bond code filterstock_code(optional): underlying stock code filterexchange(optional): exchange filter (SZSE/SSE)
- Returned fields: includes
bond_code,bond_name,bond_short_name,conv_code,stock_code,stock_nameand other complete convertible bond information
18. Price limit-up detail data:POST /api/stock/limit_up
- URL:
{baseUrl}/api/stock/limit_up - Method:
POST - Headers:
apiKey: <STOCK_API_KEY> - Request body JSON:
{
"stock_code": ["603716.SH", "000001.SZ"],
"start_time": "2026-04-10",
"end_time": "2026-04-10",
"page": 0,
"page_size": 10000
}
- Field description:
stock_code(optional): stock code, supports string or arraystart_time、end_time(required): date range, formatYYYY-MM-DDpage: page number, starting from 0page_size: number per page, maximum 10000
- Returned fields:
- Basic information:
trade_date,stock_code,stock_name,price,change_percent - Sealing order information:
sealed_volume,sealed_amount,sealed_turnover_ratio,sealed_flow_ratio - Limit-up process:
first_limit_time,final_limit_time,open_count,consecutive_days,boards - Business tags:
limit_type,is_limit_up,reason_text
- Basic information:
19. Tonghuashun popularity ranking:GET /api/ths/hot / POST /api/ths/hot
- URL:
{baseUrl}/api/ths/hot - Method:
GET/POST - Headers:
apiKey: <STOCK_API_KEY> - Parameters:
market(optional): hot list type (default: hot stocks). Optional values:热股,ETF,可转债,行业板块,概念板块,期货trade_date(optional): specify trading date, supportsYYYY-MM-DDorYYYYMMDD; if not provided, returns the latest trading day by defaultGETuses Query parameters,POSTuses JSON Body
- Returned fields:
trade_date: trading dateupdate_time: ranking update timelist: hot list data array, includesname(name),code(code),rank(Rank),pct_change(Change %),hot(Heat Value)
20. Limit Up/Down Push WS Subscription:GET {{WS_BASE_URL}}/ws/stream
-
URL:
{{WS_BASE_URL}}/ws/stream?token=<STOCK_API_KEY>&types=... -
Protocol:WebSocket
-
Authentication: Query parameter
token(use API Key) -
Subscription parameters:
types(comma-separated, multiple selections supported) -
Six types of pushes and subscription values:
- Limit up push:
limit_up - Limit up seal broken:
limit_up_broken - Limit up stock data push (aggregated):
stock_limit_up(includeslimit_up+limit_up_broken) - Limit down push:
limit_down - Limit down seal broken:
limit_down_broken - Limit down stock data push (aggregated):
stock_limit_down(includeslimit_down+limit_down_broken)
- Limit up push:
-
Connection Example:
{{WS_BASE_URL}}/ws/stream?token=<STOCK_API_KEY>&types=stock_limit_up,stock_limit_down
-
Dynamic Subscription Example:
{"action":"subscribe","types":["stock_limit_up","stock_limit_down"]}
- Push Message Example:
{
"type": "stock_limit_event",
"data": {
"type": "limit_up",
"stock_code": "600000.SH",
"stock_name": "浦发银行",
"change_rate": 10.0,
"source": "fast",
"timestamp": "2026-04-17 11:23:45"
}
}
- Field Description:
- Outer
typeis fixed tostock_limit_event data.typePossible values:limit_up/limit_up_broken/limit_down/limit_down_broken- Common fields:
stock_code,stock_name,change_rate,source,timestamp
- Outer
Calling Strategy and Best Practices
- API Key Acquisition and Usage
- Prefer reading from the environment variable
STOCK_API_KEY(injected by OpenClaw according toskills.entries.openclaw-stock-skill.apiKey). - If the environment variable is missing, you may make calls based on the value entered by the user in the Skill configuration panel (which is usually also mapped to this environment variable).
- Do not pass
apiKeyorapi_keyin the URL Query, as the backend will treat it as a security risk.
- Prefer reading from the environment variable
- Error Handling
code = 401: API Key is invalid or missing; the user should be prompted to check the API Key in the OpenClaw Skill configuration.code = 403: insufficient permissions or download count/access count limit reached; explain the permission/rate-limit constraints to the user.code = 429: requests are too frequent; reduce the call frequency or prompt the user to try again later.
- Pagination and Large Data Volumes
- If
data.totalis very large, the agent should request in batches and pages, and summarize in the response, rather than fetching all data at once. - For large data volumes at the minute level or tick level, confirm the time range and precision with the user in the conversation to avoid unnecessary massive downloads.
- If
- Units and Precision
- Fields such as price and trading volume are already uniformly kept to 2 decimal places on the backend; if they need to be displayed to the user, they can be used directly or formatted further.
- Dividend-related fields have already been processed in the valuation interface, such as 10-year averaging; when explaining, note the basis (annualized, last 10 years, etc.).
Usage Examples (Ideas for the Agent)
- When the user says:"Help me check the daily K-line for 000001.SZ in January 2024"
- Call
POST /api/stock/daily,stock_code = "000001.SZ", with the time range from2024-01-01to2024-01-31。 - For the returned
data.list, organize and summarize the change percentage, maximum drawdown, average trading amount, etc.
- Call
- When the user says:"Which days this week are trading days?"
- Calculate the one-week range based on the current date, call
GET/POST /api/basic/calendar。 - List the dates of
is_open = 1and explain which ones are trading days.
- Calculate the one-week range based on the current date, call
This skill does not include additional executable scripts and works entirely by guiding the agent to call existing HTTP interfaces. All requests should preferentially use STOCK_API_KEY environment variables, and comply with the above rate limiting and security conventions.