|
@@ -0,0 +1,28 @@
|
|
|
+module fundit::portfolioDataPuller
|
|
|
+
|
|
|
+use fundit::sqlUtilities
|
|
|
+
|
|
|
+
|
|
|
+/*
|
|
|
+ * 取组合交易表
|
|
|
+ *
|
|
|
+ *
|
|
|
+ * Example: get_portfolio_holding_history("166002,364640")
|
|
|
+ */
|
|
|
+def get_portfolio_holding_history(portfolio_ids) {
|
|
|
+
|
|
|
+ s_query = "SELECT portfolio_id, holding_date, fund_id, amount, fund_share, ROUND(amount/fund_share, 6) AS nav
|
|
|
+ FROM pfdb.pf_portfolio_fund_history
|
|
|
+ WHERE portfolio_id IN (" + portfolio_ids + ")
|
|
|
+ AND isvalid = 1
|
|
|
+ ORDER BY portfolio_id, holding_date";
|
|
|
+
|
|
|
+ conn = connect_mysql();
|
|
|
+
|
|
|
+ t = odbc::query(conn, s_query);
|
|
|
+
|
|
|
+ conn.close();
|
|
|
+
|
|
|
+ return t;
|
|
|
+
|
|
|
+}
|