2 个端点 · 商品 · 总体经济
https://api.blave.orgapi-key 与 secret-key 请求头API plan or Blave Agent plan/studio/market/db/ohlcv/<dataset>/<symbol>/<schema> | 名称 | 说明 | 可用值 | 默认 |
|---|---|---|---|
datasetstring · path必填 | 交易所数据集 | GLBX.MDP3(CME)、IFEU.IMPACT(ICE) | |
symbolstring · path必填 | 近月连续合约 | GLBX.MDP3:CL(WTI 原油)、GC(黄金);IFEU.IMPACT:BRN(布兰特原油) | |
schemastring · path必填 | K 棒周期 | ohlcv-1d, ohlcv-1h, ohlcv-1m | |
startstring · query | 起始日 | YYYY-MM-DD | end − 该周期的最大区间 |
endstring · query | 结束日期 | YYYY-MM-DD | 今天(UTC) |
每次请求的最大区间(end − start):ohlcv-1d 3650 天 · ohlcv-1h 730 天 · ohlcv-1m 31 天。
data = requests.get(f"{BASE_URL}/studio/market/db/ohlcv/GLBX.MDP3/CL/ohlcv-1d" , headers=headers, params={"start": "2024-01-01", "end": "2024-12-31"}, timeout=60).json()["data"]# [{"ts": "2024-01-02 00:00:00+00:00", "open": 71.95, "high": 73.64, "low": 70.06, "close": 70.5,# "volume": 263594, "instrument_id": 686071},# {"ts": "2024-01-03 00:00:00+00:00", "open": 70.49, "high": 73.23, "low": 69.28, "close": 73.05,# "volume": 253755, "instrument_id": 686071}, ...]{"dataset", "symbol", "schema", "data": [...]}.
| 字段 | 类型 | 单位 | 说明 |
|---|---|---|---|
ts | string | UTC ISO 格式 | K 棒开盘时间 |
open / high / low / close | float | 美元(原油:每桶;黄金:每盎司) | 价格 |
volume | int | 口 | 成交量 |
instrument_id | int | — | 上游的商品 id,从来源 K 棒原样带出 |
| 状态码 | 回应内容 | 情况 |
|---|---|---|
| 400 | {"error": "Invalid schema. Allowed: [...]"} | 周期不对 |
| 400 | {"error": "Invalid dataset/symbol combination"} | 组合不对 |
| 400 | {"error": "Invalid date format. Use YYYY-MM-DD"} | 日期格式错误 |
| 400 | {"error": "date_range_too_large", "message": "...", "max_days": <n>} | 区间超过上限 |
| 404 | 错误信息 | 没有数据 |
ohlcv-1m 历史,请以 ≤ 31 天为一段分次请求再接起来(一段要几秒)。/studio/market/anue/economic_calendar 全部选填;不筛选会回整份数据(约 1,400 列),所以一律要筛选。
| 名称 | 说明 | 可用值 | 默认 |
|---|---|---|---|
startstring · query | 这个日期(含)之后的事件 | YYYY-MM-DD(台北日期) | 无下限 |
endstring · query | 这个日期(含)之前的事件 | YYYY-MM-DD(台北日期) | 无上限 |
countrystring · query | 国家筛选 | ISO-2 代码,以逗号分隔,不分大小写,例如 US,CN,TW | 所有国家 |
max_priorityint · query | 只留 priority <= max_priority。1 最重要,所以只看大事件 = max_priority=1 | 1 / 2 / 3 | 所有优先级 |
limitint · query | 依事件时间排序后只留前 N 笔 | ≥ 1 | 不限 |
langstring · query | countryName/subject 的显示语言;服务器对照表里没有的名称会维持原样,所以 en 会回中英混杂的结果 | en / zh | en |
params = {"start": "2026-09-16", "end": "2026-09-23", "max_priority": 1, "lang": "zh"}response = requests.get( f"{BASE_URL}/studio/market/anue/economic_calendar" , headers=headers, params=params, timeout=60,)data = response.json()# [{"id": 79382, "startDate": 1790121600, "date": 1788220800, "dateUnit": "month", "time": "16:30",# "countryId": "GB", "countryName": "英國", "areaId": "4",# "subject": "S&P Global Manufacturing PMI - 初值", "subjectTitle": "<9月>", "unit": "point",# "predict": 51.7, "last": 51.7, "real": None, "correct": None, "correctMark": "N",# "place": None, "priority": 1, "type": 2}, ...]一个裸的 JSON 数组(没有包在 {"data": ...} 里)。顺序是数据本身的顺序,除非有设 limit(这时依 startDate、time 排序)。
| 字段 | 类型 | 单位 | 说明 |
|---|---|---|---|
startDate | int | epoch 秒 | 事件的台北日历日期 |
time | string | null | HH:MM 台北时间 | 公布时间;未公布时为 null |
countryId | string | ISO-2 | 国家代码 |
countryName | string | — | 国家名称(依 lang) |
subject | string | — | 指标名称(依 lang) |
subjectTitle | string | — | 期间标签,例如 <7月>、<2季> |
predict | number | null | unit | 市场预期 |
last | number | null | unit | 前值 |
real | number | null | unit | 实际值;公布前为 null |
unit | string | — | e.g. %, point, 億USD |
priority | int | 1–3 | 1 = 最重要(非农就业、利率决议),3 = 最不重要(钻油井数) |
实际回应还带了下列字段,是从上游数据原样带出的。这里只写观察到的内容,不要做更多解读。
| 字段 | 类型 | 观察到的内容 |
|---|---|---|
id | int | 上游的事件 id,例如 79382 |
date | int | 数据所属期间的 epoch 秒,不是公布时间:标示 subjectTitle: "<9月>" 的列,date = 2026-09-01,而 startDate 是 2026-09-23 |
dateUnit | string | month |
type | int | 2 |
areaId | string | "4" |
place | string | null | null |
correct | number | null | null |
correctMark | string | "N" |
| 状态码 | 回应内容 | 情况 |
|---|---|---|
| 400 | {"error": "Invalid date format. Use YYYY-MM-DD"} | start/end 格式错误 |
| 400 | {"error": "max_priority must be an integer"} | max_priority 不是整数 |
| 400 | {"error": "limit must be an integer"} / {"error": "limit must be >= 1"} | limit 不对 |
| 429 | {"error_code": "ERR429", "message": "User rate limit exceeded"} | 每分钟超过 100 次请求 |
200 与 [],意思是「未涵盖」,不是「没有排定的事件」。start/end 时,没有日期的事件会被丢掉;有设 max_priority 时,没有优先级的事件会被丢掉。real 在公布后才会填入。