> ## 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.

# 股票数据

> TypeScript SDK 股票数据模块

## 公司信息

### overview()

获取公司概览信息。

```typescript theme={null}
// 通过股票代码查询（支持多个，逗号分隔）
const info = await client.stock.overview({ symbols: 'AAPL,00700' });
console.log(info);

// 通过股票名称查询（支持多个，逗号分隔）
const info2 = await client.stock.overview({ names: '腾讯,苹果' });
console.log(info2);
```

**参数：**

| 参数                | 类型       | 必填 | 说明                             |
| ----------------- | -------- | -- | ------------------------------ |
| `options.symbols` | `string` | 否  | 股票代码，支持多个，用逗号分隔，如 `AAPL,00700` |
| `options.names`   | `string` | 否  | 股票名称，支持多个，用逗号分隔，如 `腾讯,苹果`      |

**返回值：** `Promise<CompanyOverview>` - 公司信息

***

### shareholders()

获取主要股东列表。

```typescript theme={null}
const shareholders = await client.stock.shareholders('AAPL');
shareholders.forEach(holder => {
  console.log(holder.name, holder.percentage);
});

// 获取流通股股东
const outstandingShareholders = await client.stock.shareholders('AAPL', {
  type: 'outstanding_shareholders',
  limit: 20
});
```

**参数：**

| 参数              | 类型       | 必填 | 默认值            | 说明                                                           |
| --------------- | -------- | -- | -------------- | ------------------------------------------------------------ |
| `symbol`        | `string` | 是  | -              | 股票代码                                                         |
| `options.type`  | `string` | 否  | `shareholders` | 股东类型：`shareholders`（全部股东）或 `outstanding_shareholders`（流通股股东） |
| `options.limit` | `number` | 否  | `10`           | 返回数量                                                         |

**返回值：** `Promise<Shareholder[]>` - 股东列表数组

***

## 财务报表

### incomeStatement()

获取利润表数据。

```typescript theme={null}
const income = await client.stock.incomeStatement('AAPL', {
  period: 'quarterly',
  limit: 8
});
console.log(income[0].revenue, income[0].netIncome);
```

**参数：**

| 参数                      | 类型       | 必填 | 默认值      | 说明                                            |
| ----------------------- | -------- | -- | -------- | --------------------------------------------- |
| `symbol`                | `string` | 是  | -        | 股票代码                                          |
| `options.period`        | `string` | 否  | `annual` | 报告期间：`annual`（年报）或 `quarterly`（季报）            |
| `options.limit`         | `number` | 否  | `8`      | 返回期数                                          |
| `options.startDate`     | `string` | 否  | -        | 开始日期（YYYY-MM-DD）                              |
| `options.endDate`       | `string` | 否  | -        | 结束日期（YYYY-MM-DD）                              |
| `options.calendar`      | `string` | 否  | `fiscal` | 日历类型：`calendar` 或 `fiscal`                    |
| `options.fiscalYear`    | `string` | 否  | -        | 指定财年（如 `2023`）                                |
| `options.fiscalQuarter` | `string` | 否  | -        | 指定财季（Q1, Q2, Q3, Q4, FY, H1, `Q3 (9 months)`） |

**返回值：** `Promise<FinancialStatement[]>` - 利润表数据数组

***

### balanceSheet()

获取资产负债表数据。

```typescript theme={null}
const balance = await client.stock.balanceSheet('AAPL', { period: 'annual' });
console.log(balance[0].totalAssets, balance[0].totalLiabilities);
```

**参数：**

