MCPcopy Create free account

hub / github.com/JoinQuant/jqfactor_analyzer / functions

Functions218 in github.com/JoinQuant/jqfactor_analyzer

↓ 56 callersMethodget
(self, v)
jqfactor_analyzer/plot_utils.py:141
↓ 13 callersMethodcalc_mean_return_by_quantile
计算按分位数分组因子收益和标准差 因子收益为收益按照 weight 列中权重的加权平均值 参数: by_date: - True: 按天计算收益 - False: 不按天计算收益 by_group:
jqfactor_analyzer/analyze.py:327
↓ 10 callersFunctionconvert_to_forward_returns_columns
(period)
jqfactor_analyzer/utils.py:21
↓ 8 callersFunctiondate2str
(date, format='%Y-%m-%d')
jqfactor_analyzer/when.py:18
↓ 6 callersMethodcalc_factor_information_coefficient
计算每日因子信息比率 (IC值) 参数: group_adjust: - True: 使用行业中性收益计算 IC (行业收益被认为是每日各个行业股票收益按照weight列中权重加权的均值) - False: 不使用行业中性收益
jqfactor_analyzer/analyze.py:438
↓ 6 callersFunctionget_forward_returns_columns
(columns)
jqfactor_analyzer/utils.py:16
↓ 5 callersMethod_get_trade_days
(self, start_date=None, end_date=None)
jqfactor_analyzer/data.py:185
↓ 5 callersFunction_use_chinese
(use=None)
jqfactor_analyzer/plot_utils.py:100
↓ 5 callersFunctionget_cache_dir
()
jqfactor_analyzer/factor_cache.py:57
↓ 5 callersMethodplot_quantile_returns_bar
画各分位数平均收益图 参数: by_group: - True: 各行业的各分位数平均收益图 - False: 各分位数平均收益图 demeaned: - True: 使用超额收益计算累积收益 (基准收
jqfactor_analyzer/analyze.py:1021
↓ 5 callersFunctionprint_table
(table, name=None, fmt=None)
jqfactor_analyzer/plot_utils.py:58
↓ 4 callersMethodcalc_mean_information_coefficient
计算因子信息比率均值 (IC值均值) 参数: group_adjust: - True: 使用行业中性收益计算 IC (行业收益被认为是每日各个行业股票收益按照weight列中权重加权的均值) - False: 不使用行业中性收益
jqfactor_analyzer/analyze.py:467
↓ 4 callersMethodcompute_mean_returns_spread
计算两个分位数相减的因子收益和标准差 参数: upper_quant: 用 upper_quant 选择的分位数减去 lower_quant 选择的分位数 lower_quant: 用 upper_quant 选择的分位数减去 lower_quant
jqfactor_analyzer/analyze.py:375
↓ 4 callersMethodplot_quantile_average_cumulative_return
因子预测能力平均累计收益图 参数: periods_before: 计算过去的天数 periods_after: 计算未来的天数 by_quantile: 是否各分位数分别显示因子预测能力平均累计收益图 std_bar
jqfactor_analyzer/analyze.py:1262
↓ 3 callersMethod_get_cached_industry_one_day
(self, date, securities=None, industry=None)
jqfactor_analyzer/data.py:294
↓ 3 callersFunctionconvert_date
(date)
jqfactor_analyzer/when.py:22
↓ 3 callersFunctiondemean_forward_returns
根据相关分组为因子远期收益去均值. 分组去均值包含了投资组合分组中性化约束的假设,因此允许跨组评估因子. Parameters ---------- factor_data : pd.DataFrame - MultiIndex 因子远期收
jqfactor_analyzer/prepare.py:143
↓ 3 callersMethodget_attr_returns2bench
获取相对于指数的累积归因收益 将超额收益分解成了: 1.common_return (因子收益, 又可进一步拆分成风格和行业); 2.cash (现金收益, 假设组合本身现金部分的收益为0, 则相对于指数的超额收益为"-1 * 指数收益");
jqfactor_analyzer/attribution.py:302
↓ 3 callersFunctionget_clean_factor_and_forward_returns
将因子数据, 价格数据, 分组映射和权重映射格式化为 由包含时间和资产的 MultiIndex 作为索引的 DataFrame 参数 ---------- factor : pd.Series - MultiIndex 一个 Series, in
jqfactor_analyzer/prepare.py:320
↓ 3 callersMethodget_exposure2bench
获取相对于指数的暴露
jqfactor_analyzer/attribution.py:269
↓ 3 callersFunctionget_factor_values_by_cache
从缓存的文件读取因子数据, 文件不存在时返回空的 DataFrame
jqfactor_analyzer/factor_cache.py:210
↓ 3 callersMethodplot_returns_table
打印因子收益表 参数: demeaned: - True: 使用超额收益计算 (基准收益被认为是每日所有股票收益按照weight列中权重的加权的均值) - False: 不使用超额收益 group_adjust:
jqfactor_analyzer/analyze.py:904
↓ 3 callersMethodplot_turnover_table
打印换手率表
jqfactor_analyzer/analyze.py:935
↓ 3 callersFunctionsave_data_by_month
按时间段获取储存数据(不要跨月)
jqfactor_analyzer/factor_cache.py:113
↓ 3 callersFunctionsave_factor_values_by_group
将因子库数据按因子组储存到本地 start_date : 开始时间 end_date : 结束时间 factor_names : 因子组所含因子的名称,除过因子库中支持的因子外,还支持指定为'prices'缓存价格数据 overwrite : 文件已存在时是否覆盖更
jqfactor_analyzer/factor_cache.py:158
↓ 2 callersMethod_get_index_returns
(self, index_symbol, start_date, end_date)
jqfactor_analyzer/attribution.py:250
↓ 2 callersFunctionannotateBars
(x, dt, ax=ax)
jqfactor_analyzer/plotting.py:719
↓ 2 callersFunctionaverage_cumulative_return_by_quantile
计算由 periods_before 到 periods_after 定义的周期范围内的因子分位数的平均累积收益率 参数 ---------- factor_data : pd.DataFrame - MultiIndex 一个 DataFrame
jqfactor_analyzer/performance.py:454
↓ 2 callersFunctioncache_dataapi
(allow_cache=True, show_progress=False)
jqfactor_analyzer/preprocess.py:183
↓ 2 callersMethodcalc_attr_returns
计算风格归因收益, country 收益率为国家收益 (这里的国家收益是用均衡大小市值后 (根号市值) 回归得到的
jqfactor_analyzer/attribution.py:339
↓ 2 callersMethodcalc_autocorrelation
根据调仓周期确定滞后期的每天计算因子自相关性 当日因子值和滞后period天的因子值的自相关性 参数: rank: - True: 秩相关系数 - False: 普通相关系数
jqfactor_analyzer/analyze.py:529
↓ 2 callersMethodcalc_factor_returns
计算按因子值加权组合每日收益 权重 = 每日因子值 / 每日因子值的绝对值的和 正的权重代表买入, 负的权重代表卖出 参数: demeaned: - True: 对权重去均值 (每日权重 = 每日权重 - 每日权重的
jqfactor_analyzer/analyze.py:356
↓ 2 callersMethodcalc_top_down_cumulative_returns
计算做多最大分位,做空最小分位组合每日累积收益 参数: period: 指定调仓周期 demeaned: 详见 calc_mean_return_by_quantile 中 demeaned 参数 - True: 使用
jqfactor_analyzer/analyze.py:810
↓ 2 callersFunctioncommon_start_returns
( factor, prices, before, after, cumulative=False, mean_by_date=False, demean_by=N
jqfactor_analyzer/prepare.py:396
↓ 2 callersFunctioncompute_forward_returns
计算每个因子值对应的 N 期因子远期收益 参数 ---------- factor : pd.Series - MultiIndex 一个 Series, index 为日期 (level 0) 和资产(level 1) 的 MultiIndex,
jqfactor_analyzer/prepare.py:94
↓ 2 callersMethodcumulative_returns
(self)
jqfactor_analyzer/analyze.py:889
↓ 2 callersFunctionfactor_information_coefficient
通过因子值与因子远期收益计算信息系数(IC). 参数 ---------- factor_data : pd.DataFrame - MultiIndex 一个 DataFrame, index 为日期 (level 0) 和资产(level 1)
jqfactor_analyzer/performance.py:14
↓ 2 callersFunctionfactor_returns
计算按因子值加权的投资组合的收益 权重为去均值的因子除以其绝对值之和 (实现总杠杆率为1). 参数 ---------- factor_data : pd.DataFrame - MultiIndex 一个 DataFrame, index
jqfactor_analyzer/performance.py:106
↓ 2 callersFunctionget_factor_folder
获取因子组的文件夹 factor_names : 因子名列表 group_name : 因子组的名称, 如果指定则使用指定的名称作为文件夹名 否则用 jqfactor_cache_ + 因子名的 md5 值 (顺序无关) 作为文件夹名
jqfactor_analyzer/factor_cache.py:83
↓ 2 callersMethodget_ind_record
(self, industry)
jqfactor_analyzer/data.py:145
↓ 2 callersFunctionget_price
(security, start_date, end_date, fields)
jqfactor_analyzer/attribution.py:29
↓ 2 callersMethodplot_cumulative_returns
画按因子值加权组合每日累积收益图 参数: periods: 调仓周期 demeaned: 详见 calc_factor_returns 中 demeaned 参数 - True: 对因子值加权组合每日收益的权重去均值
jqfactor_analyzer/analyze.py:1172
↓ 2 callersMethodplot_cumulative_returns_by_quantile
画各分位数每日累积收益图 参数: period: 调仓周期 demeaned: 详见 calc_mean_return_by_quantile 中 demeaned 参数 - True: 使用超额收益计算累积收益 (基
jqfactor_analyzer/analyze.py:1231
↓ 2 callersMethodplot_data
(self, data, title=None, figsize=(15, 8))
jqfactor_analyzer/attribution.py:352
↓ 2 callersMethodplot_factor_auto_correlation
画因子自相关图 参数: periods: 滞后周期 rank: - True: 用秩相关系数 - False: 用相关系数
jqfactor_analyzer/analyze.py:1116
↓ 2 callersMethodplot_ic_by_group
画按行业分组信息比率(IC)图 参数: group_adjust: - True: 使用行业中性收益 (行业收益被认为是每日各个行业股票收益按照weight列中权重的加权的均值) - False: 不使用行业中性收益
jqfactor_analyzer/analyze.py:1098
↓ 2 callersMethodplot_ic_qq
画信息比率 qq 图 参数: group_adjust: - True: 使用行业中性收益 (行业收益被认为是每日各个行业股票收益按照weight列中权重的加权的均值) - False: 不使用行业中性收益 metho
jqfactor_analyzer/analyze.py:998
↓ 2 callersMethodplot_ic_ts
画信息比率(IC)时间序列图 参数: group_adjust: - True: 使用行业中性收益 (行业收益被认为是每日各个行业股票收益按照weight列中权重的加权的均值) - False: 不使用行业中性收益 m
jqfactor_analyzer/analyze.py:964
↓ 2 callersMethodplot_information_table
打印信息比率 (IC)相关表 参数: group_adjust: - True:使用行业中性收益 (行业收益被认为是每日各个行业股票收益按照weight列中权重的加权的均值) - False:不使用行业中性收益 met
jqfactor_analyzer/analyze.py:942
↓ 2 callersMethodplot_mean_quantile_returns_spread_time_series
画最高分位减最低分位收益图 参数: demeaned: - True: 使用超额收益计算累积收益 (基准收益被认为是每日所有股票收益按照weight列中权重加权的均值) - False: 不使用超额收益 group_a
jqfactor_analyzer/analyze.py:1069
↓ 2 callersMethodplot_monthly_ic_heatmap
画月度信息比率(IC)图 参数: group_adjust: - True: 使用行业中性收益 (行业收益被认为是每日各个行业股票收益按照weight列中权重的加权的均值) - False: 不使用行业中性收益
jqfactor_analyzer/analyze.py:1159
↓ 2 callersMethodplot_quantile_returns_violin
画各分位数收益分布图 参数: demeaned: - True: 使用超额收益计算累积收益 (基准收益被认为是每日所有股票收益按照weight列中权重加权的均值) - False: 不使用超额收益 group_adju
jqfactor_analyzer/analyze.py:1046
↓ 2 callersMethodplot_quantile_statistics_table
打印各分位数统计表
jqfactor_analyzer/analyze.py:960
↓ 2 callersMethodplot_top_bottom_quantile_turnover
画最高最低分位换手率图 参数: periods: 调仓周期
jqfactor_analyzer/analyze.py:1139
↓ 2 callersMethodplot_top_down_cumulative_returns
画做多最大分位数做空最小分位数组合每日累积收益图 period: 指定调仓周期 demeaned: 详见 calc_mean_return_by_quantile 中 demeaned 参数 - True: 使用超额收益计算累积收益
jqfactor_analyzer/analyze.py:1203
↓ 2 callersFunctionquantize_factor
计算每期因子分位数 参数 ---------- factor_data : pd.DataFrame - MultiIndex 一个 DataFrame, index 为日期 (level 0) 和资产(level 1) 的 MultiIndex,
jqfactor_analyzer/prepare.py:14
↓ 2 callersFunctionrolling_mean
(x, window, min_periods=None, center=False)
jqfactor_analyzer/compat.py:54
↓ 1 callersMethod__gen_clean_factor_and_forward_returns
格式化因子数据和定价数据
jqfactor_analyzer/analyze.py:253
↓ 1 callersMethod_calc_ic_mean_n_day_lag
(self, n, group_adjust=False, by_group=False, method=None)
jqfactor_analyzer/analyze.py:589
↓ 1 callersMethod_get_cached_industry
(self, securities, start_date, end_date)
jqfactor_analyzer/data.py:307
↓ 1 callersMethod_get_cached_price
获取缓存价格数据, 缓存文件中存储的数据是为未复权价格和后复权因子
jqfactor_analyzer/data.py:218
↓ 1 callersMethod_get_factor_cn_name
获取行业及风格因子的中文名称
jqfactor_analyzer/attribution.py:148
↓ 1 callersMethod_get_index_exposure
(self, index_symbol)
jqfactor_analyzer/attribution.py:258
↓ 1 callersMethod_get_industry
(self, securities, start_date, end_date, industry='jq_l1')
jqfactor_analyzer/data.py:278
↓ 1 callersMethod_get_industry_exposure_daily
(self, date, weight)
jqfactor_analyzer/attribution.py:202
↓ 1 callersMethod_get_market_cap
(self, securities, start_date, end_date, ln=False, field='market_cap')
jqfactor_analyzer/data.py:360
↓ 1 callersMethod_get_price
(self, securities, start_date=None, end_date=None, count=None, fields=None, skip_paused=Fal
jqfactor_analyzer/data.py:193
↓ 1 callersMethod_get_style_exposure_daily
(self, date, weight)
jqfactor_analyzer/attribution.py:178
↓ 1 callersFunction_set_chinese_fonts
()
jqfactor_analyzer/plot_utils.py:113
↓ 1 callersFunction_set_default_fonts
()
jqfactor_analyzer/plot_utils.py:129
↓ 1 callersFunctionaxes_style
(style='darkgrid', rc=None)
jqfactor_analyzer/plot_utils.py:45
↓ 1 callersMethodcalc_average_cumulative_return_by_quantile
按照当天的分位数算分位数未来和过去的收益均值和标准差 参数: periods_before: 计算过去的天数 periods_after: 计算未来的天数 demeaned: - True: 使用超额收益计算累积收益
jqfactor_analyzer/analyze.py:504
↓ 1 callersMethodcalc_cumulative_return_by_quantile
计算指定调仓周期的各分位数每日累积收益 参数: period: 指定调仓周期 demeaned: 详见 calc_mean_return_by_quantile 中 demeaned 参数 - True: 使用超额收益
jqfactor_analyzer/analyze.py:750
↓ 1 callersMethodcalc_cumulative_returns
计算指定调仓周期的按因子值加权组合每日累积收益 当 period > 1 时,组合的累积收益计算方法为: 组合每日收益 = (从第0天开始每period天一调仓的组合每日收益 + 从第1天开始每period天一调仓的组
jqfactor_analyzer/analyze.py:778
↓ 1 callersMethodcalc_factor_alpha_beta
计算因子的 alpha 和 beta 因子值加权组合每日收益 = beta * 市场组合每日收益 + alpha 因子值加权组合每日收益计算方法见 calc_factor_returns 函数 市场组合每日收益是每日所有股票收益按照weight列中
jqfactor_analyzer/analyze.py:412
↓ 1 callersMethodcalc_industry_exposure
计算组合的行业因子暴露 返回: 一个 dataframe, index 为日期, columns为风格因子名, values为暴露值
jqfactor_analyzer/attribution.py:210
↓ 1 callersMethodcalc_style_exposure
计算组合的风格因子暴露 返回: 一个 dataframe, index 为日期, columns 为风格因子名, values 为暴露值
jqfactor_analyzer/attribution.py:189
↓ 1 callersMethodcheck_factor_values
检查并缓存因子数据到本地
jqfactor_analyzer/attribution.py:170
↓ 1 callersFunctioncumulative_return
(q_fact, demean_by)
jqfactor_analyzer/performance.py:494
↓ 1 callersFunctioncumulative_returns
从'N 期'因子远期收益率构建累积收益 当 'period' N 大于 1 时, 建立平均 N 个交错的投资组合 (在随后的时段 1,2,3,...,N 开始), 每个 N 个周期重新调仓, 最后计算 N 个投资组合累积收益的均值。 参数 --------
jqfactor_analyzer/performance.py:206
↓ 1 callersFunctionensure_tuple
(x)
jqfactor_analyzer/utils.py:42
↓ 1 callersFunctionfactor_alpha_beta
计算因子的alpha(超额收益), alpha t-统计量 (alpha 显著性)和 beta(市场暴露). 使用每期平均远期收益作为自变量(视为市场组合收益) 因子值加权平均的远期收益作为因变量(视为因子收益), 进行回归. Parameters
jqfactor_analyzer/performance.py:155
↓ 1 callersFunctionfactor_autocorrelation
计算指定时间跨度内平均因子排名/因子值的自相关性. 该指标对于衡量因子的换手率非常有用. 如果每个因子值在一个周期内随机变化,我们预计自相关为 0. 参数 ---------- factor_data : pd.DataFrame - MultiI
jqfactor_analyzer/performance.py:417
↓ 1 callersMethodfactor_returns
(self)
jqfactor_analyzer/attribution.py:236
↓ 1 callersMethodget_attr_daily_returns2bench
获取相对于指数的日归因收益率 返回: 一个 datafame, index 是日期, value 为对应日期的收益率值 columns 为风格因子/行业因子/现金cash/因子总收益common_return(含风格,行业)/特异收益率 specific_return
jqfactor_analyzer/attribution.py:275
↓ 1 callersFunctionget_cache_config
获取缓存目录
jqfactor_analyzer/factor_cache.py:22
↓ 1 callersFunctionget_chinese_font
()
jqfactor_analyzer/plot_utils.py:86
↓ 1 callersFunctionget_clean_factor
将因子值, 因子远期收益, 因子分组数据, 因子权重数据 格式化为以时间和资产的 MultiIndex 作为索引的 DataFrame. 参数 ---------- factor : pd.Series - MultiIndex 一个 Se
jqfactor_analyzer/prepare.py:182
↓ 1 callersFunctionget_date_miss_group
将A相比B缺失的部分按连续性进行分组
jqfactor_analyzer/factor_cache.py:103
↓ 1 callersFunctionget_factor_style_returns
(factors=None, start_date=None, end_date=None, count=None, universe=None, industr
jqfactor_analyzer/attribution.py:18
↓ 1 callersFunctionget_factor_values
(securities, factors=None, start_date=None, end_date=None, count=None)
jqfactor_analyzer/factor_cache.py:47
↓ 1 callersFunctionget_index_style_exposure
(index, factors=None, start_date=None, end_date=None, count=None)
jqfactor_analyzer/attribution.py:38
↓ 1 callersFunctionget_long_description
()
setup.py:30
↓ 1 callersFunctionget_neu_basicdata
获取中性化的依赖数据 返回: 一个 DataFrame, index 是股票代码
jqfactor_analyzer/preprocess.py:187
↓ 1 callersFunctionget_resid
(s)
jqfactor_analyzer/preprocess.py:281
↓ 1 callersFunctionget_version
()
setup.py:23
↓ 1 callersMethodini_cache_cfg
(self, allow_cache)
jqfactor_analyzer/data.py:152
↓ 1 callersFunctionmain
()
setup.py:73
↓ 1 callersFunctionmean_information_coefficient
根据不同分组求因子 IC 均值. 参数 ---------- factor_data : pd.DataFrame - MultiIndex 一个 DataFrame, index 为日期 (level 0) 和资产(level 1) 的 Mult
jqfactor_analyzer/performance.py:57
↓ 1 callersMethodmean_return_by_quantile
收益分析 用来画分位数收益的柱状图 返回 pandas.DataFrame, index 是 factor_quantile, 值是(1, 2, 3, 4, 5), column 是 period 的值 (1, 5, 10)
jqfactor_analyzer/analyze.py:649
next →1–100 of 218, ranked by callers