Ricequant Docs
  • RQSDK快速上手
  • RQData - 金融数据 API

    • Python API文档
    • Http API文档
  • RQAlpha Plus - 回测框架

    • 使用教程
    • API使用手册 (opens new window)
  • RQFactor - 因子投研工具

    • 使用教程
    • API使用手册
  • RQOptimizer - 股票组合优化器

    • 使用教程
    • API使用手册 (opens new window)
Ricequant AMS文档
量化平台文档
RQFund 文档
米筐帮助中心
返回官网
  • RQSDK快速上手
  • RQData - 金融数据 API

    • Python API文档
    • Http API文档
  • RQAlpha Plus - 回测框架

    • 使用教程
    • API使用手册 (opens new window)
  • RQFactor - 因子投研工具

    • 使用教程
    • API使用手册
  • RQOptimizer - 股票组合优化器

    • 使用教程
    • API使用手册 (opens new window)
Ricequant AMS文档
量化平台文档
RQFund 文档
米筐帮助中心
返回官网
  • RQData金融数据API文档

    • 文档目录
    • 使用说明
    • 跨品种通用API
    • 股票
    • 金融、商品期货
    • 金融、商品期权
    • 指数
    • 基金
    • 可转债
    • 风险因子
      • 数据说明
      • get_factor_exposure - 获取一组股票的因子暴露度
      • get_descriptor_exposure - 获取一组股票的细分风格因子暴露度
      • get_stock_beta - 获取一组股票的基准贝塔值
      • get_factor_return - 获取因子收益率
      • get_specific_return - 获取一组股票的特异收益率
      • get_factor_covariance - 获取因子协方差
      • get_specific_risk - 获取一组股票的特异波动率
      • 字段说明
    • 现货
    • 国债回购
    • 宏观经济
    • 舆情讯息
    • 一致预期
    • 财务指标数据字典
    • 技术指标数据字典
    • 更新履历

# 数据说明

因子数据 解释
风格因子暴露度 个股对于特定风格因子的风险暴露。 暴露度绝对值越大,则投资组合表现对因子表现变化越敏感。 可用于投资组合风格评估、风险敞口管理等。部分风格因子由多个细分风格因子组合而成。
细分风格因子暴露度 个股对细分风格因子的风险暴露。细分风格因子表示某一类风格中的细分风险维度,用户可根据实际投资研究需求, 使用细分风格因子代替风格因子。
个股对指数贝塔 个股对指数(上证 50、沪深 300、中证 500 等)的原始贝塔值(未进行标准化, 因此区别于贝塔因子) , 可用于指数跟踪或贝塔中性处理。
因子收益率 因子在给定股票池产生的超额收益。 目前提供全市场、沪深 300、中证 500、 中证 800 四个股票池的因子收益。 用户可根据实际投资研究中所使用的股票池,选择相应的因子收益进行风格追踪和构建指数增强策略。
特异收益率 个股收益中无法被因子解释的部分。 例如上市公司出现高管人员变动, 可能引起股价剧烈波动,产生较大的特异收益。 此时上市公司股价主要由消息面驱动,而与其所处行业、基本面、 及市场行情相关性较低。
因子协方差 投资组合风险中能被因子解释的系统性风险部分。 目前提供日度、月度、季度三套不同预测期限的风险模型,适用于不同调仓频率的交易策略。
特异风险 投资组合风险中不能被因子解释的,与个股自身特殊因素相关的部分(见上述特异收益率解释) 。 目前提供日度、月度、季度三个不同预测期限的风险模型,适用于不同调仓频率的交易策略。

# get_factor_exposure - 获取一组股票的因子暴露度

get_factor_exposure(order_book_ids, start_date, end_date, factors = None,industry_mapping = True )

# 参数

参数 类型 解释
order_book_ids str or list of str 证券代码(例如: '600705.XSHG')
start_date str 开始日期(例如: '2017-03-03')
end_date str 结束日期(例如: '2017-03-20')
factors None or list of str 因子。默认获取全部风格因子暴露度( None)。 风格因子、行业因子和市场联动字段名称见表 1和 表 2
industry_mapping boolean 是否按 2021 年后行业分类标准计算行业暴露度。默认为 True。若取值为 False,则 2021 年 01 月 21 日之前的行业暴露度按 2014 行业分类标准计算

