Joey 2 nedēļas atpakaļ
vecāks
revīzija
739ce34c60

+ 12 - 12
modules/CalculationJobs.dos

@@ -66,31 +66,31 @@ scheduleJob('weekly_portfolio_bfi_indicator', "Portfolio BFI indicator calculati
 /* -------------  MONTHLY JOBS ---------------------------*/
 
 // manager & company nav
-scheduleJob('monthly_manager_nav', "Manager NAV calculation", CalMCMonthlyNavTask{'PL', now().temporalAdd(-1m).temporalAdd(-2d)}, 18:00m, today(), today()+30, 'M', [2, 3]);
-scheduleJob('monthly_company_nav', "Company NAV calculation", CalMCMonthlyNavTask{'CO', now().temporalAdd(-1m).temporalAdd(-2d)}, 20:00m, today(), today()+30, 'M', [2, 3]);
+scheduleJob('monthly_manager_nav', "Manager NAV calculation", CalMCMonthlyNavTask{'PL', now().temporalAdd(-1M).temporalAdd(-2d)}, 18:00m, today(), today()+30, 'M', [2, 3]);
+scheduleJob('monthly_company_nav', "Company NAV calculation", CalMCMonthlyNavTask{'CO', now().temporalAdd(-1M).temporalAdd(-2d)}, 20:00m, today(), today()+30, 'M', [2, 3]);
 
 // manager & company indicator
-scheduleJob('monthly_manager_indicator', "Manager indicator calculation", CalMCIndicatorTask{'PL', now().temporalAdd(-1m).temporalAdd(-2d)}, 22:00m, today(), today()+30, 'M', [2, 3]);
-scheduleJob('monthly_company_indicator', "Company indicator calculation", CalMCIndicatorTask{'CO', now().temporalAdd(-1m).temporalAdd(-2d)}, 23:00m, today(), today()+30, 'M', [2, 3]);
+scheduleJob('monthly_manager_indicator', "Manager indicator calculation", CalMCIndicatorTask{'PL', now().temporalAdd(-1M).temporalAdd(-2d)}, 22:00m, today(), today()+30, 'M', [2, 3]);
+scheduleJob('monthly_company_indicator', "Company indicator calculation", CalMCIndicatorTask{'CO', now().temporalAdd(-1M).temporalAdd(-2d)}, 23:00m, today(), today()+30, 'M', [2, 3]);
 
 // manager BFI matching
-scheduleJob('monthly_manager_bfi_matching', "Manager bfi matching", MatchManagerBFITask{now().temporalAdd(-1m).temporalAdd(-2d)}, 00:00m, today(), today()+30, 'M', [3, 4]);
+scheduleJob('monthly_manager_bfi_matching', "Manager bfi matching", MatchManagerBFITask{now().temporalAdd(-1M).temporalAdd(-2d)}, 00:00m, today(), today()+30, 'M', [3, 4]);
 
 // manager BFI indicator
-scheduleJob('monthly_manager_bfi_indicator', "Manager bfi indicator calculation", CalManagerBfiIndicatorTask{now().temporalAdd(-1m).temporalAdd(-2d)}, 02:00m, today(), today()+30, 'M', [3, 4]);
+scheduleJob('monthly_manager_bfi_indicator', "Manager bfi indicator calculation", CalManagerBfiIndicatorTask{now().temporalAdd(-1M).temporalAdd(-2d)}, 02:00m, today(), today()+30, 'M', [3, 4]);
 
 // manager & company rankings
-scheduleJob('monthly_company_ranking', "Company PBI ranking calculation", CalEntityRankingTask{'CO', now().temporalAdd(-1m).month(), true}, 03:00m, today(), today()+30, 'M', [3, 4]);
-scheduleJob('monthly_manager_ranking', "Manager PBI ranking calculation", CalEntityRankingTask{'PL', now().temporalAdd(-1m).month(), true}, 04:00m, today(), today()+30, 'M', [3, 4]);
+scheduleJob('monthly_company_ranking', "Company PBI ranking calculation", CalEntityRankingTask{'CO', now().temporalAdd(-1M).month(), true}, 03:00m, today(), today()+30, 'M', [3, 4]);
+scheduleJob('monthly_manager_ranking', "Manager PBI ranking calculation", CalEntityRankingTask{'PL', now().temporalAdd(-1M).month(), true}, 04:00m, today(), today()+30, 'M', [3, 4]);
 
 // manager bfi ranking
-scheduleJob('monthly_manager_bfi_ranking', "Manager BFI ranking calculation", CalEntityBfiRankingTask{'PL', now().temporalAdd(-1m).month(), true}, 06:00m, today(), today()+30, 'M', [3, 4]);
+scheduleJob('monthly_manager_bfi_ranking', "Manager BFI ranking calculation", CalEntityBfiRankingTask{'PL', now().temporalAdd(-1M).month(), true}, 06:00m, today(), today()+30, 'M', [3, 4]);
 
 
 // fund rankings
-scheduleJob('monthly_fund_ranking', "Fund PBI ranking calculation", CalEntityRankingTask{'MF', now().temporalAdd(-1m).month(), true}, 19:00m, today(), today()+30, 'M', [5, 6]);
-scheduleJob('monthly_fund_bfi_ranking', "Fund BFI ranking calculation", CalEntityBfiRankingTask{'MF', now().temporalAdd(-1m).month(), true}, 20:00m, today(), today()+30, 'M', [5, 6]);
+scheduleJob('monthly_fund_ranking', "Fund PBI ranking calculation", CalEntityRankingTask{'MF', now().temporalAdd(-1M).month(), true}, 19:00m, today(), today()+30, 'M', [5, 6]);
+scheduleJob('monthly_fund_bfi_ranking', "Fund BFI ranking calculation", CalEntityBfiRankingTask{'MF', now().temporalAdd(-1M).month(), true}, 20:00m, today(), today()+30, 'M', [5, 6]);
 
 // portfolio rankings (strategy, substrategy, bfi included)
-scheduleJob('monthly_portfolio_ranking', "Portfolio ranking calculation", CalRelativeRankingTask{'PF', NULL, now().temporalAdd(-1m).month(), true}, 21:00m, today(), today()+30, 'M', [5, 6]);
+scheduleJob('monthly_portfolio_ranking', "Portfolio ranking calculation", CalRelativeRankingTask{'PF', NULL, now().temporalAdd(-1M).month(), true}, 21:00m, today(), today()+30, 'M', [5, 6]);
 

+ 7 - 0
modules/indicatorCalculator.dos

@@ -150,6 +150,13 @@ def cal_basic_performance(entity_info, ret, trailing_month) {
         FROM ret WHERE ret > -1
         CONTEXT BY entity_id
         ORDER BY entity_id, end_date;
+
+        // price_date.mmax(win) 当行数不够 win 时会返回 null, 补回这些日期
+        UPDATE t1
+          SET t1.price_date = ret.price_date.max()
+        FROM ej(t1, ret, ['entity_id', 'end_date'])
+        WHERE t1.price_date IS NULL
+        CONTEXT BY t1.entity_id, t1.end_date;
     }
 
     t1.addColumn('calmar', DOUBLE);

+ 2 - 2
modules/rankingCalculator.dos

@@ -518,7 +518,7 @@ def save_ranking_tables(entity_type, ranking_by, ranking_tables) {
 			t.rename!('category_id', category_id_col);
 	}
 
-    save_and_sync(t, source_table + '_num', target_table + '_num', entity_id_col, 'end_date');
+    save_and_sync(t, source_table + '_num', target_table + '_num', '', 'end_date');
 
 	// 基金有二级策略排名
     if(ranking_by == 'strategy' && entity_type IN ['HF', 'MF']) {
@@ -531,7 +531,7 @@ def save_ranking_tables(entity_type, ranking_by, ranking_tables) {
     	save_and_sync(t.rename!(['entity_id', 'category_id'], [entity_id_col, category_id_col]), source_table, target_table, entity_id_col, 'end_date');
 
 		t = ranking_tables[3];
-	    save_and_sync(t.rename!('category_id', category_id_col), source_table + '_num', target_table + '_num', entity_id_col, 'end_date');
+	    save_and_sync(t.rename!('category_id', category_id_col), source_table + '_num', target_table + '_num', '', 'end_date');
     }
 	
 }

+ 2 - 2
modules/task_fundPerformance.dos

@@ -14,7 +14,7 @@ use fundit::ms_dataPuller;
  * 
  *  @param date <DATETIME>
  * 
- *  Example: GetEntityNavTask(2024.09.01);  // 【初始化专用】
+ *  Example: GetEntityNavTask(2025.02.03); 
  */
 def GetEntityNavTask(date) {
 
@@ -112,7 +112,7 @@ def calFundPerformanceTask(entityType, date) {
 	    tb_fund_latest_performance = create_entity_latest_performance();
 
         funds = tb_cal_funds[i : min(tb_cal_funds.size(), i+batch_size)];
-// funds = SELECT * FROM tb_cal_funds WHERE entity_id = 'MF00004QR9'
+// funds = SELECT entity_id, 2001.12.18 as price_date FROM tb_cal_funds WHERE entity_id = 'MF00003PW1'
         if(funds.isVoid() || funds.size() == 0) break;
 
         // 200ms