Skip to content

DataSource Adapters 模块

数据适配器模块,按数据源分类提供多种适配器实现。

模块结构

adapters/
├── tdx/              # 通达信适配器
│   ├── stock.py     # 股票数据
│   ├── index.py     # 指数数据
│   ├── future.py    # 期货数据
│   ├── bond.py      # 债券数据
│   ├── hkstock.py  # 港股数据
│   ├── option.py    # 期权数据
│   ├── realtime.py # 实时行情
│   ├── transaction.py  # 成交明细
│   ├── macro.py    # 宏观数据
│   ├── exchange.py # 交易所数据
│   ├── extension.py  # 扩展数据
│   ├── tools.py    # 工具函数
│   ├── ip_selector.py  # IP 选择器
│   ├── financial.py  # 财务数据
│   └── base.py     # 基类
├── akshare/         # AkShare 适配器
│   ├── base.py      # 适配器基类
│   ├── stock.py     # 股票数据
│   ├── index.py     # 指数数据
│   ├── future.py    # 期货数据
│   ├── bond.py      # 债券数据
│   ├── hkstock.py  # 港股数据
│   ├── option.py    # 期权数据
│   ├── macroindex.py # 宏观指数
│   └── usstock.py   # 美股数据
├── efinance/        # EFinance 适配器
│   └── base.py      # 适配器基类
├── eastmoney/       # 东方财富适配器
│   ├── analysis.py  # 股票分析
│   ├── fundflow.py # 资金流向
│   └── fxs_invest.py  # 投顾数据
├── ths/            # 同花顺适配器
│   ├── stock_day.py  # 日线数据
│   ├── block.py    # 板块数据
│   └── fund_position.py  # 持仓数据
├── exchange/       # 交易所适配器
│   └── margin.py   # 融资融券
└── jisilu/         # 集思录适配器
    └── ...

适配器类型

通达信 (TDX)

通达信是国内主流的证券交易软件数据接口。

python
from FQData.DataSource.adapters.tdx import (
    TdxStockAdapter,
    TdxIndexAdapter,
    TdxFutureAdapter,
    TdxBondAdapter,
    TdxRealtimeAdapter,
)
适配器说明
TdxStockAdapter股票数据适配器
TdxIndexAdapter指数数据适配器
TdxFutureAdapter期货数据适配器
TdxBondAdapter债券数据适配器
TdxHKStockAdapter港股数据适配器
TdxOptionAdapter期权数据适配器
TdxRealtimeAdapter实时行情适配器
TdxTransactionAdapter成交明细适配器
TdxMacroAdapter宏观数据适配器
TdxExchangeAdapter交易所数据适配器

AkShare

AkShare 是开源的 Python 金融数据接口库。

python
from FQData.DataSource.adapters.akshare import (
    AkShareAdapter,
    AkShareStockAdapter,
    AkShareIndexAdapter,
    AkShareFutureAdapter,
    AkShareBondAdapter,
)
适配器说明
AkShareAdapterAkShare 适配器基类
AkShareStockAdapter股票数据适配器
AkShareIndexAdapter指数数据适配器
AkShareFutureAdapter期货数据适配器
AkShareBondAdapter债券数据适配器
AkShareHKStockAdapter港股数据适配器
AkShareOptionAdapter期权数据适配器
AkShareMacroIndexAdapter宏观指数数据适配器
AkShareUSStockAdapter美股数据适配器

EFinance

EFinance 金融数据接口。

python
from FQData.DataSource.adapters.efinance import EFinanceAdapter

adapter = EFinanceAdapter()

东方财富 (EastMoney)

python
from FQData.DataSource.adapters.eastmoney import (
    get_stock_fund_flow,
    get_stock_analysis,
    crawl_eastmoney_fund_flow,
)
函数说明
get_stock_fund_flow获取个股资金流向
get_stock_analysis获取股票分析数据
crawl_eastmoney_fund_flow爬取资金流向数据

同花顺 (THS)

python
from FQData.DataSource.adapters.ths import (
    get_stock_day,
    get_stock_block,
    get_fund_position_from_ths,
)
函数说明
get_stock_day获取同花顺日线数据
get_stock_block获取板块数据
get_fund_position_from_ths获取基金持仓

交易所

python
from FQData.DataSource.adapters.exchange import (
    get_sh_margin,
    get_sz_margin,
    get_margin_all,
)
函数说明
get_sh_margin获取上海融资融券
get_sz_margin获取深圳融资融券
get_margin_all获取所有融资融券数据

集思录

python
from FQData.DataSource.adapters.jisilu import (
    create_browser,
    login,
    get_cbnewlist,
)
函数说明
create_browser创建浏览器实例
login登录集思录
get_cbnewlist获取可转债列表

快速开始

使用 TDX 适配器

python
from FQData.DataSource.adapters.tdx import TdxStockAdapter

adapter = TdxStockAdapter()

data = adapter.get_security_bars(
    code='600000',
    category=9,
    start=0,
    count=100
)

使用东方财富

python
from FQData.DataSource.adapters.eastmoney import get_stock_fund_flow

fund_flow = get_stock_fund_flow('600000')

文档索引

适配器文档
通达信tdx/README
AkShareakshare/README
EFinanceefinance/README
东方财富eastmoney/README
同花顺ths/README
交易所exchange/README
集思录jisilu/README

相关文档