# 返回

MultiIndex 的 pandas.DataFrame

index 第一个 level 为 order_book_id,第二个 level 为 date, columns 为因子字段名称。

# 范例

  • 获取单一股票的因子暴露度
In [24]: get_factor_exposure('600705.XSHG','20170302','20170307',factors=None,industry_mapping=True )
Out[24]:
                              beta  book_to_price  earnings_yield    growth  leverage  liquidity  momentum  ...  计算机  传媒  通信  银行  非银金融  汽车  机械设备
date       order_book_id                                                                                    ...
2017-03-02 600705.XSHG    0.016228       0.934170        1.312494 -1.921347  2.281314  -0.294176 -0.761677  ...    0   0   0   0     1   0     0
2017-03-03 600705.XSHG    0.012569       0.941097        1.311907 -1.921891  2.284648  -0.323958 -0.703353  ...    0   0   0   0     1   0     0
2017-03-06 600705.XSHG   -0.039251       0.940439        1.331196 -1.921235  2.288888  -0.354129 -0.734056  ...    0   0   0   0     1   0     0
2017-03-07 600705.XSHG   -0.002034       0.999407        1.324696 -2.029156  2.383384  -0.307625 -0.783239  ...    0   0   0   0     1   0     0
  • 获取多股票的因子暴露度
In [21]: get_factor_exposure(['600705.XSHG','601600.XSHG'],'20170302','20170307',factors=None,industry_mapping=True )
Out[21]:
                              beta  book_to_price  earnings_yield    growth  leverage  liquidity  momentum  ...  计算机  传媒  通信  银行  非银金融  汽车  机械设备
date       order_book_id                                                                                    ...
2017-03-02 600705.XSHG    0.016228       0.934170        1.312494 -1.921347  2.281314  -0.294176 -0.761677  ...    0   0   0   0     1   0     0
2017-03-03 600705.XSHG    0.012569       0.941097        1.311907 -1.921891  2.284648  -0.323958 -0.703353  ...    0   0   0   0     1   0     0
2017-03-06 600705.XSHG   -0.039251       0.940439        1.331196 -1.921235  2.288888  -0.354129 -0.734056  ...    0   0   0   0     1   0     0
2017-03-07 600705.XSHG   -0.002034       0.999407        1.324696 -2.029156  2.383384  -0.307625 -0.783239  ...    0   0   0   0     1   0     0
2017-03-02 601600.XSHG   -0.476411       1.576575       -0.108173 -0.222838  2.155626   0.401119  0.789932  ...    0   0   0   0     0   0     0
2017-03-03 601600.XSHG   -0.489118       1.578999       -0.091144 -0.222814  2.158477   0.369833  0.666122  ...    0   0   0   0     0   0     0
2017-03-06 601600.XSHG   -0.638607       1.581301       -0.068467 -0.223618  2.162714   0.343099  0.519883  ...    0   0   0   0     0   0     0
2017-03-07 601600.XSHG   -0.657976       1.587860       -0.055744 -0.226962  2.159981   0.330203  0.511142  ...    0   0   0   0     0   0     0

# get_descriptor_exposure - 获取一组股票的细分风格因子暴露度

get_descriptor_exposure(order_book_ids, start_date, end_date, descriptors = None)

# 参数

参数 类型 解释
order_book_ids str or list of str 证券代码(例如: '600705.XSHG')
start_date str 开始日期(例如: '2017-03-03')
end_date str 结束日期(例如: '2017-03-20')
descriptors None or list of str 细分风格因子。默认获取全部细分风格因子的暴露度( None)。 细分风格因子字段名称 rqdata-API-fields-1)

# 返回

MultiIndex 的 pandas.DataFrame

index 第一个 level 为 order_book_id,第二个 level 为 date, column 为细分风格因子字段名称。

# 范例

  • 获取一只股票的全部细分因子暴露度
In [11]: get_descriptor_exposure('600705.XSHG','20170302','20170307',descriptors=None)
Out[11]:
                          book_leverage  cash_earnings_to_price_ratio  ...  three_months_share_turnover  twelve_months_share_turnover
