Ver código fonte

小修小补

Joey 4 meses atrás
pai
commit
a8294e06e8
1 arquivos alterados com 28 adições e 0 exclusões
  1. 28 0
      modules/portfolioDataPuller.dos

+ 28 - 0
modules/portfolioDataPuller.dos

@@ -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;
+
+}