Пример #1
0
        protected virtual double getSrcValue(string stockID)
        {
            //int maxYear = 0, maxQuarter = 0;
            //double srcVal = getMaxCostRefValueBefore(stockID, m_targetYear, m_targetSeason, out maxYear, out maxQuarter);
            double srcVal = StockDataCache.getInstance().getMaxCostRefValueBefore(stockID, m_targetYear, m_targetSeason);

            return(srcVal);
        }
Пример #2
0
        protected override double getSrcValue(string stockID)
        {
            //int maxYear = 0;
            //double srcVal = getMaxCostYoyRefValueBefore(stockID, m_targetYear, m_targetSeason, out maxYear);
            double srcVal = StockDataCache.getInstance().getMaxYoyCostRefValueBefore(stockID, m_targetYear, m_targetSeason);

            return(srcVal);
        }
        public bool calcAvgValInIndustry(string stockID, out double val)
        {
            val = 0.0;
            if (m_comparer == null)
            {
                return(false);
            }

            string industryName = StockPool.getInstance().getStockIndustry(stockID);
            string comparerName = m_comparer.getFilterDesc();
            bool   ret          = true;

            if (!StockDataCache.getInstance().getAvgValInIndustry(comparerName, industryName, out val))
            {
                double accumVal   = 0.0;
                int    accumCount = 0;

                List <string> stocksInIndustry = StockPool.getInstance().getStocksInIndustry(industryName);
                foreach (string code in stocksInIndustry)
                {
                    double curVal = 0.0;
                    if (m_comparer.getNumericValue(code, out curVal))
                    {
                        if (m_comparer.needLimitValue() &&
                            !m_comparer.isValueValid(curVal))
                        {
                            curVal = m_comparer.getLimitValue();
                        }
                        accumVal += curVal;
                        accumCount++;
                    }
                }

                if (accumCount > 0)
                {
                    val = accumVal / accumCount;
                    StockDataCache.getInstance().setAvgValInIndustry(comparerName, industryName, val);
                }
                else
                {
                    ret = false;
                }
            }

            return(ret);
        }
Пример #4
0
        public static bool getLowestPriceBetweenDate(string stockID, string beginDate, string endDate, out double lowestPrice)
        {
            if (StockDataCache.getInstance().getLowestPriceBetweenDate(stockID, beginDate, endDate, out lowestPrice))
            {
                return(true);
            }

            List <StockKLineBaidu> arr = StockDataCenter.getInstance().getKLineBaidu(stockID);

            lowestPrice = 0.0;
            if (arr == null || arr.Count == 0)
            {
                return(false);
            }

            lowestPrice = getLowestPrice(arr, beginDate, endDate);
            StockDataCache.getInstance().setLowestPriceBetweenDate(stockID, beginDate, endDate, lowestPrice);
            return(true);
        }
        public override void init(string stockID, string beginDate, string endDate)
        {
            base.init(stockID, beginDate, endDate);

            string year       = GlobalConfig.getInstance().curYear;
            string curYear    = year;
            string quarter    = GlobalConfig.getInstance().curQuarter;
            string curQuarter = quarter;

            if (m_basedOnAnnual)
            {
                if (int.Parse(quarter) < 4)
                {
                    year    = (int.Parse(year) - 1).ToString();
                    quarter = "4";
                }
            }

            AvgValInIndustryFilter peAvgFlt = new AvgValInIndustryFilter(new PEFilter(0.0), 0.0);

            peAvgFlt.calcAvgValInIndustry(m_code, out m_peIndustry);
            AvgValInIndustryFilter roeAvgFlt = new AvgValInIndustryFilter(new ROEFilter(year, quarter, 0.0), 0.0);

            roeAvgFlt.calcAvgValInIndustry(m_code, out m_roeIndustry);
            AvgValInIndustryFilter nprAvgFlt = new AvgValInIndustryFilter(new NetProfitRatioFilter(year, quarter, 0.0), 0.0);

            nprAvgFlt.calcAvgValInIndustry(m_code, out m_nprIndustry);

            m_roe            = ROEFilter.getStockROE(m_code, year, quarter);
            m_netProfitRatio = NetProfitRatioFilter.getStockNetProfitRatio(m_code, year, quarter);

            m_histCost  = StockDataCache.getInstance().getMaxAnnualCostRefValueBefore(m_code, curYear);
            m_curCost   = CostPerfFilter.calcCurCostRefValue(m_code, curYear, curQuarter);
            m_costRatio = m_curCost / m_histCost;

            DynamicPEFilter.calcDynamicPE(m_code, out m_dynamicPE);
        }