order_book_id date                                                     ...
600705.XSHG   2017-03-02       1.716070                     -2.174376  ...                    -0.572241                      0.073076
              2017-03-03       1.718035                     -2.161017  ...                    -0.628732                      0.065085
              2017-03-06       1.719792                     -2.166595  ...                    -0.681997                      0.063982
              2017-03-07       1.716341                     -2.167661  ...                    -0.685791                      0.071536
  • 获取一只股票一组细分风格因子暴露度
In [26]: get_descriptor_exposure('600705.XSHG','20170302','20170307',descriptors=['earnings_growth','cash_earnings_to_price_ratio','sales_growth'])
Out[26]:
                          cash_earnings_to_price_ratio  earnings_growth  sales_growth
order_book_id date
600705.XSHG   2017-03-02                     -2.174376        -0.412443     -0.434541
              2017-03-03                     -2.161017        -0.412443     -0.434541
              2017-03-06                     -2.166595        -0.412443     -0.434541
              2017-03-07                     -2.167661        -0.438942     -0.454265

# get_stock_beta - 获取一组股票的基准贝塔值

get_stock_beta(order_book_ids, start_date, end_date, benchmark='000300.XSHG')

# 参数

参数 类型 解释
order_book_ids str or list of str 证券代码(例如: '600705.XSHG')
start_date str 开始日期(例如: '2017-03-03')
end_date str 结束日期(例如: '2017-03-20')
benchmark str 基准指数。默认为沪深 300( '000300.XSHG'),可选上证 50('000016.XSHG')、中证 500( '000905.XSHG')、中证 800( '000906.XSHG')以及中证全指( '000985.XSHG')

# 返回

返回 pandas.DataFrame

index 为日期, column 为个股的 order_book_id

# 范例

  • 获取一只股票的基准贝塔值
In [12]: get_stock_beta('600705.XSHG','20170302','20170307' )
Out[12]:
order_book_id  600705.XSHG
date
2017-03-02        1.396796
2017-03-03        1.395106
2017-03-06        1.378063
2017-03-07        1.399051

# get_factor_return - 获取因子收益率

get_factor_return(start_date, end_date, factors= None, universe='whole_market',method='implicit',industry_mapping=True)

# 参数

参数 类型 解释
start_date str 开始日期(例如: '2017-03-03')
end_date str 结束日期(例如: '2017-03-20')
factors None or list of str 因子。默认获取全部因子的因子收益率(None)。 风格因子、行业因子和市场联动字段名称表 1 和表 2
universe str or list 基准指数。默认为全市场('whole_market'), 可选沪深 300 ('000300.XSHG'),中证 500 ('000905.XSHG')、中证 800('000906.XSHG')
method _str _ 计算方法 ( 1 ) 。默认为 'implicit'(隐式因子收益率) ,可选'explicit'(显式风格因子收益率)
industry_mapping str 行业分类。True,则使用申万 2021 行业分类;False,则 2022 年 01 月 21 日之前的因子收益率数据为 2014 行业分类数据。

备注:(1) 由于隐式和显式收益率的计算方法差异,当 method 参数取值为 'implicit' , 可返回三类因子(风格、行业、市场联动)的隐式因子收益率; 而当 method 参数取值为 'explicit' ,只可返回风格因子的显式因子收益率。

# 返回

pandas.DataFrame

index 为日期, column 为因子字段名称

# 范例

  • 获取全部因子的因子收益率
In [14]: get_factor_return('20170302','20170307',factors=None,universe='whole_market',industry_mapping=True)
Out[14]:
factor          beta  book_to_price  comovement  earnings_yield  ...        钢铁        银行      非银金融      食品饮料
date                                                             ...
2017-03-02 -0.000999      -0.003119   -0.005100       -0.000028  ...  0.004589  0.005992  0.003401  0.001025
2017-03-03  0.001148      -0.001882   -0.001399        0.001711  ... -0.007802 -0.006164 -0.003639  0.002736
2017-03-06  0.002715      -0.001411    0.009049        0.000989  ...  0.002477 -0.001238  0.000835 -0.000738
2017-03-07 -0.000044      -0.001271    0.002943        0.000510  ... -0.004741  0.006657  0.000605  0.009588

# get_specific_return - 获取一组股票的特异收益率

get_specific_return(order_book_ids, start_date, end_date)

