Browse Source

小修小补

Joey 1 month ago
parent
commit
bbd62157a9
2 changed files with 11 additions and 18 deletions
  1. 10 18
      modules/task_fundPerformance.dos
  2. 1 0
      modules/task_portfolioPerformance.dos

+ 10 - 18
modules/task_fundPerformance.dos

@@ -33,7 +33,6 @@ def GetEntityNavTask(date) {
 		i = 0;
 		batch_size = 1000;
 		max_cnt = v_entity_id.size();
-//		cnt_nums = 0:0;
 		cnt_num = 0;
 
 		do {
@@ -44,27 +43,20 @@ def GetEntityNavTask(date) {
 
 			tb_nav = sync_entity_nav_by_date(entity_type, s_json);
 
-			try {
-
-				// 建个键值表来更新数据
-//				t_local_table = keyedTable([des.sec_id_col, 'price_date'], load_table_from_local('fundit', des.table_name));
-
-//				cnt_nums += t_local_table.tableUpsert(tb_nav, keyColNames=['entity_id', 'price_date']);
-				t_local_table.append!(tb_nav);
+			if(!(tb_nav.isVoid() || tb_nav.size() == 0)) { 
 
+				try {
 	
-				// 存入本地
-//				save_table(t_local_table, des.table_name, false);
-
-
-
-			} catch(ex) {
-				
-				writeLogLevel(ERROR, ex);
+					t_local_table.append!(tb_nav);
+	
+				} catch(ex) {
+					
+					writeLogLevel(ERROR, ex);
+				}
+	
+				writeLogLevel(INFO, des.table_name + ': UPDATE ' + tb_nav.size()$STRING);
 			}
 
-			writeLogLevel(INFO, des.table_name + ': UPDATE ' + tb_nav.size()$STRING);
-
 			i += batch_size;
 			
 		} while (i < max_cnt);

+ 1 - 0
modules/task_portfolioPerformance.dos

@@ -317,6 +317,7 @@ def CalPortfolioPerformanceTask(updatetime) {
     // 26 min
     rt = cal_and_save_portfolio_nav(tb_cal_ports, is_save_local);
     // 9 min
+	tb_cal_ports.rename!('portfolio_id', 'entity_id');
     rt = rt + '; ' + cal_and_save_entity_indicators('PF', tb_cal_ports, is_save_local);
 
     return rt;