portfolioDataPuller.dos 624 B

12345678910111213141516171819202122232425262728
  1. module fundit::portfolioDataPuller
  2. use fundit::sqlUtilities
  3. /*
  4. * 取组合交易表
  5. *
  6. *
  7. * Example: get_portfolio_holding_history("166002,364640")
  8. */
  9. def get_portfolio_holding_history(portfolio_ids) {
  10. s_query = "SELECT portfolio_id, holding_date, fund_id, amount, fund_share, ROUND(amount/fund_share, 6) AS nav
  11. FROM pfdb.pf_portfolio_fund_history
  12. WHERE portfolio_id IN (" + portfolio_ids + ")
  13. AND isvalid = 1
  14. ORDER BY portfolio_id, holding_date";
  15. conn = connect_mysql();
  16. t = odbc::query(conn, s_query);
  17. conn.close();
  18. return t;
  19. }