query_fx
Retrieve foreign exchange rates for central parity, Bank of China quotes, offshore USDCNH, or cross pairs, and save the data to a CSV file.
Instructions
Query FX rates. Output is written to file_path as CSV. kind=mid: 央行人民币中间价(单位为 100 外币,自 1994 起;currency 过滤币种如 usd,eur). kind=bochina: 中行牌价(约 2012 起,symbol 用币种中文名如 美元;起止日期必填,长区间分页拉取较慢). kind=usdcnh: 离岸人民币 USDCNH 日线(Yahoo). kind=cross: 交叉盘日线,pair 如 EUR/USD(Yahoo,不可达时明确报错).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | Yes | Query type | |
| pair | No | FX pair (cross only), e.g. EUR/USD or EURUSD | |
| symbol | No | Currency Chinese name (bochina only), e.g. 美元; note 港币 not 港元 | |
| currency | No | Comma-separated currency codes (mid only), e.g. usd,eur; default all 25 | |
| end_date | No | End date YYYY-MM-DD (required for bochina) | |
| file_path | Yes | Output CSV file path | |
| start_date | No | Start date YYYY-MM-DD (required for bochina) |