CalculationJobs.dos 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. login(`admin, `123456);
  2. use fundit::task_fundPerformance;
  3. use fundit::task_portfolioPerformance;
  4. use fundit::task_weeklyPerformance;
  5. use fundit::task_monthlyPerformance;
  6. /*
  7. * 定时任务
  8. *
  9. * 查询任务运行; getRecentJobs();
  10. * 查询任务列表:getScheduledJobs('daily_%');
  11. * 删除任务:deleteScheduledJob('monthly_fund_ranking000');
  12. *
  13. *
  14. * SELECT jobId, (endTime - startTime)/1000 as sec, errorMsg from getRecentJobs()
  15. */
  16. /* ------------- DAILY JOBS ---------------------------*/
  17. // index and factor calculations go first
  18. scheduleJob('daily_market_index_performance', "Market Index return and indicator calculation", calFundPerformanceTask{'MI', now().temporalAdd(-3d)}, 22:00m, today(), today()+30, 'D');
  19. scheduleJob('daily_fundit_index_performance', "FundIT Index return and indicator calculation", calFundPerformanceTask{'FI', now().temporalAdd(-3d)}, 22:00m, today(), today()+30, 'D');
  20. scheduleJob('daily_factor_performance', "Factor nav, return and indicator calculation", CalFactorPerformanceTask{now().temporalAdd(-3d)}, 23:00m, today(), today()+30, 'D');
  21. // standard return and indicator calculation
  22. scheduleJob('daily_mutual_fund_performance', "Mutual fund return and indicator calculation", calFundPerformanceTask{'MF', now().temporalAdd(-3d)}, 00:00m, today(), today()+30, 'D');
  23. scheduleJob('daily_hedge_fund_performance', "Hedge fund return and indicator calculation", calFundPerformanceTask{'HF', now().temporalAdd(-3d)}, 00:30m, today(), today()+30, 'D');
  24. scheduleJob('daily_portfolio_performance', "Portfolio nav, return and indicator calculation", CalPortfolioPerformanceTask{now().temporalAdd(-3d)}, 01:00m, today(), today()+30, 'D');
  25. /* ------------- WEEKLY JOBS ---------------------------*/
  26. // RBSA calculation
  27. scheduleJob('weekly_fund_rbsa', "Fund RBSA calculation", CalEntityRBSATask{'MF', NULL, now().temporalAdd(-7d)}, 07:00m, today(), today()+30, 'W', [6, 0]);
  28. scheduleJob('weekly_portfolio_rbsa', "Portfolio RBSA calculation", CalEntityRBSATask{'PF', NULL, now().temporalAdd(-7d)}, 07:30m, today(), today()+30, 'W', [6, 0]);
  29. // Category Average index weekly NAV
  30. scheduleJob('weekly_category_avg_nav', "Category Average NAV calculation", CalCategoryAverageNavTask{now().temporalAdd(-7d)}, 08:00m, today(), today()+30, 'W', [6, 0]);
  31. // BFI MATCHING HERE
  32. scheduleJob('weekly_fund_bfi_matching', "Fund bfi matching", MatchEntityBFITask{'MF', now().temporalAdd(-3d)}, 01:30m, today(), today()+30, 'W', [6, 0]);
  33. scheduleJob('weekly_portfolio_bfi_matching', "Portfolio bfi matching", MatchEntityBFITask{'PF', now().temporalAdd(-3d)}, 06:00m, today(), today()+30, 'W', [6, 0]);
  34. // BFI indicator calculation
  35. scheduleJob('weekly_fund_bfi_indicator', "Fund BFI indicator calculation", calEntityBfiIndicatorTask{'MF', now().temporalAdd(-3d)}, 07:00m, today(), today()+30, 'W', [6, 0]);
  36. scheduleJob('weekly_portfolio_bfi_indicator', "Portfolio BFI indicator calculation", calEntityBfiIndicatorTask{'PF', now().temporalAdd(-3d)}, 08:00m, today(), today()+30, 'W', [6, 0]);
  37. /* ------------- MONTHLY JOBS ---------------------------*/
  38. // manager & company nav
  39. scheduleJob('monthly_manager_nav', "Manager NAV calculation", CalMCNavTask{'PL', now().temporalAdd(-1m).month(), true}, 18:00m, today(), today()+30, 'M', [2, 3]);
  40. scheduleJob('monthly_company_nav', "Company NAV calculation", CalMCNavTask{'CO', now().temporalAdd(-1m).month(), true}, 20:00m, today(), today()+30, 'M', [2, 3]);
  41. // manager & company indicator
  42. scheduleJob('monthly_manager_indicator', "Manager indicator calculation", CalMCIndicatorTask{'PL', now().temporalAdd(-1m).month(), true}, 22:00m, today(), today()+30, 'M', [2, 3]);
  43. scheduleJob('monthly_company_indicator', "Company indicator calculation", CalMCIndicatorTask{'CO', now().temporalAdd(-1m).month(), true}, 23:00m, today(), today()+30, 'M', [2, 3]);
  44. // manager BFI matching
  45. scheduleJob('monthly_manager_bfi_matching', "Manager bfi matching", MatchManagerBFITask{now().temporalAdd(-1m).month(), true}, 00:00m, today(), today()+30, 'M', [3, 4]);
  46. // fund rankings
  47. scheduleJob('monthly_fund_ranking', "Fund PBI ranking calculation", CalEntityRankingTask{'MF', now().temporalAdd(-1m).month(), true}, 19:00m, today(), today()+30, 'M', [5, 6]);
  48. scheduleJob('monthly_fund_bfi_ranking', "Fund BFI ranking calculation", CalEntityBfiRankingTask{'MF', now().temporalAdd(-1m).month(), true}, 20:00m, today(), today()+30, 'M', [5, 6]);
  49. // portfolio rankings (strategy, substrategy, bfi included)
  50. scheduleJob('monthly_portfolio_ranking', "Portfolio ranking calculation", CalRelativeRankingTask{'PF', NULL, now().temporalAdd(-1m).month(), true}, 21:00m, today(), today()+30, 'M', [5, 6]);