public static double getStockNetProfit(string stockID, string year, string quarter) { StockProfitData pd = StockDBVisitor.getInstance().getStockProfitData(stockID, year, quarter); if (pd != null) { return(pd.net_profit); } return(0.0); }
public static double getStockNetProfitRatio(string stockID, string year, string quarter) { StockProfitData pd = StockDBVisitor.getInstance().getStockProfitData(stockID, year, quarter); if (pd == null) { return(-double.MaxValue); } return(pd.net_profit_ratio); }
public static double getStockROE(string stockID, string year, string quarter) { StockReportData rd = StockDBVisitor.getInstance().getStockReportData(stockID, year, quarter); if (rd == null) { return(-double.MaxValue); } return(rd.roe); }
public static bool getStockHolderCount(string stockID, string year, string quarter, out int count) { count = 0; StockHolderData hd = StockDBVisitor.getInstance().getStockHolderData(stockID, year, quarter); if (hd == null) { return(false); } count = hd.holders_count; return(true); }
public static bool getStockHolderChange(string stockID, string year, string quarter, out double chg) { chg = 0.0; StockHolderData hd = StockDBVisitor.getInstance().getStockHolderData(stockID, year, quarter); if (hd == null) { return(false); } chg = hd.count_chg; return(true); }
public static double calcCurCostRefValue(string stockID, string year, string season) { double costRefVal = 0.0; StockReportData rd = StockDBVisitor.getInstance().getStockReportData(stockID, year, season); StockMarketData md = StockDataCenter.getInstance().getMarketData(stockID); int quarter = int.Parse(season); if (rd != null && md != null) { costRefVal = (rd.eps / md.latestPrice) / quarter * 4; } return(costRefVal); }
public static bool calcDynamicPE(string stockID, out double val) { StockMarketData md = StockDataCenter.getInstance().getMarketData(stockID); string year = GlobalConfig.getInstance().curYear; string quarter = GlobalConfig.getInstance().curQuarter; StockReportData rd = StockDBVisitor.getInstance().getStockReportData(stockID, year, quarter); val = 0.0; if (md != null && rd != null) { double profitVal = getEstimateProfitValue(rd.net_profits, quarter); val = md.totalCapitalisation * 10000.0 / profitVal; return(true); } return(false); }
public static bool getStockForecastType(string stockID, string year, string season, out StockPerformanceForecastType type) { string ty = null; string tq = null; DateUtil.getNextQuarter(year, season, out ty, out tq); type = StockPerformanceForecastType.PFT_Alert; StockForecastData data = StockDBVisitor.getInstance().getStockForecastData(stockID, ty, tq); if (data == null) { return(false); } type = data.type; return(true); }
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); }
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); }
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); }
public static bool getDistribBonus(string stockID, string year, string season, out double bonus) { bonus = 0.0; StockDistribData data = StockDBVisitor.getInstance().getDistribData(stockID, year, season); if (data.bonus == 0) { return(false); } double factor = 1.0; if (data.deliver > 0) { factor *= ((double)data.deliver + 10.0) / 10.0; } else if (data.transfer > 0) { factor *= ((double)data.transfer + 10.0) / 10.0; } bonus = data.bonus * factor; return(true); }