# 参数

参数 类型 解释
order_book_ids str or list 证券代码(例如: '600705.XSHG')
start_date str 开始日期(例如: '2017-03-03')
end_date str 结束日期(例如: '2017-03-20')

# 返回

pandas.DataFrame

index 为日期, column 为个股的 order_book_id

# 范例

  • 获取一只股票的特异收益率
In [16]: get_specific_return('600705.XSHG','20170302','20170307' )
Out[16]:
order_book_id  600705.XSHG
date
2017-03-02       -0.012205
2017-03-03        0.004288
2017-03-06       -0.005601
2017-03-07        0.022702
  • 获取一组股票的特异收益率
In [29]: get_specific_return(['600705.XSHG','600100.XSHG'],'20170302','20170307' )
Out[29]:
order_book_id  600100.XSHG  600705.XSHG
date
2017-03-02        0.000004    -0.012205
2017-03-03       -0.004658     0.004288
2017-03-06       -0.003140    -0.005601
2017-03-07        0.013050     0.022702

# get_factor_covariance - 获取因子协方差

get_factor_covariance(date, horizon= 'daily')

# 参数

参数 类型 解释
date str 开始日期(例如: '2017-03-03')
horizon str 预测期 限。默 认为 日度 ( 'daily' ), 可选月度( 'monthly')或季度( 'quarterly')

# 返回

pandas.DataFrame

index 和 column 均为因子名称

# 范例

In [17]: get_factor_covariance('20170303',horizon='daily')
Out[17]:
                         beta  book_to_price  comovement  earnings_yield    growth  ...      采掘      钢铁       银行     非银金融      食品饮料
beta                 0.001163  -2.385022e-04    0.002044   -6.211431e-05 -0.000042  ... -0.000155 -0.000455 -0.000377  0.000040 -0.000311
book_to_price       -0.000239   2.517092e-03   -0.000964   -1.118821e-04  0.000054  ...  0.000697  0.001682  0.000427  0.000162  0.000362
comovement           0.002044  -9.643928e-04    0.016008   -1.260676e-04 -0.000253  ...  0.000226  0.000192 -0.004963  0.001152 -0.001320
earnings_yield      -0.000062  -1.118821e-04   -0.000126    5.460846e-04 -0.000049  ... -0.000208 -0.000219  0.000070  0.000150  0.000187
growth              -0.000042   5.362409e-05   -0.000253   -4.887124e-05  0.000171  ... -0.000020 -0.000155  0.000185 -0.000051  0.000077
leverage            -0.000050   2.557107e-04   -0.000145   -1.153423e-05 -0.000002  ...  0.000203  0.000691 -0.000176  0.000078  0.000115
liquidity            0.000118  -5.388243e-07    0.001384   -5.870778e-05  0.000011  ...  0.000140  0.000314 -0.000606 -0.000068  0.000047
momentum            -0.000260   1.096554e-04   -0.000522   -1.625567e-05  0.000022  ... -0.000072 -0.000302  0.000247 -0.000053  0.000041
non_linear_size      0.000087  -1.806789e-04    0.000144   -3.357935e-05 -0.000007  ... -0.000071  0.000102 -0.000159 -0.000084 -0.000039
residual_volatility  0.000632  -3.166259e-04    0.001609   -8.017871e-05 -0.000019  ... -0.000173 -0.000612 -0.000197 -0.000120 -0.000466
size                -0.000226   3.508242e-04   -0.001208    3.006616e-04  0.000034  ...  0.000252  0.000720  0.000300  0.000206  0.000330
交通运输                 0.000014   2.175025e-04    0.000782   -2.044910e-04  0.000015  ... -0.000289  0.001544 -0.002213 -0.001391  0.000661
休闲服务                -0.000056   7.833654e-05   -0.001222    5.397482e-05  0.000014  ... -0.000589  0.000032 -0.001537 -0.000974  0.001098
···
银行                  -0.000377   4.270598e-04   -0.004963    6.968579e-05  0.000185  ... -0.000726 -0.005122  0.010001  0.000824 -0.001567
非银金融                 0.000040   1.620042e-04    0.001152    1.504377e-04 -0.000051  ... -0.000602 -0.001897  0.000824  0.006821 -0.001082
食品饮料                -0.000311   3.616767e-04   -0.001320    1.873396e-04  0.000077  ... -0.000083  0.001159 -0.001567 -0.001082  0.005584