| 参数                      | 类型       | 必填 | 默认值      | 说明                          |
| ----------------------- | -------- | -- | -------- | --------------------------- |
| `symbol`                | `string` | 是  | -        | 股票代码                        |
| `options.period`        | `string` | 否  | `annual` | 报告期间：`annual` 或 `quarterly` |
| `options.limit`         | `number` | 否  | `8`      | 返回期数                        |
| `options.startDate`     | `string` | 否  | -        | 开始日期（YYYY-MM-DD）            |
| `options.endDate`       | `string` | 否  | -        | 结束日期（YYYY-MM-DD）            |
| `options.calendar`      | `string` | 否  | `fiscal` | 日历类型：`calendar` 或 `fiscal`  |
| `options.fiscalYear`    | `string` | 否  | -        | 指定财年（如 `2023`）              |
| `options.fiscalQuarter` | `string` | 否  | -        | 指定财季（Q1, Q2, Q3, Q4, FY）    |

**返回值：** `Promise<FinancialStatement[]>` - 资产负债表数据数组

***

### cashflowStatement()

获取现金流量表数据。

```typescript theme={null}
const cashflow = await client.stock.cashflowStatement('AAPL');
console.log(cashflow[0].operatingCashflow);

// 带参数查询
const cashflow2 = await client.stock.cashflowStatement('AAPL', {
  period: 'quarterly',
  limit: 8,
  calendar: 'fiscal'
});
```

**参数：**

| 参数                      | 类型       | 必填 | 默认值      | 说明                                                 |
| ----------------------- | -------- | -- | -------- | -------------------------------------------------- |
| `symbol`                | `string` | 是  | -        | 股票代码                                               |
| `options.period`        | `string` | 否  | `annual` | 报告期间：`annual`、`quarterly` 或 `cumulative quarterly` |
| `options.limit`         | `number` | 否  | `8`      | 返回期数                                               |
| `options.startDate`     | `string` | 否  | -        | 开始日期（YYYY-MM-DD）                                   |
| `options.endDate`       | `string` | 否  | -        | 结束日期（YYYY-MM-DD）                                   |
| `options.calendar`      | `string` | 否  | `fiscal` | 日历类型：`calendar` 或 `fiscal`                         |
| `options.fiscalYear`    | `string` | 否  | -        | 指定财年（如 `2023`）                                     |
| `options.fiscalQuarter` | `string` | 否  | -        | 指定财季（Q1, Q2, Q3, Q4, FY, H1, `Q3 (9 months)`）      |

**返回值：** `Promise<FinancialStatement[]>` - 现金流量表数据数组

***

### revenueBreakdown()

获取营收分解数据。

```typescript theme={null}
const breakdown = await client.stock.revenueBreakdown('AAPL', {
  limit: 6
});
```

**参数：**

| 参数                   | 类型       | 必填 | 默认值 | 说明                |
| -------------------- | -------- | -- | --- | ----------------- |
| `symbol`             | `string` | 是  | -   | 股票代码              |
| `options.period`     | `string` | 否  | -   | 报告周期（如 `FY`、`Q2`） |
| `options.limit`      | `number` | 否  | `6` | 返回记录数             |
| `options.startDate`  | `string` | 否  | -   | 开始日期（YYYY-MM-DD）  |
| `options.endDate`    | `string` | 否  | -   | 结束日期（YYYY-MM-DD）  |
| `options.fiscalYear` | `string` | 否  | -   | 指定财年（如 `2023`）    |

**返回值：** `Promise<FinancialStatement[]>` - 营收分解数据数组

***

## 行情数据

### quote()

获取股票行情数据（当前和历史价格）。

```typescript theme={null}
const quote = await client.stock.quote('AAPL', {
  startDate: '2024-01-01',
  endDate: '2024-06-30'
});
quote.forEach(p => console.log(p.date, p.close, p.volume));
```

**参数：**

| 参数                  | 类型       | 必填 | 说明                   |
| ------------------- | -------- | -- | -------------------- |
| `symbol`            | `string` | 是  | 股票代码                 |
| `options.startDate` | `string` | 否  | 开始日期，格式：`YYYY-MM-DD` |
| `options.endDate`   | `string` | 否  | 结束日期，格式：`YYYY-MM-DD` |

**返回值：** `Promise<PriceData[]>` - 股票行情数据数组

***

### indexQuote()

获取指数行情数据。

