コード例 #1
0
        public static double calcBonusRefValue(string stockID, string year, string season)
        {
            double bonus = 0;

            if (getDistribBonus(stockID, year, season, out bonus))
            {
                List <StockKLine> mk = StockDataCenter.getInstance().getMonthKLine(stockID);
                if (mk == null)
                {
                    return(0.0);
                }
                string     targetMonth = convertMonthBySeason(season);
                StockKLine kl          = StockDataUtil.getMonthKLineByYearMonth(mk, year, targetMonth);

                return(bonus / kl.latestPrice);
            }

            return(0.0);
        }
コード例 #2
0
        public static double calcCostRefValueForQuarter(string stockID, string year, string season)
        {
            double          costRefVal = 0.0;
            StockReportData rd         = StockDBVisitor.getInstance().getStockReportData(stockID, year, season);
            int             qt         = int.Parse(season);

            if (rd == null)
            {
                return(0.0);
            }

            double eps = rd.eps;

            if (qt > 1)
            {
                int             prevQuarter = qt - 1;
                StockReportData prevRd      = StockDBVisitor.getInstance().getStockReportData(stockID, year, prevQuarter.ToString());
                if (prevRd != null)
                {
                    eps -= prevRd.eps;
                }
            }

            //string str = StockDataCollector.queryMonthlyKLineData(stockID);
            List <StockKLine> mk = StockDataCenter.getInstance().getMonthKLine(stockID); //StockDataConvertor.parseKLineArray(str);

            if (mk == null)
            {
                return(0.0);
            }

            string     targetMonth = convertMonthBySeason(season);
            StockKLine kl          = StockDataUtil.getMonthKLineByYearMonth(mk, year, targetMonth);
            int        quarter     = int.Parse(season);

            if (kl != null)
            {
                costRefVal = eps / kl.latestPrice;
            }

            return(costRefVal);
        }
コード例 #3
0
        public static double calcCostRefValue(string stockID, string year, string season)
        {
            double          costRefVal = 0.0;
            StockReportData rd         = StockDBVisitor.getInstance().getStockReportData(stockID, year, season);

            List <StockKLine> mk = StockDataCenter.getInstance().getMonthKLine(stockID);

            if (mk == null)
            {
                return(0.0);
            }
            string     targetMonth = convertMonthBySeason(season);
            StockKLine kl          = StockDataUtil.getMonthKLineByYearMonth(mk, year, targetMonth);
            int        quarter     = int.Parse(season);

            if (rd != null && kl != null)
            {
                costRefVal = (rd.eps / kl.latestPrice) / quarter * 4;
            }

            return(costRefVal);
        }
コード例 #4
0
        public static double calcPBCostValue(string stockID, string year, string quarter)
        {
            double          costRefVal = 0.0;
            double          pe         = 0.0;
            StockReportData rd         = StockDBVisitor.getInstance().getStockReportData(stockID, year, quarter);

            if (rd == null)
            {
                return(double.MaxValue);
            }

            List <StockKLine> mk = StockDataCenter.getInstance().getMonthKLine(stockID);

            if (mk == null)
            {
                return(double.MaxValue);
            }

            string     targetMonth = convertMonthBySeason(quarter);
            StockKLine kl          = StockDataUtil.getMonthKLineByYearMonth(mk, year, targetMonth);

            if (kl == null)
            {
                return(double.MaxValue);
            }
            pe = kl.latestPrice / rd.eps;

            StockProfitData pd = StockDBVisitor.getInstance().getStockProfitData(stockID, year, quarter);

            if (pd == null)
            {
                return(double.MaxValue);
            }

            costRefVal = pe * pd.roe;

            return(costRefVal);
        }