|
@@ -432,9 +432,11 @@ def ms_calFundReturns() {
|
|
*
|
|
*
|
|
*
|
|
*
|
|
* TODO: max_r2 表在哪里被用到了?应该和基金推荐有关系
|
|
* TODO: max_r2 表在哪里被用到了?应该和基金推荐有关系
|
|
|
|
+ *
|
|
|
|
+ * Example: MatchEntityBFITask('MF', 2024.11.20);
|
|
*/
|
|
*/
|
|
-def MatchEntityBFI(entityType, date) {
|
|
|
|
-//entityType = 'MF'
|
|
|
|
|
|
+def MatchEntityBFITask(entityType, date) {
|
|
|
|
+//entityType = 'PF'
|
|
//date = 2024.11.20
|
|
//date = 2024.11.20
|
|
|
|
|
|
rt = '';
|
|
rt = '';
|
|
@@ -452,7 +454,7 @@ def MatchEntityBFI(entityType, date) {
|
|
entity_index_coe = create_entity_index_coe();
|
|
entity_index_coe = create_entity_index_coe();
|
|
|
|
|
|
do {
|
|
do {
|
|
- // 4 min per 1000 funds
|
|
|
|
|
|
+ // 4 min per 1000 funds or 2 min per 1000 portfolios
|
|
coe = cal_entity_index_coe(entityType, tb_cal_entity[i : min(size, i+batch_size)]);
|
|
coe = cal_entity_index_coe(entityType, tb_cal_entity[i : min(size, i+batch_size)]);
|
|
|
|
|
|
if(coe.isVoid() || coe.size() == 0) continue;
|
|
if(coe.isVoid() || coe.size() == 0) continue;
|
|
@@ -485,7 +487,7 @@ def MatchEntityBFI(entityType, date) {
|
|
|
|
|
|
// 所有的 factors 存到 xxx_factor_bfi 表;NOTE: Java 把所有 factor 的数据都存起来,这里只存 correlation 达标的记录 (反正这个表没啥用?)
|
|
// 所有的 factors 存到 xxx_factor_bfi 表;NOTE: Java 把所有 factor 的数据都存起来,这里只存 correlation 达标的记录 (反正这个表没啥用?)
|
|
chg_columns_for_mysql(t_bfi_candidates, iif(entityType == 'PF', 'portfolio_id', 'fund_id'));
|
|
chg_columns_for_mysql(t_bfi_candidates, iif(entityType == 'PF', 'portfolio_id', 'fund_id'));
|
|
- save_and_sync(t_bfi_candidates, iif(entityType == 'PF', 'raw_db..pf_portfolio_factor_bfi', 'raw_db.cm_fund_factor_bfi'), );
|
|
|
|
|
|
+ save_and_sync(t_bfi_candidates, iif(entityType == 'PF', 'raw_db.pf_portfolio_factor_bfi', 'raw_db.cm_fund_factor_bfi'), );
|
|
|
|
|
|
if(bfi_raw.isVoid() || bfi_raw.size() == 0) continue;
|
|
if(bfi_raw.isVoid() || bfi_raw.size() == 0) continue;
|
|
|
|
|
|
@@ -495,7 +497,7 @@ def MatchEntityBFI(entityType, date) {
|
|
|
|
|
|
// 最大R2因子及所有有效因子标签
|
|
// 最大R2因子及所有有效因子标签
|
|
t_max_r2 = SELECT entity_id, factor_id.first() AS factor_id, end_date,
|
|
t_max_r2 = SELECT entity_id, factor_id.first() AS factor_id, end_date,
|
|
- int(NULL) AS performance_flag, coe.first() AS coe, r2.first() AS r2, concat(factor_name, ",") AS rz_portrait
|
|
|
|
|
|
+ string(NULL) AS performance_flag, coe.first() AS coe, r2.first() AS r2, concat(factor_name, ",") AS rz_portrait
|
|
FROM ej(t_bfi, get_bfi_index_list(), 'factor_id')
|
|
FROM ej(t_bfi, get_bfi_index_list(), 'factor_id')
|
|
GROUP BY entity_id, end_date;
|
|
GROUP BY entity_id, end_date;
|
|
|
|
|
|
@@ -506,7 +508,7 @@ def MatchEntityBFI(entityType, date) {
|
|
// 有效因子中 R2 最大的因子存 xxx_max_r2
|
|
// 有效因子中 R2 最大的因子存 xxx_max_r2
|
|
chg_columns_for_mysql(t_max_r2, iif(entityType == 'PF', 'portfolio_id', 'fund_id'));
|
|
chg_columns_for_mysql(t_max_r2, iif(entityType == 'PF', 'portfolio_id', 'fund_id'));
|
|
save_and_sync(t_max_r2, iif(entityType == 'PF', 'raw_db.pf_portfolio_factor_bfi_max_r2', 'raw_db.pf_fund_factor_bfi_by_category_group_max_r2'), );
|
|
save_and_sync(t_max_r2, iif(entityType == 'PF', 'raw_db.pf_portfolio_factor_bfi_max_r2', 'raw_db.pf_fund_factor_bfi_by_category_group_max_r2'), );
|
|
-
|
|
|
|
|
|
+
|
|
|
|
|
|
} catch (ex) {
|
|
} catch (ex) {
|
|
|
|
|