> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reportify.cn/llms.txt
> Use this file to discover all available pages before exploring further.

# Macro

## 宏观数据模块

宏观数据模块提供大宗商品价格等宏观经济数据的查询功能。

### 初始化

```typescript theme={null}
import { Reportify } from 'reportify-sdk';

const client = new Reportify({ apiKey: 'your-api-key' });
```

### 大宗商品价格

获取大宗商品价格数据，支持原油、黄金、天然气、白银、铂金。

```typescript theme={null}
// 获取原油价格
const oil = await client.macro.commodities('oil', {
  startDate: '2026-02-01',
  endDate: '2026-02-09',
});
console.log(oil);
// [{ date: '2026-02-06T00:00:00+08:00', wti_co_sp: 63.77, brent_co_sp: 70.45 }, ...]

// 获取黄金价格
const gold = await client.macro.commodities('gold', {
  startDate: '2026-02-01',
  endDate: '2026-02-09',
});
console.log(gold);
// [{ date: '2026-02-06T00:00:00+08:00', lbma_pm_usd: 4948, sge_pm_cny: 1085.72 }, ...]

// 获取天然气价格
const gas = await client.macro.commodities('gas', {
  startDate: '2026-02-01',
  endDate: '2026-02-09',
});
```

### 参数说明

| 参数名               | 类型     | 必填 | 描述                                    |
| ----------------- | ------ | -- | ------------------------------------- |
| type              | string | 是  | 商品类型：oil, gold, gas, silver, platinum |
| options.startDate | string | 是  | 开始日期（YYYY-MM-DD）                      |
| options.endDate   | string | 是  | 结束日期（YYYY-MM-DD），起止间隔不超过 10 年         |

### 返回类型

返回 `Promise<CommodityData[]>`，每个对象包含 `date` 字段和对应 type 的价格字段：

| type     | 字段                          | 描述                  |
| -------- | --------------------------- | ------------------- |
| oil      | wti\_co\_sp, brent\_co\_sp  | WTI/布伦特原油现货价（美元/桶）  |
| gold     | lbma\_pm\_usd, sge\_pm\_cny | 伦敦金（美元/盎司）/上海金（人民币） |
| gas      | hh\_ng\_sp                  | 亨利港天然气（美元/百万英热单位）   |
| silver   | si\_eur                     | 伦敦银（美元/盎司）          |
| platinum | pl\_usd                     | 伦敦铂金（美元/盎司）         |
