Joey hai 1 semana
pai
achega
caf29e0784
Modificáronse 1 ficheiros con 25 adicións e 1 borrados
  1. 25 1
      modules/dataPuller.dos

+ 25 - 1
modules/dataPuller.dos

@@ -115,7 +115,7 @@ def get_monthly_ret(entity_type, entity_ids, start_date, end_date, isFromMySQL)
 
     if(isFromMySQL == true) {
 
-        s_query = "SELECT " + tmp.sec_id_col[0] + ", end_date, price_date, ret_1m AS ret, cumulative_nav AS nav, ret_ytd_a, ret_incep_a
+        s_query = "SELECT " + tmp.sec_id_col[0] + ", end_date, price_date, ret_1m AS ret, " + tmp.cumulative_nav_col[0] + " AS nav, ret_ytd_a, ret_incep_a
                    FROM " + tmp.table_name[0] + "
                    WHERE " + tmp.sec_id_col[0] + " IN (" + s_entity_ids + ")
                       AND isvalid = 1
@@ -415,6 +415,30 @@ def get_nav_for_hedge_fund_performance(fund_ids, month_end) {
 }
 
 /*
+ *  取某月的基金BFI因子
+ * 
+ *  Example: get_fund_bfi_factors("'MF00003PW2', 'MF00003PW1', 'MF00003PXO'", '2024-06');
+ */
+def get_fund_bfi_factors(fund_ids, month_end) {
+
+    s_query = "SELECT fund_id, factor_id, end_date
+               FROM pfdb.pf_fund_factor_bfi_by_category_group
+               WHERE fund_id IN (" + fund_ids + ")
+                 AND end_date = '" + month_end + "'
+                 AND isvalid = 1;";
+
+    conn = connect_mysql();
+
+    t = odbc::query(conn, s_query);
+
+    conn.close();
+
+    return t;
+
+}
+
+
+/*
  * 取组合交易表
  *
  *