예제 #1
0
        /// <summary>
        /// 取得當季 EPS 大於 前 N 季 EPS
        /// </summary>
        /// <param name="date"></param>
        /// <param name="lastSeasonCount">前 N 季</param>
        /// <returns></returns>
        public IEnumerable <SeasonReportPivot> GetSeasonReportPivotListEPSOverThenLastSeason(DateTime date, int lastSeasonCount)
        {
            var seasonReportQuery = new SeasonReportQuery(date);
            var seasonReportList  = _seasonReportRepository.GetSeasonReportPivotList(seasonReportQuery.year, seasonReportQuery.season);

            for (int i = 1; i <= lastSeasonCount; i++)
            {
                int season = seasonReportQuery.season - i;
                int year   = seasonReportQuery.year;
                while (season <= 0)
                {
                    season += 4;
                    year   -= 1;
                }
                var lastSeasonReportList = _seasonReportRepository.GetSeasonReportPivotList(year, season);
                seasonReportList = seasonReportList.Where(report => {
                    var lastReport = lastSeasonReportList.SingleOrDefault(_lastReport => report.stock_id == _lastReport.stock_id);
                    if (lastReport == null)
                    {
                        return(false);
                    }
                    return(report.eps > lastReport.eps);
                });
            }
            return(seasonReportList);
        }
예제 #2
0
 public IActionResult RunSeasonReportClawer([FromBody] SeasonReportQuery seasonReportQuery)
 {
     foreach (EnumModels.SeasonReportType seasonReportType in Enum.GetValues(typeof(EnumModels.SeasonReportType)))
     {
         Task clawerTask = _reportFcatory.GetSeasonReportClawer().ExecuteAsync(seasonReportType, seasonReportQuery.year, seasonReportQuery.season); // 不管執行結果
     }
     return(new JsonResult(new { Success = true }));
 }