```typescript theme={null}
const prices = await client.stock.indexQuote('HSI', {
  startDate: '2024-01-01',
  endDate: '2024-06-30'
});
prices.forEach(p => console.log(p.date, p.close));

// 获取标普500指数
const spx = await client.stock.indexQuote('SPX');
```

**参数：**

| 参数                  | 类型       | 必填 | 说明                                           |
| ------------------- | -------- | -- | -------------------------------------------- |
| `symbol`            | `string` | 是  | 指数代码，如 `HSI`（恒生指数）, `SPX`（标普500）, `DJI`（道琼斯） |
| `options.startDate` | `string` | 否  | 开始日期，格式：`YYYY-MM-DD`                         |
| `options.endDate`   | `string` | 否  | 结束日期，格式：`YYYY-MM-DD`                         |

**返回值：** `Promise<PriceData[]>` - 指数价格数据数组

***

## 指数和行业

### indexConstituents()

获取指数成分股列表。

```typescript theme={null}
// 获取沪深300指数成分股
const csi300 = await client.stock.indexConstituents('000300');
console.log(csi300);

// 获取创业板指数成分股
const chinext = await client.stock.indexConstituents('399006');
```

**参数：**

| 参数       | 类型       | 必填 | 说明                                                     |
| -------- | -------- | -- | ------------------------------------------------------ |
| `symbol` | `string` | 是  | 指数代码，如 `000300`（沪深300）, `000016`（上证50）, `399006`（创业板指） |

**返回值：** `Promise<IndexConstituent[]>` - 成分股列表数组

***

### indexTrackingFunds()

获取指数跟踪基金列表。

```typescript theme={null}
// 获取沪深300指数跟踪基金
const funds = await client.stock.indexTrackingFunds('000300');
console.log(funds);

// 获取中证500指数跟踪基金
const funds500 = await client.stock.indexTrackingFunds('000905');
```

**参数：**

| 参数       | 类型       | 必填 | 说明                                                      |
| -------- | -------- | -- | ------------------------------------------------------- |
| `symbol` | `string` | 是  | 指数代码，如 `000300`（沪深300）, `000016`（上证50）, `000905`（中证500） |

**返回值：** `Promise<IndexFund[]>` - 跟踪基金列表数组

***

### industryConstituents()

获取行业成分股列表。

```typescript theme={null}
// 获取中国军工行业成分股
const stocks = await client.stock.industryConstituents('cn', '军工');
console.log(stocks);

// 使用特定分类标准
const stocksSW = await client.stock.industryConstituents('cn', '军工', 'sw');
```

**参数：**

| 参数       | 类型       | 必填 | 说明                                                                  |
| -------- | -------- | -- | ------------------------------------------------------------------- |
| `market` | `string` | 是  | 股票市场：`cn`（中国）, `hk`（香港）, `us`（美国）                                   |
| `name`   | `string` | 是  | 行业名称，如 `军工`, `Technology`                                           |
| `type`   | `string` | 否  | 行业分类类型：CN 使用 `sw`（申万，默认）或 `wind`；HK 使用 `hs`（恒生，默认）；US 使用 `GICS`（默认） |

**返回值：** `Promise<IndustryConstituent[]>` - 成分股列表数组

***

## 日历

### earningsCalendar()

财报日历。

```typescript theme={null}
const calendar = await client.stock.earningsCalendar({
  market: 'us',
  startDate: '2024-01-01',
  endDate: '2024-01-31'
});

// 查询特定股票的财报日程
const appleEarnings = await client.stock.earningsCalendar({
  market: 'us',
  startDate: '2024-01-01',
  endDate: '2024-12-31',
  symbol: 'AAPL'
});
```

**参数：**

| 参数                  | 类型       | 必填 | 说明                                |
| ------------------- | -------- | -- | --------------------------------- |
| `options.market`    | `string` | 是  | 股票市场：`cn`（中国）, `hk`（香港）, `us`（美国） |
| `options.startDate` | `string` | 是  | 开始日期（YYYY-MM-DD）                  |
| `options.endDate`   | `string` | 是  | 结束日期（YYYY-MM-DD）                  |
| `options.symbol`    | `string` | 否  | 股票代码，如 `AAPL`                     |

