Test_indicatorCalculator.sql 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* standard indicators */
  2. SELECT * FROM mfdb.`fund_performance` WHERE fund_id IN ('MF00003PW1', 'MF00003RS0') AND isvalid = 1 AND end_date IN ('2024-07', '2024-08') ORDER BY fund_id, end_date
  3. SELECT fund_id, end_date, stddev_ytd, stddev_2y, stddev_incep, skewness_ytd, skewness_2y, skewness_incep,
  4. kurtosis_ytd, kurtosis_2y, kurtosis_incep,
  5. worstmonth_ytd, worstmonth_2y, worstmonth_incep, maxdrawdown_ytd, maxdrawdown_2y, maxdrawdown_incep
  6. FROM mfdb.fund_risk_stats WHERE fund_id IN ('MF00003PW1', 'MF00003RS0') AND end_date IN ('2024-07', '2024-08') ORDER BY fund_id, end_date
  7. SELECT fund_id, end_date, calmarratio_ytd, calmarratio_2y, calmarratio_incep
  8. FROM mfdb.`fund_riskadjret_stats` WHERE fund_id IN ('MF00003PW1', 'MF00003RS0') AND end_date IN ('2024-07', '2024-08') ORDER BY fund_id, end_date
  9. SELECT fund_id, end_date, var_ytd, var_2y, var_incep, cvar_ytd, cvar_2y, cvar_incep
  10. FROM mfdb.`fund_indicator` WHERE fund_id IN ('MF00003PW1', 'MF00003RS0') AND end_date IN ('2024-07', '2024-08') ORDER BY fund_id, end_date
  11. /* downside devision, omega, sortnio, kappa */
  12. SELECT fund_id, end_date, downsidedev_ytd, downsidedev_2y, downsidedev_incep
  13. FROM mfdb.fund_risk_stats WHERE fund_id IN ('MF00003PW1', 'MF00003RS0') AND end_date IN ('2024-07', '2024-08') ORDER BY fund_id, end_date
  14. SELECT fund_id, end_date, sortinoratio_ytd, sortinoratio_2y, sortinoratio_incep,
  15. omegaratio_ytd, omegaratio_2y, omegaratio_incep, kapparatio_ytd, kapparatio_2y, kapparatio_incep
  16. FROM mfdb.`fund_riskadjret_stats` WHERE fund_id IN ('MF00003PW1', 'MF00003RS0') AND end_date IN ('2024-07', '2024-08') ORDER BY fund_id, end_date
  17. /* win rate, tracking error, information ratio */
  18. SELECT fund_id, end_date, winrate_ytd, winrate_2y, winrate_incep
  19. FROM mfdb.fund_risk_stats WHERE fund_id IN ('MF00003PW1', 'MF00003RS0') AND end_date IN ('2024-07', '2024-08') ORDER BY fund_id, end_date
  20. SELECT fund_id, end_date, info_ratio_ytd, info_ratio_2y, info_ratio_incep,
  21. tracking_error_ytd, tracking_error_2y, tracking_error_incep
  22. FROM mfdb.`fund_indicator` WHERE fund_id IN ('MF00003PW1', 'MF00003RS0') AND end_date IN ('2024-07', '2024-08') ORDER BY fund_id, end_date
  23. /* alpha, beta */
  24. SELECT fund_id, end_date, beta_ytd, beta_2y, beta_incep, alpha_ytd, alpha_2y, alpha_incep
  25. FROM mfdb.fund_risk_stats WHERE fund_id IN ('MF00003PW1', 'MF00003RS0') AND end_date IN ('2024-07', '2024-08') ORDER BY fund_id, end_date
  26. /* capture indicators */
  27. SELECT fund_id, end_date,
  28. upsidecapture_ret_ytd, upsidecapture_ret_2y, upsidecapture_ret_incep,
  29. upsidecapture_ratio_ytd, upsidecapture_ratio_2y, upsidecapture_ratio_incep,
  30. downsidecapture_ret_ytd, downsidecapture_ret_2y, downsidecapture_ret_incep,
  31. downsidecapture_ratio_ytd, downsidecapture_ratio_2y, downsidecapture_ratio_incep
  32. FROM mfdb.fund_style_stats WHERE fund_id IN ('MF00003PW1', 'MF00003RS0') AND end_date IN ('2024-07', '2024-08') ORDER BY fund_id, end_date
  33. /* sharpe */
  34. SELECT fund_id, end_date, sharperatio_ytd, sharperatio_2y, sharperatio_incep
  35. FROM mfdb.`fund_riskadjret_stats` WHERE fund_id IN ('MF00003PW1', 'MF00003RS0') AND end_date IN ('2024-07', '2024-08') ORDER BY fund_id, end_date
  36. /* treynor, jensen */
  37. SELECT fund_id, end_date,
  38. treynorratio_ytd, treynorratio_2y, treynorratio_incep, jensen_ytd, jensen_2y, jensen_incep
  39. FROM mfdb.`fund_riskadjret_stats` WHERE fund_id IN ('MF00003PW1', 'MF00003RS0') AND end_date IN ('2024-07', '2024-08') ORDER BY fund_id, end_date
  40. /* M2 */
  41. SELECT fund_id, end_date, m2_ytd, m2_2y, m2_incep
  42. FROM mfdb.`fund_indicator` WHERE fund_id IN ('MF00003PW1', 'MF00003RS0') AND end_date IN ('2024-07', '2024-08') ORDER BY fund_id, end_date