# AmazingData Adapter 接口调用关系
## 一、核心适配器接口 (DataSourceAdapter 实现)
| 序号 | 公共接口 | 同步方法 | SDK 调用 | 说明 |
|------|----------|----------|----------|------|
| 1 | `connect` | - | `_market_data.login()` | 连接数据源 |
| 2 | `close` | - | - | 关闭连接 |
| 3 | `subscribe_ticks` | - | - | 订阅实时Tick |
| 4 | `fetch_klines` | `_fetch_klines_sync` | `_market_data.query_kline()` | 获取K线数据 |
| 5 | `fetch_symbols` | `_fetch_symbols_sync` | `_base_data.get_code_list()`
`_base_data.get_code_info()`
`_base_data.get_future_code_list()`
`_base_data.get_future_info()` | 获取标的列表 |
| 6 | `fetch_trading_calendar` | `_fetch_calendar_sync` | `_base_data.get_calendar()` | 获取交易日历 |
| 7 | `health_check` | - | `_market_data.is_login()` | 健康检查 |
## 二、数据获取接口 (基础数据)
| 序号 | 公共接口 | 同步方法 | SDK 调用 | 说明 |
|------|----------|----------|----------|------|
| 8 | `get_adj_factor` | - | `_base_data.get_adj_factor()` | 获取复权因子 |
| 9 | `get_backward_factor` | - | `_base_data.get_backward_factor()` | 获取后复权因子 |
| 10 | `get_code_info` | - | `_base_data.get_code_info()` | 获取代码信息 |
| 11 | `get_trading_calendar` | - | `_base_data.get_calendar()` | 获取交易日历(通用) |
## 三、数据获取接口 (财务/股东数据)
| 序号 | 公共接口 | 同步方法 | SDK 调用 | 说明 |
|------|----------|----------|----------|------|
| 12 | `get_balance_sheet` | - | `_info_data.get_balance_sheet()` | 资产负债表 |
| 13 | `get_cash_flow` | - | `_info_data.get_cash_flow()` | 现金流量表 |
| 14 | `get_income_statement` | - | `_info_data.get_income_statement()` | 利润表 |
| 15 | `get_profit_express` | - | `_info_data.get_profit_express()` | 业绩预告 |
| 16 | `get_profit_notice` | - | `_info_data.get_profit_notice()` | 业绩快报 |
| 17 | `get_top10_shareholders` | - | `_info_data.get_share_holder()` | 前十大股东 |
| 18 | `get_shareholder_count` | - | `_info_data.get_holder_num()` | 股东户数 |
| 19 | `get_equity_structure` | - | `_info_data.get_equity_structure()` | 股本结构 |
## 四、数据获取接口 (市场数据)
| 序号 | 公共接口 | 同步方法 | SDK 调用 | 说明 |
|------|----------|----------|----------|------|
| 20 | `get_snapshot` | - | `_market_data.query_kline()` | 获取快照数据 |
| 21 | `get_index_constituents` | - | `_info_data.get_index_constituent()` | 指数成分股 |
| 22 | `get_index_weights` | - | `_info_data.get_index_weight()` | 指数权重 |
| 23 | `get_margin_summary` | - | `_info_data.get_margin_summary()` | 融资融券汇总 |
| 24 | `get_margin_detail` | - | `_info_data.get_margin_detail()` | 融资融券明细 |
| 25 | `get_longhu_bang` | - | `_info_data.get_long_hu_bang()` | 龙虎榜 |
| 26 | `get_block_trading` | - | `_info_data.get_block_trading()` | 大宗交易 |
## 五、数据获取接口 (基金/可转债)
| 序号 | 公共接口 | 同步方法 | SDK 调用 | 说明 |
|------|----------|----------|----------|------|
| 27 | `get_etf_pcf` | - | `_base_data.get_etf_pcf()` | ETF申购赎回清单 |
| 28 | `get_fund_share` | - | `_info_data.get_fund_share()` | 基金份额 |
| 29 | `get_kzz_issuance` | - | `_info_data.get_kzz_issuance()` | 可转债发行 |
## 六、新增分表数据接口
| 序号 | 公共接口 | 同步方法 | SDK 调用 | 说明 |
|------|----------|----------|----------|------|
| 30 | `fetch_kline_base` | `_fetch_kline_base_sync` | `_market_data.query_kline()` | 获取基础K线数据 |
| 31 | `fetch_kline_quote` | `_fetch_kline_quote_sync` | `_market_data.query_kline()`
`_base_data.get_code_info()` | 获取行情指标数据 |
| 32 | `fetch_kline_finance` | `_fetch_kline_finance_sync` | `_market_data.query_kline()`
`_info_data.get_equity_structure()` | 获取财务数据 |
| 33 | `fetch_stock_basic_info` | `_fetch_stock_basic_info_sync` | `_base_data.get_code_list()`
`_base_data.get_code_info()`
`_info_data.get_equity_structure()` | 获取股票基础信息 |
## 七、组合调用详细说明
### 7.1 多次调用同一接口的方法
| 方法 | SDK 调用次数 | 调用详情 |
|------|-------------|----------|
| `fetch_symbols` (stock) | 2次 | 1. `get_code_list()`
2. `get_code_info()` |
| `fetch_symbols` (futures) | 2次 | 1. `get_future_code_list()`
2. `get_future_info()` |
| `fetch_kline_quote` | 2次 | 1. `query_kline()` - 获取K线
2. `get_code_info()` - 获取涨跌停价 |
| `fetch_kline_finance` | 2次 | 1. `get_equity_structure()` - 获取股本
2. `query_kline()` - 获取价格计算市值 |
| `fetch_stock_basic_info` | 3次 | 1. `get_code_list()` - 获取代码列表
2. `get_code_info()` - 获取名称
3. `get_equity_structure()` - 获取上市日期 |
### 7.2 调用链示例
```
fetch_stock_basic_info (async)
└── _fetch_stock_basic_info_sync (sync)
├── _base_data.get_code_list() [第1次SDK调用]
├── _base_data.get_code_info() [第2次SDK调用]
└── _info_data.get_equity_structure() [第3次SDK调用, 循环每个股票]
```
```
fetch_kline_quote (async)
└── _fetch_kline_quote_sync (sync)
├── _market_data.query_kline() [第1次SDK调用, 扩展日期范围]
└── _base_data.get_code_info() [第2次SDK调用, 获取涨跌停价]
```
```
fetch_kline_finance (async)
└── _fetch_kline_finance_sync (sync)
├── _info_data.get_equity_structure() [第1次SDK调用]
└── _market_data.query_kline() [第2次SDK调用]
```
## 八、SDK 对象汇总
| SDK 对象 | 说明 | 主要方法 |
|----------|------|----------|
| `_market_data` | 市场数据 | `login()`, `query_kline()`, `is_login()` |
| `_base_data` | 基础数据 | `get_code_list()`, `get_code_info()`, `get_calendar()`, `get_adj_factor()`, `get_future_code_list()`, `get_etf_pcf()` |
| `_info_data` | 信息数据 | `get_equity_structure()`, `get_share_holder()`, `get_income_statement()`, `get_balance_sheet()`, `get_cash_flow()`, `get_profit_express()`, `get_profit_notice()`, `get_holder_num()`, `get_margin_summary()`, `get_margin_detail()`, `get_long_hu_bang()`, `get_block_trading()`, `get_index_constituent()`, `get_index_weight()`, `get_fund_share()`, `get_kzz_issuance()` |
## 九、接口统计
| 类别 | 接口数量 |
|------|----------|
| 核心适配器接口 | 7 |
| 基础数据接口 | 4 |
| 财务/股东数据接口 | 8 |
| 市场数据接口 | 7 |
| 基金/可转债接口 | 3 |
| 新增分表数据接口 | 4 |
| **总计** | **33** |