# get_specific_risk - 获取一组股票的特异波动率

get_specific_risk(order_book_ids, start_date, end_date, horizon= 'daily')

# 参数

参数 类型 解释
order_book_ids str or list 证券代码(例如: '600705.XSHG')
start_date str 开始日期(例如: '2017-03-03')
end_date str 结束日期(例如: '2017-03-20')
horizon str 预测期限。默认为日度( 'daily'),可选月度( 'monthly')或季度('quarterly')

# 返回

pandas.DataFrame

index 为日期, column 为个股的 order_book_id

# 范例

  • 获取一只股票的特异波动率
In [18]: get_specific_risk('600705.XSHG','20170303','20170308',horizon='daily')
Out[18]:
order_book_id  600705.XSHG
date
2017-03-03        0.191777
2017-03-06        0.187424
2017-03-07        0.189880
2017-03-08        0.186224
  • 获取一组股票的特异波动率
In [31]: get_specific_risk(['600705.XSHG','600100.XSHG'],'20170303','20170308',horizon='daily')
Out[31]:
order_book_id  600100.XSHG  600705.XSHG
date
2017-03-03        0.146083     0.191777
2017-03-06        0.142691     0.187424
2017-03-07        0.142536     0.189880
2017-03-08        0.139857     0.186224

# 字段说明

表 1 和 表 2 给出了上述部分数据 API 中风格因子、行业因子的字段说明。表 3 给出了市场联动因子的解释。

# 表 1. 风格因子字段说明

备注: 对于包含细分因子的风格因子, 风格因子字段加粗标记, 细分因子字段星号标记

字段 说明 解释
beta 贝塔 个股/投资组合收益对基准收益的敏感度
momentum 动量 股票收益变化的总体趋势特征
size 规模 上市公司的市值规模
book_to_price 账面市值比 上市公司的股东权益-市值比,反映其估值水平
non_linear_size 非线性市值 反映中等市值股票和大/小市值股票的表现差异
earnings_yield
* trailing_earnings_to_price_ratio
* cash_earnings_to_price_ratio
* predicted_earning_to_price
盈利率 上市公司的营收能力
residual_volatility
* daily_standard_deviation
* cumulative_range
* historical_sigma
残余波动率 个股残余收益的波动程度
growth
* sales_growth
* earnings_growth
* short_term_predicted_earnings_growth
* long_term_predicted_earnings_growth
成长性 上市公司的营收增长情况
leverage
* market_leverage
* debt_to_assets
* book_leverage
杠杆率 上市企业负债占资产比例,反映企业的经营杠杆率
liquidity
* one_month_share_turnover
* three_month_share_turnover
* twelve_month_share_turnover
流动性 股票换手率,反映个股交易的活跃程度

# 表 2. 行业因子字段说明

*备注: 下表为 2021 年后的申万行业分类名称

序号 行业 序号 行业
1 农林牧渔 17 商贸零售
2 煤炭 18 社会服务
3 基础化工 19 综合
4 钢铁 20 建筑材料
5 有色金属 21 建筑装饰
6 电子 22 电力设备
7 家用电器 23 国防军工
8 食品饮料 24 计算机
9 纺织服饰 25 传媒
10 轻工制造 26 通信
11 医药生物 27 银行
12 公用事业 28 非银金融
13 交通运输 29 汽车
14 房地产 30 机械设备
15 石油石化 31 环保
16 美容护理

# 表 3. 市场联动因子解释

市场联动因子 解释
comovement 反映市场整体涨落对个股或投资组合的影响。个股对市场联动因子的暴露度均为 1,因此对于任意两个满仓的股票组合,其获得的市场收益及承担的市场整体波动风险相同。而对于“股票+现金”的组合,随着组合中股票仓位比例的增加,市场联动因子对组合收益影响越大; 例如:组合的股票平均仓位是 70%,那么该组合对市场联动因子的暴露度为 0.7。

*如需更详细的米筐多因子风险模型白皮书,请联系我们的销售或者致电公司官方电话

Last Updated: 6/10/2022, 5:54:22 PM

← 可转债 现货 →