protected IStockFilter generateInIndustryFilter() { IStockFilter filter = null; NumericStockFilter comparer = null; AppInIndustryFilterSubType indType = (AppInIndustryFilterSubType)m_subType; string year = GlobalConfig.getInstance().curYear; string quarter = GlobalConfig.getInstance().curQuarter; switch (indType) { case AppInIndustryFilterSubType.IIFST_CostAnnual: comparer = new AnnualCostPerfFilter(year, quarter, 0.0); break; case AppInIndustryFilterSubType.IIFST_CostDynamic: comparer = new CostPerfFilter(year, quarter, 0.0); break; case AppInIndustryFilterSubType.IIFST_PEDynamic: comparer = new DynamicPEFilter(0.0); break; case AppInIndustryFilterSubType.IIFST_PEStatic: comparer = new PEFilter(0.0); break; case AppInIndustryFilterSubType.IIFST_ROE: comparer = new ROEFilter(year, quarter, 0.0); break; case AppInIndustryFilterSubType.IIFST_NetProfitRatio: comparer = new NetProfitRatioFilter(year, quarter, 0.0); break; default: break; } if (comparer != null) { filter = new AvgValInIndustryFilter(comparer, m_param1); } return(filter); }
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); }