コード例 #1
0
        private DataTable fetchPeriodPctChgTable()
        {
            DateTime  dtBegin = dateTimePicker1.Value;
            DateTime  dtEnd;
            DataTable dtIndustryPctChg;
            //DataTable dtIndustryVolume;

            string strWindCode = UtilityTable.getCodeStringFromDataTableCol(dtIndustryIndex, 1);

            if (UtilityCalendar.isAfterTradeHour(dateTimePicker1.Value))
            {
                dtBegin = dateTimePicker1.Value;
            }
            else
            {
                dtBegin = UtilityCalendar.fetchDayOffset(DateTime.Now.AddDays(-1), 0);
            }
            dtEnd = dtBegin;

            WindData wd = ConnWindData.fetchTimeSeriesSecInfo(strWindCode, "pct_chg", dtEnd, dtBegin);

            dtIndustryPctChg = ConnWindData.convertWindDatatoTable(wd);

            //wd = ConnWindData.fetchTimeSeriesSecInfo(strWindCode, "volume", dtEnd, dtBegin);
            //dtIndustryVolume = ConnWindData.convertWindDatatoTable(wd);

            dtIndustryPctChg.Columns.Add("Sector Name");
            dtIndustryPctChg.Columns.Add("Sector Code");
            dtIndustryPctChg.Columns.Add("PCT CHG", typeof(double));
            dtIndustryPctChg.Columns.Add("Volume", typeof(double));
            for (int i = 0; i < dtIndustryPctChg.Rows.Count; i++)
            {
                string strIndustryName = dtIndustryIndex.Rows[i][2].ToString();
                dtIndustryPctChg.Rows[i]["Sector Name"] = strIndustryName.Substring(0, strIndustryName.Length - 4);
                dtIndustryPctChg.Rows[i]["Sector Code"] = dtIndustryIndex.Rows[i][1];
                dtIndustryPctChg.Rows[i]["PCT CHG"]     = double.Parse(dtIndustryPctChg.Rows[i]["PCT_CHG"].ToString()) / 100;
                //dtIndustryPctChg.Rows[i]["Volume"] = double.Parse(dtIndustryVolume.Rows[i]["VOLUME"].ToString()) / 10000;
            }

            dtIndustryPctChg.Columns["PCT_CHG"].Dispose();
            DataView dv = dtIndustryPctChg.DefaultView;

            dv.Sort = "PCT CHG Asc";
            return(dv.ToTable());
        }
コード例 #2
0
        /// <summary>
        /// 单季度净利润下限
        /// </summary>
        /// <param name="strWindCode"></param>
        /// <param name="dtReportDater"></param>
        public static void PreannouncementConditionFilter(DataTable dtStock, DateTime dtReportDate)
        {
            DateTime dtPrevReportDate = UtilityCalendar.getSeasonReportDate(dtReportDate, 1);

            string    strWindCode = UtilityTable.getCodeStringFromDataTableCol(dtStock, 1);
            WindData  wd1         = windProfitNoticeNetProfitMin(strWindCode, dtReportDate);
            DataTable dtNPM       = ConnWindData.convertWindDatatoTable(wd1);

            dtEarningPositivePreannouncement.Columns.Add("DATETIME", Type.GetType("System.DateTime"));
            dtEarningPositivePreannouncement.Columns.Add("WINDCODE", typeof(String));
            dtEarningPositivePreannouncement.Columns.Add("COMNAME", typeof(String));
            dtEarningPositivePreannouncement.Columns.Add("PROFITNOTICE_NETPROFITMIN", typeof(Double));
            for (int i = 0; i < dtStock.Rows.Count; i++)
            {
                DataRow dr = dtEarningPositivePreannouncement.NewRow();
                dr["DATETIME"] = dtStock.Rows[i][0];
                dr["WINDCODE"] = dtStock.Rows[i][1];
                dr["COMNAME"]  = dtStock.Rows[i][2];
                double dPNNPM = double.Parse(dtNPM.Rows[i]["PROFITNOTICE_NETPROFITMIN"].ToString());
                if (dPNNPM > 10000000 && !Double.IsNaN(dPNNPM))
                {
                    dr["PROFITNOTICE_NETPROFITMIN"] = dPNNPM / 10000;
                    dtEarningPositivePreannouncement.Rows.Add(dr);
                }
            }

            String strSelectedWindCode = UtilityTable.getCodeStringFromDataTableCol(dtEarningPositivePreannouncement, 1);

            WindData  wd2        = windNetProfitBelongToParComSH(strSelectedWindCode, dtPrevReportDate);
            DataTable dtNPBTPCSH = ConnWindData.convertWindDatatoTable(wd2);

            dtEarningPositivePreannouncement.Columns.Add("SEASON_NETPROFITMIN", typeof(double));
            for (int i = dtEarningPositivePreannouncement.Rows.Count - 1; i >= 0; i--)
            {
                double dProfitNoticeNetProfit = Double.Parse(dtEarningPositivePreannouncement.Rows[i]["PROFITNOTICE_NETPROFITMIN"].ToString());
                double dNetPorfitBTParComSH   = Double.Parse(dtNPBTPCSH.Rows[i]["NP_BELONGTO_PARCOMSH"].ToString());
                if ((dProfitNoticeNetProfit - dNetPorfitBTParComSH) > 10000000)
                {
                    dtEarningPositivePreannouncement.Rows[i]["SEASON_NETPROFITMIN"] = (dProfitNoticeNetProfit - dNetPorfitBTParComSH) / 10000;
                }
                else
                {
                    dtEarningPositivePreannouncement.Rows[i].Delete();
                }
            }
            strSelectedWindCode = UtilityTable.getCodeStringFromDataTableCol(dtEarningPositivePreannouncement, 1);

            WindData  wd3 = windProfitNoticeChangeMin(strSelectedWindCode, dtReportDate);
            DataTable dtProfitNoticeChangeMin = ConnWindData.convertWindDatatoTable(wd3);

            dtEarningPositivePreannouncement.Columns.Add("PN_CHANGEMIN", typeof(double));
            for (int i = dtEarningPositivePreannouncement.Rows.Count - 1; i >= 0; i--)
            {
                double dChangeMin = double.Parse(dtProfitNoticeChangeMin.Rows[i]["PROFITNOTICE_CHANGEMIN"].ToString());
                if (dChangeMin > 0.7)
                {
                    dtEarningPositivePreannouncement.Rows[i]["PN_CHANGEMIN"] = dChangeMin;
                }
                else
                {
                    dtEarningPositivePreannouncement.Rows[i].Delete();
                }
            }
        }