Parcourir la source

小修小补,<TAB>变空格

Joey il y a 1 semaine
Parent
commit
a3fc4ea9e9
1 fichiers modifiés avec 39 ajouts et 0 suppressions
  1. 39 0
      modules/sqlUtilities.dos

+ 39 - 0
modules/sqlUtilities.dos

@@ -90,3 +90,42 @@ def save_hedge_fund_nav_to_local(tb_nav) {
     save_table(tb_nav, "mfdb.nav", false)
 
 }
+
+/*
+ *  根据不同类型的主体返回其净值表的表名、字段名和ID前两位特征字符
+ */
+def get_nav_table_description(entity_type) {
+
+    tmp_universe = table(100:0, 
+                         ['type', 'table_name', 'sec_id_col', 'cumulative_nav_col', 'nav_col', 'prefix'],
+                         [STRING, STRING, STRING, STRING, STRING, STRING]);
+
+    // 分别对应:私募,公募,私有基金,股票,市场指数,图译指数,私有指数,图译因子,组合
+    INSERT INTO tmp_universe VALUES  ( ['HF', 'MF', 'CF', 'EQ', 'MI', 'FI', 'CI', 'FA', 'PF'],
+        ['mfdb.nav', 'mfdb.public_nav', 'pfdb.pf_cus_fund_nav', 'mfdb.stock_price', 'mfdb.market_indexes', 'mfdb.indexes_ty_index', 'pfdb.cm_udf_index_nav', 'pfdb.cm_factor_value', 'pfdb.pf_portfolio_nav'],
+        ['fund_id', 'fund_id', 'fund_id', 'sec_id', 'index_id', 'index_id', 'index_id', 'factor_id', 'portfolio_id'],
+        ['cumulative_nav', 'cumulative_nav', 'cumulative_nav', 'cumulative_nav', 'close', 'index_value', 'cumulative_nav', 'factor_value', 'cumulative_nav'],
+        ['nav', 'nav', 'nav', 'nav', 'close', 'index_value', 'cumulative_nav', 'factor_value', 'cumulative_nav'],
+        ['HF', 'MF', 'CF', 'EQ', 'IN', 'IN', 'CI', 'FA', '']);
+
+    return (SELECT * FROM tmp_universe u WHERE u.type = entity_type);
+    
+}
+
+/*
+ *  根据不同类型的主体返回其业绩表的表名、字段名和ID前两位特征字符
+ */
+def get_performance_table_description(entity_type) {
+
+    tmp_universe = table(100:0, 
+                         ['type', 'table_name', 'sec_id_col'],
+                         [STRING, STRING, STRING]);
+
+    // 分别对应:公私募,私有基金,股票,市场/图译指数,私有指数,图译因子,组合
+    INSERT INTO tmp_universe VALUES  ( ['FD', 'CF', 'EQ', 'IX', 'CI', 'FA', 'PF'],
+        ['mfdb.fund_performance', 'pfdb.pf_cus_fund_performance', 'mfdb.stock_performance', 'mfdb.fund_performance', 'pfdb.cm_udf_index_performance', 'pfdb.cm_factor_performance', 'pfdb.pf_portfolio_performance'],
+        ['fund_id', 'fund_id', 'sec_id', 'fund_id', 'index_id', 'factor_id', 'portfolio_id']);
+
+    return (SELECT * FROM tmp_universe u WHERE u.type = entity_type);
+    
+}