|
@@ -585,6 +585,28 @@ def create_entity_indicator_ranking(is_id_integer=false) {
|
|
DOUBLE, INT, INT, DOUBLE, INT, INT]);
|
|
DOUBLE, INT, INT, DOUBLE, INT, INT]);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+/*
|
|
|
|
+ * 建基金经理/公司表 XXXX_indicator_ranking
|
|
|
|
+ */
|
|
|
|
+def create_mc_indicator_ranking(is_id_integer=false) {
|
|
|
|
+
|
|
|
|
+ return table(1000:0,
|
|
|
|
+ ['entity_id', 'curve_type', 'category_id', 'end_date', 'indicator_id',
|
|
|
|
+ 'indicator_1m', 'absrank_1m', 'perrank_1m', 'indicator_3m', 'absrank_3m', 'perrank_3m',
|
|
|
|
+ 'indicator_6m', 'absrank_6m', 'perrank_6m', 'indicator_1y', 'absrank_1y', 'perrank_1y',
|
|
|
|
+ 'indicator_2y', 'absrank_2y', 'perrank_2y', 'indicator_3y', 'absrank_3y', 'perrank_3y',
|
|
|
|
+ 'indicator_5y', 'absrank_5y', 'perrank_5y',
|
|
|
|
+ 'indicator_10y', 'absrank_10y', 'perrank_10y', 'indicator_ytd', 'absrank_ytd', 'perrank_ytd'],
|
|
|
|
+ [SYMBOL, INT, SYMBOL, STRING, INT,
|
|
|
|
+ DOUBLE, INT, INT, DOUBLE, INT, INT,
|
|
|
|
+ DOUBLE, INT, INT, DOUBLE, INT, INT,
|
|
|
|
+ DOUBLE, INT, INT, DOUBLE, INT, INT,
|
|
|
|
+ DOUBLE, INT, INT,
|
|
|
|
+ DOUBLE, INT, INT, DOUBLE, INT, INT]);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* 建表 XXXX_indicator_ranking_num, raise_type 没有用
|
|
* 建表 XXXX_indicator_ranking_num, raise_type 没有用
|
|
*/
|
|
*/
|
|
@@ -633,6 +655,53 @@ def create_entity_indicator_ranking_num() {
|
|
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
|
+ * 建基金经理/公司表 XXXX_indicator_ranking_num, raise_type 没有用
|
|
|
|
+ */
|
|
|
|
+def create_mc_indicator_ranking_num() {
|
|
|
|
+
|
|
|
|
+ return table(1000:0,
|
|
|
|
+ ['curve_type', 'category_id', 'end_date', 'indicator_id',
|
|
|
|
+ 'avg_1m', 'avg_1m_cnt', 'perrank_percent_5_1m', 'perrank_percent_10_1m', 'perrank_percent_25_1m', 'perrank_percent_50_1m',
|
|
|
|
+ 'perrank_percent_75_1m', 'perrank_percent_90_1m', 'perrank_percent_95_1m', 'best_1m', 'worst_1m',
|
|
|
|
+ 'avg_3m', 'avg_3m_cnt', 'perrank_percent_5_3m', 'perrank_percent_10_3m', 'perrank_percent_25_3m', 'perrank_percent_50_3m',
|
|
|
|
+ 'perrank_percent_75_3m', 'perrank_percent_90_3m', 'perrank_percent_95_3m', 'best_3m', 'worst_3m',
|
|
|
|
+ 'avg_6m', 'avg_6m_cnt', 'perrank_percent_5_6m', 'perrank_percent_10_6m', 'perrank_percent_25_6m', 'perrank_percent_50_6m',
|
|
|
|
+ 'perrank_percent_75_6m', 'perrank_percent_90_6m', 'perrank_percent_95_6m', 'best_6m', 'worst_6m',
|
|
|
|
+ 'avg_1y', 'avg_1y_cnt', 'perrank_percent_5_1y', 'perrank_percent_10_1y', 'perrank_percent_25_1y', 'perrank_percent_50_1y',
|
|
|
|
+ 'perrank_percent_75_1y', 'perrank_percent_90_1y', 'perrank_percent_95_1y', 'best_1y', 'worst_1y',
|
|
|
|
+ 'avg_2y', 'avg_2y_cnt', 'perrank_percent_5_2y', 'perrank_percent_10_2y', 'perrank_percent_25_2y', 'perrank_percent_50_2y',
|
|
|
|
+ 'perrank_percent_75_2y', 'perrank_percent_90_2y', 'perrank_percent_95_2y', 'best_2y', 'worst_2y',
|
|
|
|
+ 'avg_3y', 'avg_3y_cnt', 'perrank_percent_5_3y', 'perrank_percent_10_3y', 'perrank_percent_25_3y', 'perrank_percent_50_3y',
|
|
|
|
+ 'perrank_percent_75_3y', 'perrank_percent_90_3y', 'perrank_percent_95_3y', 'best_3y', 'worst_3y',
|
|
|
|
+ 'avg_5y', 'avg_5y_cnt', 'perrank_percent_5_5y', 'perrank_percent_10_5y', 'perrank_percent_25_5y', 'perrank_percent_50_5y',
|
|
|
|
+ 'perrank_percent_75_5y', 'perrank_percent_90_5y', 'perrank_percent_95_5y', 'best_5y', 'worst_5y',
|
|
|
|
+ 'avg_10y', 'avg_10y_cnt', 'perrank_percent_5_10y', 'perrank_percent_10_10y', 'perrank_percent_25_10y', 'perrank_percent_50_10y',
|
|
|
|
+ 'perrank_percent_75_10y', 'perrank_percent_90_10y', 'perrank_percent_95_10y', 'best_10y', 'worst_10y',
|
|
|
|
+ 'avg_ytd', 'avg_ytd_cnt', 'perrank_percent_5_ytd', 'perrank_percent_10_ytd', 'perrank_percent_25_ytd', 'perrank_percent_50_ytd',
|
|
|
|
+ 'perrank_percent_75_ytd', 'perrank_percent_90_ytd', 'perrank_percent_95_ytd', 'best_ytd', 'worst_ytd'],
|
|
|
|
+ [INT, SYMBOL, STRING, INT,
|
|
|
|
+ DOUBLE, INT, DOUBLE, DOUBLE, DOUBLE, DOUBLE,
|
|
|
|
+ DOUBLE, DOUBLE, DOUBLE, DOUBLE, DOUBLE,
|
|
|
|
+ DOUBLE, INT, DOUBLE, DOUBLE, DOUBLE, DOUBLE,
|
|
|
|
+ DOUBLE, DOUBLE, DOUBLE, DOUBLE, DOUBLE,
|
|
|
|
+ DOUBLE, INT, DOUBLE, DOUBLE, DOUBLE, DOUBLE,
|
|
|
|
+ DOUBLE, DOUBLE, DOUBLE, DOUBLE, DOUBLE,
|
|
|
|
+ DOUBLE, INT, DOUBLE, DOUBLE, DOUBLE, DOUBLE,
|
|
|
|
+ DOUBLE, DOUBLE, DOUBLE, DOUBLE, DOUBLE,
|
|
|
|
+ DOUBLE, INT, DOUBLE, DOUBLE, DOUBLE, DOUBLE,
|
|
|
|
+ DOUBLE, DOUBLE, DOUBLE, DOUBLE, DOUBLE,
|
|
|
|
+ DOUBLE, INT, DOUBLE, DOUBLE, DOUBLE, DOUBLE,
|
|
|
|
+ DOUBLE, DOUBLE, DOUBLE, DOUBLE, DOUBLE,
|
|
|
|
+ DOUBLE, INT, DOUBLE, DOUBLE, DOUBLE, DOUBLE,
|
|
|
|
+ DOUBLE, DOUBLE, DOUBLE, DOUBLE, DOUBLE,
|
|
|
|
+ DOUBLE, INT, DOUBLE, DOUBLE, DOUBLE, DOUBLE,
|
|
|
|
+ DOUBLE, DOUBLE, DOUBLE, DOUBLE, DOUBLE,
|
|
|
|
+ DOUBLE, INT, DOUBLE, DOUBLE, DOUBLE, DOUBLE,
|
|
|
|
+ DOUBLE, DOUBLE, DOUBLE, DOUBLE, DOUBLE ]);
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+/*
|
|
* 根据 mysql 表改动某些字段
|
|
* 根据 mysql 表改动某些字段
|
|
*/
|
|
*/
|
|
def chg_columns_for_mysql(mutable tb_mysql, id_col_name) {
|
|
def chg_columns_for_mysql(mutable tb_mysql, id_col_name) {
|
|
@@ -931,6 +1000,9 @@ def generate_entity_style_stats(entity_info, indicators, isToMySQL, mutable enti
|
|
|
|
|
|
/*
|
|
/*
|
|
* 按照 XXX_bfi_bm_indicator 表结构准备数据记录
|
|
* 按照 XXX_bfi_bm_indicator 表结构准备数据记录
|
|
|
|
+ *
|
|
|
|
+ * @param entity_info <TABLE>: [COLUMNS] entity_id, end_date, benchmark_id, inception_date, ini_value [,curve_type, strategy]
|
|
|
|
+ * @param indicators <DICTIONARY>
|
|
*
|
|
*
|
|
* TODO: why we need isToMySQL here?
|
|
* TODO: why we need isToMySQL here?
|
|
* 其它的指标恐怕也要按这个改,因为私募可能会有近6月没有数据但近2年之类的周期有数据的情况!
|
|
* 其它的指标恐怕也要按这个改,因为私募可能会有近6月没有数据但近2年之类的周期有数据的情况!
|
|
@@ -978,7 +1050,10 @@ def generate_entity_bfi_indicator(entity_info, indicators, isToMySQL, mutable en
|
|
t.rename!('t_10y_' + v_cols_from, v_cols_to + '_10y');
|
|
t.rename!('t_10y_' + v_cols_from, v_cols_to + '_10y');
|
|
t.rename!('t_ytd_' + v_cols_from, v_cols_to + '_ytd');
|
|
t.rename!('t_ytd_' + v_cols_from, v_cols_to + '_ytd');
|
|
t.rename!('t_incep_' + v_cols_from, v_cols_to + '_incep');
|
|
t.rename!('t_incep_' + v_cols_from, v_cols_to + '_incep');
|
|
- t.dropColumns!(['inception_date', 'ini_value']).rename!('benchmark_id', 'factor_id');
|
|
|
|
|
|
+
|
|
|
|
+ if(t.columnNames().find('inception_date') >= 0) t.dropColumns!('inception_date');
|
|
|
|
+ if(t.columnNames().find('ini_value') >= 0) t.dropColumns!('ini_value');
|
|
|
|
+ t.rename!('benchmark_id', 'factor_id');
|
|
|
|
|
|
entity_bfi_indicator.tableInsert(t.reorderColumns!(entity_bfi_indicator.colNames()));
|
|
entity_bfi_indicator.tableInsert(t.reorderColumns!(entity_bfi_indicator.colNames()));
|
|
|
|
|