**返回值：** `Promise<EarningsEvent[]>` - 财报日历事件列表

***

### ipoCalendarHK()

港股 IPO 日历。

```typescript theme={null}
// 查询已定价的 IPO
const pricedIPOs = await client.stock.ipoCalendarHK('Priced');

// 查询正在招股的 IPO
const filingIPOs = await client.stock.ipoCalendarHK('Filing');

// 查询待上市的 IPO
const pendingIPOs = await client.stock.ipoCalendarHK('Pending');
```

**参数：**

| 参数       | 类型       | 必填 | 说明                                                                    |
| -------- | -------- | -- | --------------------------------------------------------------------- |
| `status` | `string` | 是  | IPO 状态：`Priced`（已定价）, `Filing`（招股中）, `Pending`（待上市）, `Withdrawn`（已撤回） |

**返回值：** `Promise<IPOEvent[]>` - IPO 事件列表

***

### ipoCalendarCN()

A 股（沪深北）IPO 日历。所有参数均为可选，不传则返回全部。

```typescript theme={null}
// 查询沪市已上市的 IPO
const listedIPOs = await client.stock.ipoCalendarCN({
  market: 'SH',
  status: 'listed'
});

// 按日期范围查询全市场 IPO
const ipos = await client.stock.ipoCalendarCN({
  startDate: '2026-01-01',
  endDate: '2026-06-20'
});
```

**参数：**

| 参数                  | 类型       | 必填 | 说明                                                                                                                         |
| ------------------- | -------- | -- | -------------------------------------------------------------------------------------------------------------------------- |
| `options.market`    | `string` | 否  | 股票市场：`SH`（沪市）, `SZ`（深市）, `BJ`（北交所）。默认全部                                                                                    |
| `options.startDate` | `string` | 否  | 开始日期（YYYY-MM-DD）                                                                                                           |
| `options.endDate`   | `string` | 否  | 结束日期（YYYY-MM-DD）                                                                                                           |
| `options.status`    | `string` | 否  | IPO 状态：`listed`（已上市）, `delisted`（已退市）, `currently_issuing`（发行中）, `deferred_issuance`（暂缓发行）, `issuance_complete`（发行完成）。默认全部 |

**返回值：** `Promise<IPOEvent[]>` - IPO 事件列表

***

## 类型定义

```typescript theme={null}
interface CompanyOverview {
  symbol: string;
  name: string;
  sector: string;
  industry: string;
  marketCap: number;
  price: number;
  description?: string;
}

interface Shareholder {
  name: string;
  percentage: number;
  shares?: number;
  type?: string;
}

interface FinancialStatement {
  date: string;
  revenue?: number;
  grossProfit?: number;
  operatingIncome?: number;
  netIncome?: number;
  eps?: number;
  ebitda?: number;
  totalAssets?: number;
  totalLiabilities?: number;
  totalEquity?: number;
  cash?: number;
  totalDebt?: number;
  operatingCashflow?: number;
  investingCashflow?: number;
  financingCashflow?: number;
}

interface PriceData {
  date: string;
  open: number;
  high: number;
  low: number;
  close: number;
  volume: number;
  marketCap?: number;
}

interface IndexConstituent {
  market: string;
  symbol: string;
}

interface IndexFund {
  symbol: string;
  shortName: string;
  name: string;
}

interface IndustryConstituent {
  symbol: string;
  market: string;
  name: string;
  typeName?: string;
  industryOneLevelName?: string;
  industrySecondLevelName?: string;
  industryThirdLevelName?: string;
}

interface EarningsEvent {
  symbol: string;
  name: string;
  date: string;
  time?: string;
  estimate?: number;
  actual?: number;
}

interface IPOEvent {
  symbol: string;
  name: string;
  status: string;
  priceRange?: string;
  expectedDate?: string;
  shares?: number;
}
```
