Пример #1
0
        /// <summary>
        /// 基本面選股方式篩選:
        /// 1. EPS 大於 前一季EPS
        /// 2. 月營收 大於 上月營收 和 去年同月營收
        /// 3. 本益比 大於 15 , 股價淨值比 小於 2 , 殖利率 大於 4 => GetFundamentalDailyList(date, 15, 2, 4)
        /// 4. 股價 大於 10 , 股價 小於 50
        /// </summary>
        /// <param name="date"></param>
        /// <returns></returns>
        public IEnumerable <string> GetPackingStockIds_1(DateTime date)
        {
            var seasonReportList = GetSeasonReportPivotListEPSOverThenLastSeason(date, 1);

            var lastMonthDate            = date.AddMonths(-1);
            var monthRevenueIncreaseList = _revenueRepository.GetMonthRevenueIncrease(lastMonthDate.Year - 1911, lastMonthDate.Month);

            var fundamentalDailyList = GetFundamentalDailyList(date, 15, 2, 4);

            return(seasonReportList.Select(x => x.stock_id)
                   .Intersect(monthRevenueIncreaseList.Select(x => x.stock_id))
                   .Intersect(fundamentalDailyList.Select(x => x.stock_id))
                   .Where(stock_id => {
                var stockList = _stockRepository.GetStocks(new StockQuery()
                {
                    stock_id = stock_id,
                    start_date = date.AddDays(-36),
                    end_date = date
                }).OrderByDescending(x => x.trading_date).Take(20).OrderBy(x => x.trading_date).ToList();

                var closeValue = Convert.ToDecimal(stockList.ElementAt(0).close);
                if (closeValue > 10 && closeValue < 50)
                {
                    return (stockList.Sum(stock => Convert.ToDecimal(stock.close)) / stockList.Count) < Convert.ToDecimal(stockList.ElementAt(0).close);
                }
                else
                {
                    return false;
                }
            }));   //.ToList();
        }
Пример #2
0
 public IActionResult GetMonthRevenueIncrease(int year, int month)
 {
     return(new JsonResult(_revenueRepository.GetMonthRevenueIncrease(year, month)));
 }