CalculationJobs.dos 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // login(`admin, `123456);
  2. // clearCachedModules();
  3. use fundit::task_fundPerformance;
  4. use fundit::task_portfolioPerformance;
  5. use fundit::task_weeklyPerformance;
  6. use fundit::task_monthlyPerformance;
  7. /*
  8. * 定时任务
  9. *
  10. * 查询任务运行; getRecentJobs();
  11. * 查询任务列表:getScheduledJobs('weekly_%');
  12. * 删除任务:deleteScheduledJob('monthly_company_nav');
  13. *
  14. * 任务全删除(用于重新Load本文件):
  15. * v_jobId = EXEC jobId from getScheduledJobs('daily_%').append!(getScheduledJobs('weekly_%')).append!(getScheduledJobs('monthly_%'));
  16. * for(jobId in v_jobId) deleteScheduledJob(jobId);
  17. *
  18. *
  19. */
  20. /* ------------- DAILY JOBS ---------------------------*/
  21. // nav sync
  22. scheduleJob('daily_nav_sync', "Sync NAV for fund and index", GetEntityNavTask{now().temporalAdd(-3d)}, 20:00m, today(), today()+30, 'D');
  23. // index and factor calculations go first
  24. scheduleJob('daily_market_index_performance', "Market Index return and indicator calculation", calFundPerformanceTask{'MI', now().temporalAdd(-3d)}, 22:00m, today(), today()+30, 'D');
  25. scheduleJob('daily_fundit_index_performance', "FundIT Index return and indicator calculation", calFundPerformanceTask{'FI', now().temporalAdd(-3d)}, 22:00m, today(), today()+30, 'D');
  26. scheduleJob('daily_factor_performance', "Factor nav, return and indicator calculation", CalFactorPerformanceTask{now().temporalAdd(-3d)}, 23:00m, today(), today()+30, 'D');
  27. // standard return and indicator calculation
  28. scheduleJob('daily_mutual_fund_performance', "Mutual fund return and indicator calculation", calFundPerformanceTask{'MF', now().temporalAdd(-3d)}, 00:00m, today(), today()+30, 'D');
  29. scheduleJob('daily_hedge_fund_performance', "Hedge fund return and indicator calculation", calFundPerformanceTask{'HF', now().temporalAdd(-3d)}, 00:30m, today(), today()+30, 'D');
  30. scheduleJob('daily_portfolio_performance', "Portfolio nav, return and indicator calculation", CalPortfolioPerformanceTask{now().temporalAdd(-3d)}, 01:00m, today(), today()+30, 'D');
  31. /* ------------- WEEKLY JOBS ---------------------------*/
  32. // RBSA calculation
  33. scheduleJob('weekly_fund_rbsa', "Fund RBSA calculation", CalEntityRBSATask{'MF', NULL, now().temporalAdd(-7d)}, 07:00m, today(), today()+30, 'W', [6, 0]);
  34. scheduleJob('weekly_portfolio_rbsa', "Portfolio RBSA calculation", CalEntityRBSATask{'PF', NULL, now().temporalAdd(-7d)}, 07:30m, today(), today()+30, 'W', [6, 0]);
  35. // Category Average index weekly NAV
  36. scheduleJob('weekly_category_avg_nav', "Category Average NAV calculation", CalCategoryAverageNavTask{now().temporalAdd(-7d)}, 08:00m, today(), today()+30, 'W', [6, 0]);
  37. // manager & company nav
  38. scheduleJob('weekly_manager_nav', "Manager NAV calculation", CalMCWeeklyNavTask{'PL', now().temporalAdd(-7d)}, 08:30m, today(), today()+30, 'W', [6, 0]);
  39. scheduleJob('weekly_company_nav', "Company NAV calculation", CalMCWeeklyNavTask{'CO', now().temporalAdd(-7d)}, 09:00m, today(), today()+30, 'W', [6, 0]);
  40. // BFI MATCHING HERE
  41. scheduleJob('weekly_fund_bfi_matching', "Fund bfi matching", MatchEntityBFITask{'MF', now().temporalAdd(-3d)}, 01:30m, today(), today()+30, 'W', [6, 0]);
  42. scheduleJob('weekly_portfolio_bfi_matching', "Portfolio bfi matching", MatchEntityBFITask{'PF', now().temporalAdd(-3d)}, 06:00m, today(), today()+30, 'W', [6, 0]);
  43. // BFI indicator calculation
  44. scheduleJob('weekly_fund_bfi_indicator', "Fund BFI indicator calculation", calEntityBfiIndicatorTask{'MF', now().temporalAdd(-3d)}, 07:00m, today(), today()+30, 'W', [6, 0]);
  45. scheduleJob('weekly_portfolio_bfi_indicator', "Portfolio BFI indicator calculation", calEntityBfiIndicatorTask{'PF', now().temporalAdd(-3d)}, 08:00m, today(), today()+30, 'W', [6, 0]);
  46. /* ------------- MONTHLY JOBS ---------------------------*/
  47. // manager & company nav
  48. scheduleJob('monthly_manager_nav', "Manager NAV calculation", CalMCMonthlyNavTask{'PL', now().temporalAdd(-1m).month()}, 18:00m, today(), today()+30, 'M', [2, 3]);
  49. scheduleJob('monthly_company_nav', "Company NAV calculation", CalMCMonthlyNavTask{'CO', now().temporalAdd(-1m).month()}, 20:00m, today(), today()+30, 'M', [2, 3]);
  50. // manager & company indicator
  51. scheduleJob('monthly_manager_indicator', "Manager indicator calculation", CalMCIndicatorTask{'PL', now().temporalAdd(-1m).month()}, 22:00m, today(), today()+30, 'M', [2, 3]);
  52. scheduleJob('monthly_company_indicator', "Company indicator calculation", CalMCIndicatorTask{'CO', now().temporalAdd(-1m).month()}, 23:00m, today(), today()+30, 'M', [2, 3]);
  53. // manager BFI matching
  54. scheduleJob('monthly_manager_bfi_matching', "Manager bfi matching", MatchManagerBFITask{now().temporalAdd(-1m).month()}, 00:00m, today(), today()+30, 'M', [3, 4]);
  55. // manager BFI indicator
  56. scheduleJob('monthly_manager_bfi_indicator', "Manager bfi indicator calculation", CalManagerBfiIndicatorTask{now().temporalAdd(-1m).month()}, 02:00m, today(), today()+30, 'M', [3, 4]);
  57. // manager & company rankings
  58. scheduleJob('monthly_company_ranking', "Company PBI ranking calculation", CalEntityRankingTask{'CO', now().temporalAdd(-1m).month(), true}, 03:00m, today(), today()+30, 'M', [3, 4]);
  59. scheduleJob('monthly_manager_ranking', "Manager PBI ranking calculation", CalEntityRankingTask{'PL', now().temporalAdd(-1m).month(), true}, 04:00m, today(), today()+30, 'M', [3, 4]);
  60. // manager bfi ranking
  61. scheduleJob('monthly_manager_bfi_ranking', "Manager BFI ranking calculation", CalEntityBfiRankingTask{'PL', now().temporalAdd(-1m).month(), true}, 06:00m, today(), today()+30, 'M', [3, 4]);
  62. // fund rankings
  63. scheduleJob('monthly_fund_ranking', "Fund PBI ranking calculation", CalEntityRankingTask{'MF', now().temporalAdd(-1m).month(), true}, 19:00m, today(), today()+30, 'M', [5, 6]);
  64. scheduleJob('monthly_fund_bfi_ranking', "Fund BFI ranking calculation", CalEntityBfiRankingTask{'MF', now().temporalAdd(-1m).month(), true}, 20:00m, today(), today()+30, 'M', [5, 6]);
  65. // portfolio rankings (strategy, substrategy, bfi included)
  66. scheduleJob('monthly_portfolio_ranking', "Portfolio ranking calculation", CalRelativeRankingTask{'PF', NULL, now().temporalAdd(-1m).month(), true}, 21:00m, today(), today()+30, 'M', [5, 6]);