agentsclimarketplace

Index ohlcs

Skill FTShare-Lab/FTShare-skills/ftshare-market-data/sub-skills/index-ohlcs

单只指数 OHLC K 线(market.ft.tech)。用户问某只指数的 K 线、日线/周线/月线、开高低收、前/后复权时使用。From its SKILL.md

Install
npx -y skills add FTShare-Lab/FTShare-skills --skill index-ohlcs

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

SKILL.md

4.0 KB, ~1.4k tokens by cl100k_base, as published. Nobody here has run it

指数 K 线 - 查询单只指数 OHLC K 线(daec,日期区间)

1. 接口描述

项目说明
接口名称查询单只指数 OHLC K 线
外部接口GET /api/v1/market/data/daec/history/ohlcs
请求方式GET
适用场景获取 A 股指定指数在指定日期区间、周期的 K 线(开高低收、成交量、成交额),支持日/周/月线与前/后复权

已从 v2(/app/api/v2/indices/:index/ohlcs)迁移至 daec 统一标的接口(daec/history/ohlcs?symbol=)。对外参数契约有变:由 v2 的 --span/--limit/--until_ts_ms 改为 --since/--until(YYYYMMDD 日期区间)+ --interval + --adjust。注意:daec 不支持年线(YEAR1),响应不再含 MA5/MA10/MA20 与 prev_close。

2. 请求参数

说明:index 为路径参数(必填),since 必填,until/interval/adjust 可选。

参数名类型是否必填描述取值示例备注
indexstring是指数标的键(路径参数,带市场后缀)000001.XSHG、399001.XSHE、920036.BJ沪 .XSHG、深 .XSHE、北交所 .BJ
sincestring是起始日期 YYYYMMDD20240101-
untilstring否结束日期 YYYYMMDD20240131不传则默认今天
intervalstring否K 线周期DayDay(日线,默认)、Week(周线)、Month(月线);无年线
adjuststring否复权类型ForwardForward(前复权,默认)、Backward(后复权)、None(不复权)

3. 响应说明

返回指定指数的 K 线列表,包装为 {"ohlcs": [...]}(daec 返回裸数组,脚本统一包装):

{
    "ohlcs": [
        { "open": "4067.1578", "high": "4093.0405", "low": "4045.6898", "close": "4057.74", "volume": 67602580600, "turnover": "1319801913950.9", "open_ts_ms": "2024-06-03T09:30:00", "close_ts_ms": "2024-06-03T15:00:00" }
    ]
}

Ohlc 单条结构(ohlcs 元素)

字段名类型是否可为空说明单位
openstring否开盘点
highstring否最高点
lowstring否最低点
closestring否收盘点
volumelong否成交量-
turnoverstring否成交额元
open_ts_msstring否该根 K 线开始时间(北京时间 ISO)-
close_ts_msstring否该根 K 线结束时间(北京时间 ISO)-

注:daec 接口不再返回 prev_close、MA5/MA10/MA20、has_last_empty;价格字段为字符串类型(避免浮点精度丢失)。

4. 用法

通过主目录 run.py 调用(必填 --index、--since):

python <RUN_PY> index-ohlcs --index 000001.XSHG --since 20240101 --until 20240131
python <RUN_PY> index-ohlcs --index 399001.XSHE --since 20240101 --until 20260628 --interval Week
python <RUN_PY> index-ohlcs --index 000001.XSHG --since 20230101 --interval Month --adjust Forward

或在子 skill 目录下执行:python scripts/handler.py --index 000001.XSHG --since 20240101 --until 20240131。脚本输出 JSON,请求头已内置 X-Client-Name: ft-claw。

5. 注意事项

  • index、since 为必填;since/until 需为 YYYYMMDD(8 位数字)
  • interval 仅支持 Day/Week/Month(daec 无年线);不传默认 Day
  • adjust 可选 Forward/Backward/None,默认 Forward(前复权);None 为不复权(v2 不支持选复权,daec 为增强)
  • 执行方式:脚本将每条 open_ts_ms/close_ts_ms(毫秒)转为北京时间 ISO 字符串(YYYY-MM-DDTHH:mm:ss)
  • 已知问题:daec 大区间响应(如多年日线,~100KB+)服务端偶发传输中断(IncompleteRead),脚本内置 5 次指数退避重试;如仍失败会非零退出。建议按需缩小日期区间

What ships with it: 2 files

11.6 KB alongside SKILL.md, 2 of them executable

scripts/

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.