CalculationJobs.dos 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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('daily_fund_performance');
  12. *
  13. */
  14. /* ------------- DAILY JOBS ---------------------------*/
  15. // index and factor calculations go first
  16. scheduleJob('daily_market_index_performance', "Market Index return and indicator calculation", calFundPerformanceTask{'MI', now().temporalAdd(-3d)}, 22:00m, today(), today()+30, 'D');
  17. scheduleJob('daily_factor_performance', "Factor nav, return and indicator calculation", CalFactorPerformanceTask{now().temporalAdd(-3d)}, 23:00m, today(), today()+30, 'D');
  18. // standard return and indicator calculation
  19. scheduleJob('daily_mutual_fund_performance', "Mutual fund return and indicator calculation", calFundPerformanceTask{'MF', now().temporalAdd(-3d)}, 00:00m, today(), today()+30, 'D');
  20. scheduleJob('daily_hedge_fund_performance', "Hedge fund return and indicator calculation", calFundPerformanceTask{'HF', now().temporalAdd(-3d)}, 00:30m, today(), today()+30, 'D');
  21. scheduleJob('daily_portfolio_performance', "Portfolio nav, return and indicator calculation", CalPortfolioPerformanceTask{now().temporalAdd(-3d)}, 01:00m, today(), today()+30, 'D');
  22. /* ------------- WEEKLY JOBS ---------------------------*/
  23. // RBSA calculation (TODO: change them to weekly)
  24. scheduleJob('weekly_fund_rbsa', "Fund RBSA calculation", CalFundRBSATask{'MF', NULL, now().temporalAdd(-3d)}, 07:00m, today(), today()+30, 'D');
  25. //scheduleJob('weekly_fund_rbsa', "Fund RBSA calculation", CalFundRBSATask{'MF', NULL, now().temporalAdd(-3d)}, 07:00m, today(), today()+30, 'W', 6);
  26. // BFI MATCHING HERE
  27. scheduleJob('weekly_fund_bfi_matching', "Fund bfi matching", MatchEntityBFITask{'MF', now().temporalAdd(-3d)}, 01:30m, today(), today()+30, 'D');
  28. scheduleJob('weekly_portfolio_bfi_matching', "Portfolio bfi matching", MatchEntityBFITask{'PF', now().temporalAdd(-3d)}, 06:00m, today(), today()+30, 'D');
  29. // BFI indicator calculation
  30. scheduleJob('weekly_fund_bfi_indicator', "Fund BFI indicator calculation", calEntityBfiIndicatorTask{'MF', now().temporalAdd(-3d)}, 07:00m, today(), today()+30, 'D');
  31. scheduleJob('weekly_portfolio_bfi_indicator', "Portfolio BFI indicator calculation", calEntityBfiIndicatorTask{'PF', now().temporalAdd(-3d)}, 08:00m, today(), today()+30, 'D');
  32. /* ------------- MONTHLY JOBS ---------------------------*/
  33. // fund rankings
  34. scheduleJob('monthly_fund_ranking', "Fund PBI ranking calculation", CalEntityRankingTask{'MF', now().temporalAdd(-1m).month(), true}, 19:00m, today(), today()+30, 'M', [5, 6]);
  35. scheduleJob('monthly_fund_bfi_ranking', "Fund BFI ranking calculation", CalEntityBfiRankingTask{'MF', now().temporalAdd(-1m).month(), true}, 20:00m, today(), today()+30, 'M', [5, 6]);
  36. // portfolio rankings (strategy, substrategy, bfi included)
  37. scheduleJob('monthly_portfolio_ranking', "Portfolio ranking calculation", CalRelativeRankingTask{'PF', NULL, now().temporalAdd(-1m).month(), true}, 21:00m, today(), today()+30, 'M', [5, 6]);