Пример #1
0
        public static WindData windNetProfitBelongToParComSH(String strWindCode, DateTime dtReportDate)
        {
            WindData wd = ConnWindData.fetchTimeSeriesSecInfo(strWindCode, "np_belongto_parcomsh", dtReportDate, dtReportDate, "rptType=1");

            ConnWind.windEnsureNoErr(wd);
            return(wd);
        }
Пример #2
0
        /// <summary>
        /// 预告净利润同比增长下限
        /// </summary>
        /// <param name="strWindCode"></param>
        /// <param name="dtReportDate"></param>
        public static WindData windProfitNoticeChangeMin(String strWindCode, DateTime dtReportDate)
        {
            WindData wd = ConnWindData.fetchTimeSeriesSecInfo(strWindCode, "profitnotice_changemin", dtReportDate, dtReportDate);

            ConnWind.windEnsureNoErr(wd);
            return(wd);
        }
Пример #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            WindData  wd          = ConnWindData.fetchSectorConstituent(DateTime.Now, "全部A股");
            DataTable dtStock     = ConnWindData.convertWindDatatoTable(wd);
            String    strWindCode = Utilities.UtilityTable.getCodeStringFromDataTableCol(dtStock, 1);

            Strategy.EarningPositivePreannouncement.PreannouncementConditionFilter(dtStock, new DateTime(2016, 6, 30));
        }
Пример #4
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());
        }
Пример #5
0
        private void fetchShenWanIndex(string strIndexName)
        {
            WindData wd = ConnWindData.fetchSectorConstituent(DateTime.Now, "申银万国一级行业指数");

            dtIndustryIndex = ConnWindData.convertWindDatatoTable(wd);
        }
Пример #6
0
        private void plotIndexPriceSeries(Chart chartPlot)
        {
            string strBenchmark = "000300.SH";

            WindData  wd          = ConnWindData.fetchTimeSeriesSecInfo(strSelectedWindCode, "close", dateTimePicker1.Value.AddMonths(-3), dateTimePicker1.Value);
            DataTable dtIndex     = ConnWindData.convertWindDatatoTable(wd);
            DataTable dtBenchmark = ConnWindData.convertWindDatatoTable(
                ConnWindData.fetchTimeSeriesSecInfo(strBenchmark, "close", dateTimePicker1.Value.AddMonths(-3), dateTimePicker1.Value));

            DataTable dtMixTable = new DataTable("Mix Data Table");

            dtMixTable.Columns.Add("DateTime", typeof(DateTime));
            dtMixTable.Columns.Add("Index", typeof(Double));
            dtMixTable.Columns.Add("Benchmark", typeof(double));

            for (int i = 0; i < dtBenchmark.Rows.Count; i++)
            {
                DataRow dr = dtMixTable.NewRow();
                dr["DateTime"]  = wd.timeList[i];
                dr["Index"]     = dtIndex.Rows[i]["CLOSE"];
                dr["Benchmark"] = dtBenchmark.Rows[i]["CLOSE"];
                dtMixTable.Rows.Add(dr);
            }

            DataView dv = dtMixTable.DefaultView;

            dv.Sort = "Index";
            double dMinimal = (double)dtMixTable.Rows[0]["Index"];

            dv.Sort = "Benchmark";
            double dMinimalBenchmark = (double)dtMixTable.Rows[0]["Benchmark"];

            chartPlot.ChartAreas[0].AxisY.Minimum            = dMinimal * 0.95;
            chartPlot.ChartAreas[0].AxisY2.Minimum           = dMinimalBenchmark * 0.95;
            chartPlot.ChartAreas[0].AxisY.LabelStyle.Format  = "N1";
            chartPlot.ChartAreas[0].AxisY2.LabelStyle.Format = "N1";
            chartPlot.ChartAreas[0].AxisY.LabelAutoFitStyle  = LabelAutoFitStyles.DecreaseFont;
            chartPlot.ChartAreas[0].AxisY2.LabelAutoFitStyle = LabelAutoFitStyles.DecreaseFont;
            chartPlot.ChartAreas[0].AxisX.LabelAutoFitStyle  = LabelAutoFitStyles.DecreaseFont;

            chartPlot.ChartAreas[0].AxisY.MajorGrid.Enabled  = false;
            chartPlot.ChartAreas[0].AxisY2.MajorGrid.Enabled = false;
            chartPlot.ChartAreas[0].AxisX.MajorGrid.Enabled  = false;
            chartPlot.ChartAreas[0].AxisX2.MajorGrid.Enabled = false;
            chartPlot.Legends[0].Docking = Docking.Right;

            chartPlot.Titles.Clear();
            chartPlot.Titles.Add(strSelectIndexName + "vs 沪深300 近三个月走势");
            chartPlot.DataSource = dtMixTable;
            chartPlot.Series.Clear();

            Series SeriesIndex = chartPlot.Series.Add("Industry Close Price");

            SeriesIndex.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;

            SeriesIndex.MarkerStyle = MarkerStyle.Circle;
            SeriesIndex.MarkerSize  = 5;

            SeriesIndex.XValueMember  = "DateTime";
            SeriesIndex.YValueMembers = "Index";

            SeriesIndex.ToolTip = strSelectedWindCode + "\r\n收盘价: #VAL\r\n日期: #VALX";

            Series SeriesBenchmark = chartPlot.Series.Add("BenchMark Close Price");

            SeriesBenchmark.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;

            SeriesBenchmark.YAxisType = AxisType.Secondary;

            SeriesBenchmark.MarkerStyle = MarkerStyle.Circle;
            SeriesBenchmark.MarkerSize  = 5;

            SeriesBenchmark.XValueMember  = "DateTime";
            SeriesBenchmark.YValueMembers = "Benchmark";

            SeriesBenchmark.ToolTip = strBenchmark + "\r\n收盘价: #VAL\r\n日期: #VALX";
        }
Пример #7
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();
                }
            }
        }