Browse Source

小修小补

Joey 1 month ago
parent
commit
e649410832
2 changed files with 9 additions and 8 deletions
  1. 5 5
      modules/bfiMatcher.dos
  2. 4 3
      modules/rankingCalculator.dos

+ 5 - 5
modules/bfiMatcher.dos

@@ -302,14 +302,14 @@ def match_mc_bfi(entity_type, entity_info) {
     start_day = entity_info.price_date.min();
     start_day = entity_info.price_date.min();
 
 
     // 取数据集每个基金组合指定日期之前5年至今的周净值
     // 取数据集每个基金组合指定日期之前5年至今的周净值
-	s_json = (SELECT entity_id, curve_type, strategy, price_date.temporalAdd(-5y).temporalFormat('yyyy-MM') AS end_date FROM entity_info).toStdJson();
+	s_json = (SELECT entity_id, curve_type, strategy, price_date.temporalAdd(-5y).temporalFormat('yyyy-MM') AS effective_date FROM entity_info).toStdJson();
 	nav_entity = get_mc_nav_for_return_calculation(entity_type, s_json, 2);
 	nav_entity = get_mc_nav_for_return_calculation(entity_type, s_json, 2);
 
 
 	if(nav_entity.isVoid() || nav_entity.size() == 0) return null;
 	if(nav_entity.isVoid() || nav_entity.size() == 0) return null;
 	// fund_manager_fitted_curve 和 company_fitted_curve 表里没有price_date, 这里用 businessMonthEnd 日期填充
 	// fund_manager_fitted_curve 和 company_fitted_curve 表里没有price_date, 这里用 businessMonthEnd 日期填充
 	nav_entity = SELECT entity_id, curve_type, strategy, 
 	nav_entity = SELECT entity_id, curve_type, strategy, 
-	                    temporalParse(end_date, 'yyyy-MM').month() AS end_date,
-	                    temporalParse(end_date+'-01', 'yyyy-MM-dd').businessMonthEnd() AS price_date, cumulative_nav AS nav 
+	                    temporalParse(effective_date, 'yyyy-MM').month() AS effective_date,
+	                    temporalParse(effective_date+'-01', 'yyyy-MM-dd').businessMonthEnd() AS price_date, cumulative_nav AS nav 
 	             FROM nav_entity;
 	             FROM nav_entity;
 
 
     // 取相关性计算及BFI用得到的指数/因子列表
     // 取相关性计算及BFI用得到的指数/因子列表
@@ -330,7 +330,7 @@ def match_mc_bfi(entity_type, entity_info) {
 
 
 		t_ei = SELECT entity_id, price_date.month() AS end_date, price_date FROM entity_info WHERE curve_type = cur AND strategy = 0;
 		t_ei = SELECT entity_id, price_date.month() AS end_date, price_date FROM entity_info WHERE curve_type = cur AND strategy = 0;
 
 
-		t_ne = SELECT entity_id, end_date, price_date, nav FROM nav_entity WHERE curve_type = cur AND strategy = 0;
+		t_ne = SELECT entity_id, effective_date AS end_date, price_date, nav FROM nav_entity WHERE curve_type = cur AND strategy = 0;
 
 
 		t_coe = create_mc_index_coe().dropColumns!(['curve_type', 'strategy']);
 		t_coe = create_mc_index_coe().dropColumns!(['curve_type', 'strategy']);
     	
     	
@@ -348,4 +348,4 @@ def match_mc_bfi(entity_type, entity_info) {
     }
     }
 
 
     return t_factor_bfi;
     return t_factor_bfi;
-}
+}

+ 4 - 3
modules/rankingCalculator.dos

@@ -277,9 +277,10 @@ def prepare_data_for_ranking(ranking_by, entity_type, entity_info, end_date, isF
 
 
 		// morningstar data
 		// morningstar data
 		table_desc = get_ms_stats_table_description(entity_type);
 		table_desc = get_ms_stats_table_description(entity_type);
-		tb_data_ms_stats = get_monthly_indicator_data(table_desc.table_name[0], end_date, isFromMySQL);
-		tb_data = lj(tb_data, tb_data_ms_stats, matchingCols);
-
+		if(table_desc.size() > 0 && table_desc.table_name[0] != NULL) {
+			tb_data_ms_stats = get_monthly_indicator_data(table_desc.table_name[0], end_date, isFromMySQL);
+			tb_data = lj(tb_data, tb_data_ms_stats, matchingCols);
+		}
 
 
     	v_indicator_id = [1,                                // 对应 fund_performance, 取消39(年化收益) 因为没有意义
     	v_indicator_id = [1,                                // 对应 fund_performance, 取消39(年化收益) 因为没有意义
     					  38, 41, 42, 48, 49,               // 对应 fund_indicator, 取消37 (per_con), 43, 44, 45, 46, 47 (smdd模型) 因为dolphin 未计算
     					  38, 41, 42, 48, 49,               // 对应 fund_indicator, 取消37 (per_con), 43, 44, 45, 46, 47 (smdd模型) 因为dolphin 未计算