Ejemplo n.º 1
0
        public void DeleteData(string dateFrom, string dateTo, out bool hasData)
        {
            string sql = "select top 1 * from ("
                         + " select top 30 the_date from AISTOCK_CALENDAR "
                         + " where the_date <= '" + dateTo + "' and the_date > '" + dateFrom + "' and fiscal_period = 1"
                         + " order by the_date desc) a order by a.the_date ";
            string date = this.GetScalar(sql).ToString();

            date = DateTimeFunction.ConvertDate(DateTime.Parse(date).ToShortDateString());
            sql  = "select count(0) from AISTOCK_STOCK_INFORMATION where STOCK_DAY < '" + date + "'";
            int count = int.Parse(this.GetScalar(sql).ToString());

            if (count > 0)
            {
                sql = "delete from AISTOCK_STOCK_INFORMATION where STOCK_DAY < '" + date + "'";
                this.ExecuteNonQuerySql(sql);
                sql = "delete from AISTOCK_STOCK_AVG_PRICE where STOCK_DAY < '" + date + "'";
                this.ExecuteNonQuerySql(sql);
                hasData = true;
            }
            else
            {
                hasData = false;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 买入股票历史数据
        /// </summary>
        /// <param name="data"></param>
        /// <param name="qc"></param>
        public void LoadBuyHistoryData(DataTable data, StockQueryCondition qc)
        {
            string stockCode  = qc.StockCode;
            string stockName  = qc.StockName;
            string type       = qc.BuyPoint;
            string dateFrom   = DateTimeFunction.ConvertDate(qc.DatePickerFrom);
            string dateTo     = DateTimeFunction.ConvertDate(qc.DatePickerTo);
            string dateSearch = DateTimeFunction.ConvertDate(qc.DatePickerSearch);

            string sql = "select ta.stock_code,ta.stock_name,ta.stock_type,ta.stock_day as search_day,tb.stock_day,"
                         + " tb.today_begin,tb.today_end,tb.max_price,tb.min_price,tb.increase_percent from"
                         + " (select * from aistock_stock_buy_stats b"
                         + " where b.stock_day = '" + dateSearch + "'";

            if (!string.IsNullOrEmpty(type))
            {
                sql += " and b.stock_type = '" + type + "'";
            }

            sql += " ) ta,"
                   + " (select * from aistock_stock_information a"
                   + " where a.stock_day >= '" + dateFrom + "' and a.stock_day <= '" + dateTo + "') tb"
                   + " where ta.stock_code = tb.stock_code";
            if (!string.IsNullOrEmpty(stockCode))
            {
                sql += " and ta.stock_code = '" + stockCode + "'";
            }
            if (!string.IsNullOrEmpty(stockName))
            {
                sql += " and ta.stock_name = '" + stockName + "'";
            }
            sql += " order by ta.stock_code, ta.stock_type, tb.stock_day desc";
            this.AutoFill(data, sql);
        }
Ejemplo n.º 3
0
        private void Refresh()
        {
            string date = DateTimeFunction.ConvertDate(this.DatePickerImportDate.DateTime);
            AISTOCK_STOCK_AVG_PRICE_DATA data = new StockSystem().GetStockAvgData(date);

            this.BmBlafTableStock.Clear();
            this.DrawBmTableHeader();
            this.DrawBmTableBody(data);
        }
Ejemplo n.º 4
0
        private void DeleteExistsData()
        {
            string date   = DateTimeFunction.ConvertDate(this.DatePickerImportDate.DateTime);
            bool   exists = new StockSystem().IsExistsData(date);

            if (exists)
            {
                new StockSystem().DeleteAvgData(date);
            }
        }
Ejemplo n.º 5
0
        private void Refresh()
        {
            StockQueryCondition qc = new StockQueryCondition();

            qc.DeserializeFromString(this.ViewState["_StockQueryCondition"].ToString());
            this.labPrompt.Text = "";
            //查询日前两天
            string dateTo2 = new StockSystem().GetIndexDay(qc.DatePickerFrom, 2);

            dateTo2 = DateTimeFunction.ConvertDate(DateTime.Parse(dateTo2).ToShortDateString());
            string date2RSI6 = new StockSystem().GetIndexDay(qc.DatePickerFrom, 8);

            date2RSI6 = DateTimeFunction.ConvertDate(DateTime.Parse(date2RSI6).ToShortDateString());
            string date2RSI12 = new StockSystem().GetIndexDay(qc.DatePickerFrom, 14);

            date2RSI12 = DateTimeFunction.ConvertDate(DateTime.Parse(date2RSI12).ToShortDateString());
            //string date2RSI24 = new StockSystem().GetIndexDay(qc.DatePickerFrom, 26);
            //date2RSI24 = DateTimeFunction.ConvertDate(DateTime.Parse(date2RSI24).ToShortDateString());

            //查询日
            string dateTo   = DateTimeFunction.ConvertDate(qc.DatePickerFrom);
            string dateRSI6 = new StockSystem().GetIndexDay(qc.DatePickerFrom, 6);

            dateRSI6 = DateTimeFunction.ConvertDate(DateTime.Parse(dateRSI6).ToShortDateString());
            string dateRSI12 = new StockSystem().GetIndexDay(qc.DatePickerFrom, 12);

            dateRSI12 = DateTimeFunction.ConvertDate(DateTime.Parse(dateRSI12).ToShortDateString());
            //string dateRSI24 = new StockSystem().GetIndexDay(qc.DatePickerFrom, 24);
            //dateRSI24 = DateTimeFunction.ConvertDate(DateTime.Parse(dateRSI24).ToShortDateString());

            AISTOCK_STOCK_STATS_DATA stockData = new StockSystem().GetStockData(dateTo2, txtStockCode.Text.Trim());
            string today = DateTimeFunction.ConvertDate(DateTime.Now.ToShortDateString());

            today = new StockSystem().GetToday(today);
            bool flag = false;

            if (int.Parse(dateTo) < int.Parse(today))
            {
                flag = true;
            }

            AISTOCK_STOCK_INDEX_V_DATA data2RSI6 = new AISTOCK_STOCK_INDEX_V_DATA();

            data2RSI6 = new StockSystem().GetStockDataIndex(date2RSI6, dateTo2, txtStockCode.Text.Trim());

            this.BmBlafTable.Clear();
            DrawRsiTableHeader();
            DrawRsiTableBody(data2RSI6, stockData, txtStockCode.Text.Trim(), flag, today, dateTo2, date2RSI12, dateTo, dateRSI6, dateRSI12);
        }
Ejemplo n.º 6
0
        private void Refresh()
        {
            StockQueryCondition qc = new StockQueryCondition();

            qc.DeserializeFromString(this.ViewState["_StockQueryCondition"].ToString());

            string date = DateTimeFunction.ConvertDate(qc.DatePickerFrom);

            AISTOCK_STATS_PERCENT_V_DATA data = new StockSystem().GetStockStatsVData(date);
            DataTable leader = new StockSystem().GetLeaderStock(date);

            this.BmBlafTable.Clear();
            DrawTableHeader();
            DrawTableBody(data, leader);
            this.RestoreQueryCondition();
        }
Ejemplo n.º 7
0
        public void LoadStockAvgHistory(DataTable data, StockQueryCondition qc)
        {
            string stockCode = qc.StockCode;
            string stockName = qc.StockName;
            string dateFrom  = DateTimeFunction.ConvertDate(qc.DatePickerFrom);
            string dateTo    = DateTimeFunction.ConvertDate(qc.DatePickerTo);
            string sql       = "SELECT * FROM AISTOCK_STOCK_AVG_PRICE WHERE STOCK_DAY <= '" + dateTo + "' AND STOCK_DAY >= '" + dateFrom + "'";

            if (!string.IsNullOrEmpty(stockCode))
            {
                sql += " AND STOCK_CODE LIKE '%" + stockCode + "%'";
            }
            if (!string.IsNullOrEmpty(stockName))
            {
                sql += " AND STOCK_NAME LIKE '%" + stockName + "%'";
            }
            sql += " ORDER BY STOCK_CODE";
            this.AutoFill(data, sql);
        }
Ejemplo n.º 8
0
        public void LoadStockHistory(DataTable data, StockQueryCondition qc)
        {
            string stockCode = qc.StockCode;
            string stockName = qc.StockName;
            string market    = qc.Market;
            string field     = qc.Field;
            string chart     = qc.Chart;
            string province  = qc.Province;
            string dateFrom  = DateTimeFunction.ConvertDate(qc.DatePickerFrom);
            string dateTo    = DateTimeFunction.ConvertDate(qc.DatePickerTo);
            string sql       = "SELECT * FROM AISTOCK_STOCK_DAILY_DATA_V WHERE STOCK_DAY >= '" + dateFrom + "' AND STOCK_DAY <= '" + dateTo + "'";

            if (!string.IsNullOrEmpty(stockCode))
            {
                sql += " AND STOCK_CODE LIKE '%" + stockCode + "%'";
            }
            if (!string.IsNullOrEmpty(stockName))
            {
                sql += " AND STOCK_NAME LIKE '%" + stockName + "%'";
            }
            if (!string.IsNullOrEmpty(market))
            {
                sql += " AND STOCK_ADDR = '" + market + "'";
            }
            if (!string.IsNullOrEmpty(field))
            {
                sql += " AND FIELD = '" + field + "'";
            }
            if (!string.IsNullOrEmpty(province))
            {
                sql += " AND PROVINCE = '" + province + "'";
            }
            if (!string.IsNullOrEmpty(chart))
            {
                sql += " AND CHART = '" + chart + "'";
            }
            sql += " ORDER BY STOCK_CODE";
            this.AutoFill(data, sql);
        }
Ejemplo n.º 9
0
        private void CalculateAvgPriceData()
        {
            AISTOCK_STOCK_AVG_PRICE_DATA data = new AISTOCK_STOCK_AVG_PRICE_DATA();
            //List<Stock> stocks = new ParseStock().ParseStockXml();
            AISTOCK_STOCK_IMPORT_DATA stocks = new StockSystem().GetStockImport();
            string  stockCode = string.Empty;
            string  date      = DateTimeFunction.ConvertDate(this.DatePickerImportDate.DateTime);
            decimal fiveAvg   = 0;
            decimal tenAvg    = 0;
            decimal twentyAvg = 0;
            decimal thirtyAvg = 0;
            decimal sixtyAvg  = 0;

            foreach (var item in stocks.AISTOCK_STOCK_IMPORT)
            {
                AISTOCK_STOCK_AVG_PRICE_DATA.AISTOCK_STOCK_AVG_PRICERow row = data.AISTOCK_STOCK_AVG_PRICE.NewAISTOCK_STOCK_AVG_PRICERow();
                Guid stock_id = Guid.NewGuid();
                stockCode = item.STOCK_CODE;
                fiveAvg   = new StockSystem().GetAvgPrice(stockCode, date, 5);
                tenAvg    = new StockSystem().GetAvgPrice(stockCode, date, 10);
                twentyAvg = new StockSystem().GetAvgPrice(stockCode, date, 20);
                thirtyAvg = new StockSystem().GetAvgPrice(stockCode, date, 30);
                sixtyAvg  = new StockSystem().GetAvgPrice(stockCode, date, 60);

                row.STOCK_AVG_ID = stock_id.ToString();
                row.STOCK_CODE   = stockCode;
                row.STOCK_NAME   = item.STOCK_NAME;
                row.STOCK_DAY    = date;
                row.FIVE_AVG     = fiveAvg;
                row.TEN_AVG      = tenAvg;
                row.TWENTY_AVG   = twentyAvg;
                row.THIRTY_AVG   = thirtyAvg;
                row.SIXTY_AVG    = sixtyAvg;

                data.AISTOCK_STOCK_AVG_PRICE.Rows.Add(row);
            }
            new StockSystem().InsertAvgPrice(data);
        }
Ejemplo n.º 10
0
        private void DrawRsiTableBody(AISTOCK_STOCK_INDEX_V_DATA dataRSI, AISTOCK_STOCK_STATS_DATA stockData, string code, bool isToday, string today, string date, int indexDay)
        {
            int sh = 0, sz = 0, zx = 0, bj = 0;

            if (dataRSI == null)
            {
                return;
            }
            if (dataRSI.AISTOCK_STOCK_INDEX_V.Count <= 0)
            {
                return;
            }
            TableRow bodyRow;

            for (int i = 0; i < stockData.AISTOCK_STOCK_INFORMATION.Rows.Count; i++)
            {
                decimal sumA   = 0;
                decimal sumB   = 0;
                decimal index  = 0;
                decimal sumAB  = 0;
                decimal sumBB  = 0;
                decimal indexB = 0;
                AISTOCK_STOCK_STATS_DATA.AISTOCK_STOCK_INFORMATIONRow stockRow = ((AISTOCK_STOCK_STATS_DATA.AISTOCK_STOCK_INFORMATIONRow)stockData.AISTOCK_STOCK_INFORMATION.Rows[i]);
                string stockCode = stockRow.STOCK_CODE.ToString();
                if (stockCode.ToLower().StartsWith("sz300") && string.IsNullOrEmpty(txtStockCode.Text))
                {
                    continue;
                }
                DataRow[] rows = dataRSI.AISTOCK_STOCK_INDEX_V.Select("STOCK_CODE = '" + stockCode + "'");
                if (rows.Length <= 0)
                {
                    continue;
                }
                for (int j = 0; j < rows.Length; j++)
                {
                    AISTOCK_STOCK_INDEX_V_DATA.AISTOCK_STOCK_INDEX_VRow row = (AISTOCK_STOCK_INDEX_V_DATA.AISTOCK_STOCK_INDEX_VRow)rows[j];
                    if (row.DIFF > 0)
                    {
                        sumA += row.DIFF;
                    }
                    else
                    {
                        sumB += row.DIFF;
                    }
                }
                if (sumA - sumB != 0)
                {
                    index = sumA / (sumA - sumB) * 100;
                }
                if ((index > 80 || index < 75) && string.IsNullOrEmpty(txtStockCode.Text))
                {
                    continue;
                }
                //计算昨天的指标是否也在75-80之间,不是则抛弃
                #region [开始计算]
                string dateTo = new StockSystem().GetIndexDay(date, 1);
                dateTo = DateTimeFunction.ConvertDate(DateTime.Parse(dateTo).ToShortDateString());
                string dateFrom = new StockSystem().GetIndexDay(date, indexDay + 1);
                dateFrom = DateTimeFunction.ConvertDate(DateTime.Parse(dateFrom).ToShortDateString());

                AISTOCK_STOCK_INDEX_V_DATA dataRSIB = new StockSystem().GetStockDataIndex(dateFrom, dateTo, stockCode);
                DataRow[] rowRSIB = dataRSIB.AISTOCK_STOCK_INDEX_V.Select("STOCK_CODE = '" + stockCode + "'");
                if (rowRSIB.Length <= 0)
                {
                    continue;
                }
                for (int j = 0; j < rowRSIB.Length; j++)
                {
                    AISTOCK_STOCK_INDEX_V_DATA.AISTOCK_STOCK_INDEX_VRow row = (AISTOCK_STOCK_INDEX_V_DATA.AISTOCK_STOCK_INDEX_VRow)rowRSIB[j];
                    if (row.DIFF > 0)
                    {
                        sumAB += row.DIFF;
                    }
                    else
                    {
                        sumBB += row.DIFF;
                    }
                }
                if (sumAB - sumBB != 0)
                {
                    indexB = sumAB / (sumAB - sumBB) * 100;
                }
                if ((indexB > 80 || indexB < 75) && string.IsNullOrEmpty(txtStockCode.Text))
                {
                    continue;
                }
                #endregion [结束计算]

                bodyRow = this.BmBlafTable.AddBodyRow();
                if (stockRow.STOCK_CODE.Contains("sh600"))
                {
                    sh++;
                }
                else if (stockRow.STOCK_CODE.Contains("sz000"))
                {
                    sz++;
                }
                else if (stockRow.STOCK_CODE.Contains("sz002"))
                {
                    zx++;
                }
                else if (stockRow.STOCK_CODE.Contains("sh601") || stockRow.STOCK_CODE.Contains("sh603"))
                {
                    bj++;
                }


                this.BmBlafTable.AddCell(bodyRow, url.Replace("stockcode", stockRow.STOCK_CODE), HorizontalAlign.Left);
                this.BmBlafTable.AddCell(bodyRow, stockRow.STOCK_NAME, HorizontalAlign.Left);
                this.BmBlafTable.AddCell(bodyRow, index.ToString("0.00"), HorizontalAlign.Left);
                this.BmBlafTable.AddCell(bodyRow, indexB.ToString("0.00"), HorizontalAlign.Left);
                this.BmBlafTable.AddCell(bodyRow, stockRow.IsTODAY_BEGINNull() ? string.Empty : stockRow.TODAY_BEGIN.ToString(), HorizontalAlign.Left);
                this.BmBlafTable.AddCell(bodyRow, stockRow.IsYESTERDAY_ENDNull() ? string.Empty : stockRow.YESTERDAY_END.ToString(), HorizontalAlign.Left);
                this.BmBlafTable.AddCell(bodyRow, stockRow.IsTODAY_ENDNull() ? string.Empty : stockRow.TODAY_END.ToString(), HorizontalAlign.Left);
                this.BmBlafTable.AddCell(bodyRow, stockRow.IsINCREASE_PERCENTNull() ? string.Empty : stockRow.INCREASE_PERCENT.ToString(), HorizontalAlign.Left);
                this.BmBlafTable.AddCell(bodyRow, stockRow.IsCHARTNull() ? string.Empty : stockRow.CHART.ToString(), HorizontalAlign.Left);

                #region [取当天数据]

                if (isToday)
                {
                    AISTOCK_STOCK_STATS_DATA todayData = new StockSystem().GetStockDataJingQue(today, stockCode);
                    AISTOCK_STOCK_STATS_DATA.AISTOCK_STOCK_INFORMATIONRow todayRow = ((AISTOCK_STOCK_STATS_DATA.AISTOCK_STOCK_INFORMATIONRow)todayData.AISTOCK_STOCK_INFORMATION.Rows[0]);
                    this.BmBlafTable.AddCell(bodyRow, todayRow.IsTODAY_BEGINNull() ? string.Empty : todayRow.TODAY_BEGIN.ToString(), HorizontalAlign.Left);
                    this.BmBlafTable.AddCell(bodyRow, todayRow.IsTODAY_ENDNull() ? string.Empty : todayRow.TODAY_END.ToString(), HorizontalAlign.Left);
                    this.BmBlafTable.AddCell(bodyRow, todayRow.IsINCREASE_PERCENTNull() ? string.Empty : todayRow.INCREASE_PERCENT.ToString(), HorizontalAlign.Left);
                    decimal relativePercent = 0;
                    if (stockRow.TODAY_END > 0)
                    {
                        relativePercent = (todayRow.TODAY_END - stockRow.TODAY_END) / stockRow.TODAY_END * 100;
                    }

                    this.BmBlafTable.AddCell(bodyRow, relativePercent.ToString("0.0000"), HorizontalAlign.Left);
                }
                else
                {
                    this.BmBlafTable.AddCell(bodyRow, "", HorizontalAlign.Left);
                    this.BmBlafTable.AddCell(bodyRow, "", HorizontalAlign.Left);
                    this.BmBlafTable.AddCell(bodyRow, "", HorizontalAlign.Left);
                    this.BmBlafTable.AddCell(bodyRow, "", HorizontalAlign.Left);
                }

                #endregion
            }
            int sum = sh + sz + zx + bj;
            this.labPrompt.Text = "渐强状态:共" + sum + "支,其中上市" + sh + "支,深市" + sz + "支,中小板" + zx + ",北京" + bj + "支<br/>";
        }
Ejemplo n.º 11
0
        private void ScannerBigPan()
        {
            string today = new StockSystem().GetIndexDay(DateTime.Now.ToString("yyyy-MM-dd"), 1);

            today = DateTimeFunction.ConvertDate(DateTime.Parse(today).ToString("yyyy-MM-dd"));
            WriteLog("today:" + today);
            AISTOCK_STOCK_COMMAND_DATA data = new StockSystem().GetRSIData(today);

            WriteLog("total today:" + data.AISTOCK_STOCK_COMMAND.Count);
            string       stockCode;
            Stream       stockData;
            StreamReader reader;
            string       returnData;

            string[]  tradeData;
            int       start;
            int       end;
            decimal   todayBegin;
            decimal   yesterdayEnd;
            decimal   current;
            decimal   max;
            decimal   min;
            WebClient client = new WebClient();

            client.Headers.Add("Content-Type", "text/html; charset=gb2312");
            StringBuilder sb = new StringBuilder();

            foreach (var item in data.AISTOCK_STOCK_COMMAND)
            {
                stockCode  = item.STOCK_CODE;
                stockData  = client.OpenRead("http://hq.sinajs.cn/list=" + stockCode);
                reader     = new StreamReader(stockData, System.Text.Encoding.GetEncoding("gb2312"));
                returnData = reader.ReadToEnd();
                start      = returnData.IndexOf('"');
                end        = returnData.LastIndexOf('"');
                returnData = returnData.Substring(start + 1, end - start - 1);
                tradeData  = returnData.Split(',');
                if (tradeData.Length == 33)
                {
                    todayBegin = decimal.Parse(tradeData[1].ToString());
                    if (todayBegin == 0)
                    {
                        continue;
                    }
                    yesterdayEnd = decimal.Parse(tradeData[2].ToString());
                    current      = decimal.Parse(tradeData[3].ToString());
                    max          = decimal.Parse(tradeData[4].ToString());
                    min          = decimal.Parse(tradeData[5].ToString());
                    sb.Append("@" + stockCode + "@");
                    if (todayBegin < yesterdayEnd)
                    {
                        //低开
                        if (current < todayBegin)
                        {
                            sb.Append("低开低走");
                        }
                        else if (current > yesterdayEnd)
                        {
                            sb.Append("低开高走");
                        }
                        else if (current > todayBegin)
                        {
                            sb.Append("有上升迹象,可操作");
                        }
                    }
                    else
                    {
                        if (current > todayBegin)
                        {
                            sb.Append("高开高走");
                        }
                        else if (current < yesterdayEnd)
                        {
                            sb.Append("高开低走,观望等下午看看");
                        }
                    }
                    sb.Append("\n");
                }
            }
            if (!string.IsNullOrEmpty(sb.ToString()))
            {
                SendEmail("听老大的话", sb.ToString());
            }
        }
Ejemplo n.º 12
0
        private void Refresh()
        {
            StockQueryCondition qc = new StockQueryCondition();

            qc.DeserializeFromString(this.ViewState["_StockQueryCondition"].ToString());

            AISTOCK_STOCK_BASEINFO_DATA baseData = new StockSystem().GetStockBaseInfoWithoutCondition();

            int indexDay = 5;

            if (qc.BuyPoint.Equals("低档五连阳"))
            {
                indexDay = 4;
            }
            else if (qc.BuyPoint.Equals("双针探底") || qc.BuyPoint.Equals("锤子线探底"))
            {
                indexDay = 1;
            }
            else if (qc.BuyPoint.Equals("十字星探底"))
            {
                indexDay = 3;
            }
            else if (qc.BuyPoint.Equals("早晨之星"))
            {
                indexDay = 2;
            }

            string dateTo = DateTimeFunction.ConvertDate(qc.DatePickerFrom);
            string date   = new StockSystem().GetIndexDay(qc.DatePickerFrom, indexDay);

            date = DateTimeFunction.ConvertDate(DateTime.Parse(date).ToShortDateString());

            if (qc.BuyPoint.Equals("低档五连阳"))
            {
                AISTOCK_STOCK_LOW_FIVE_V_DATA data = new StockSystem().GetLowFiveData(date, dateTo);
                this.BmBlafTable.Clear();
                DrawLowFiveTableHeader();
                DrawLowFiveTableBody(data, baseData);
            }
            else if (qc.BuyPoint.Equals("双针探底"))
            {
                AISTOCK_STOCK_TWO_PIN_V_DATA data = new StockSystem().GetTwoPinData(date, dateTo);
                this.BmBlafTable.Clear();
                DrawTwoPinTableHeader();
                DrawTwoPinTableBody(data);
            }
            else if (qc.BuyPoint.Equals("十字星探底"))
            {
                AISTOCK_STOCK_SINGLE_PIN_V_DATA data = new StockSystem().GetSinglePinData(date, dateTo);
                this.BmBlafTable.Clear();
                DrawSinglePinTableHeader();
                DrawSinglePinTableBody(data);
            }
            else if (qc.BuyPoint.Equals("锤子线探底"))
            {
                AISTOCK_STOCK_HAMMER_V_DATA data = new StockSystem().GetHammerData(date, dateTo);
                this.BmBlafTable.Clear();
                DrawHammerHeader();
                DrawHammerTableBody(data);
            }
            else if (qc.BuyPoint.Equals("早晨之星"))
            {
                string twoDate = new StockSystem().GetIndexDay(qc.DatePickerFrom, 1);
                twoDate = DateTimeFunction.ConvertDate(DateTime.Parse(twoDate).ToShortDateString());
                AISTOCK_STOCK_MORNING_STAR_V_DATA data = new StockSystem().GetMorningStarData(date, twoDate, dateTo);
                this.BmBlafTable.Clear();
                DrawMorningStarHeader();
                DrawMorningStarTableBody(data);
            }
        }
Ejemplo n.º 13
0
        private void Stats()
        {
            StockQueryCondition qc = new StockQueryCondition();

            qc.DeserializeFromString(this.ViewState["_StockQueryCondition"].ToString());

            AISTOCK_FIELD_DOMAIN_VALUE_DATA buy = new StockSystem().GetDropDownList("buy");
            int indexDay = 5;

            string dateTo = DateTimeFunction.ConvertDate(qc.DatePickerFrom);
            string date   = string.Empty;

            AISTOCK_STOCK_BUY_STATS_DATA stats    = new AISTOCK_STOCK_BUY_STATS_DATA();
            AISTOCK_STOCK_BASEINFO_DATA  baseData = new StockSystem().GetStockBaseInfoWithoutCondition();

            foreach (AISTOCK_FIELD_DOMAIN_VALUE_DATA.AISTOCK_FIELD_DOMAIN_VALUERow row in buy.AISTOCK_FIELD_DOMAIN_VALUE.Rows)
            {
                string value = row.FIELD_DOMAIN_VALUE;
                if (value.Equals("低档五连阳"))
                {
                    indexDay = 4;
                    date     = new StockSystem().GetIndexDay(qc.DatePickerFrom, indexDay);
                    date     = DateTimeFunction.ConvertDate(DateTime.Parse(date).ToShortDateString());

                    AISTOCK_STOCK_LOW_FIVE_V_DATA data = new StockSystem().GetLowFiveData(date, dateTo);
                    foreach (AISTOCK_STOCK_LOW_FIVE_V_DATA.AISTOCK_STOCK_LOW_FIVE_VRow dataRow in data.AISTOCK_STOCK_LOW_FIVE_V.Rows)
                    {
                        AISTOCK_STOCK_BUY_STATS_DATA.AISTOCK_STOCK_BUY_STATSRow saveRow = stats.AISTOCK_STOCK_BUY_STATS.NewAISTOCK_STOCK_BUY_STATSRow();
                        Guid id = Guid.NewGuid();
                        saveRow.STOCK_BUY_ID = id.ToString().ToUpper();
                        saveRow.STOCK_CODE   = dataRow.STOCK_CODE;
                        DataRow[] tmpRow = baseData.AISTOCK_STOCK_BASEINFO.Select("STOCK_CODE = '" + dataRow.STOCK_CODE + "'");
                        saveRow.STOCK_NAME = ((AISTOCK_STOCK_BASEINFO_DATA.AISTOCK_STOCK_BASEINFORow)tmpRow[0]).STOCK_NAME;
                        saveRow.STOCK_TYPE = "低档五连阳";
                        saveRow.STOCK_DAY  = dateTo;
                        stats.AISTOCK_STOCK_BUY_STATS.AddAISTOCK_STOCK_BUY_STATSRow(saveRow);
                    }
                }
                else if (value.Equals("双针探底"))
                {
                    indexDay = 1;
                    date     = new StockSystem().GetIndexDay(qc.DatePickerFrom, indexDay);
                    date     = DateTimeFunction.ConvertDate(DateTime.Parse(date).ToShortDateString());

                    AISTOCK_STOCK_TWO_PIN_V_DATA data = new StockSystem().GetTwoPinData(date, dateTo);
                    foreach (AISTOCK_STOCK_TWO_PIN_V_DATA.AISTOCK_STOCK_TWO_PIN_VRow dataRow in data.AISTOCK_STOCK_TWO_PIN_V.Rows)
                    {
                        AISTOCK_STOCK_BUY_STATS_DATA.AISTOCK_STOCK_BUY_STATSRow saveRow = stats.AISTOCK_STOCK_BUY_STATS.NewAISTOCK_STOCK_BUY_STATSRow();
                        Guid id = Guid.NewGuid();
                        saveRow.STOCK_BUY_ID = id.ToString().ToUpper();
                        saveRow.STOCK_CODE   = dataRow.STOCK_CODE;
                        saveRow.STOCK_NAME   = dataRow.STOCK_NAME;
                        saveRow.STOCK_TYPE   = "双针探底";
                        saveRow.STOCK_DAY    = dateTo;
                        stats.AISTOCK_STOCK_BUY_STATS.AddAISTOCK_STOCK_BUY_STATSRow(saveRow);
                    }
                }
                else if (value.Equals("十字星探底"))
                {
                    indexDay = 3;
                    date     = new StockSystem().GetIndexDay(qc.DatePickerFrom, indexDay);
                    date     = DateTimeFunction.ConvertDate(DateTime.Parse(date).ToShortDateString());

                    AISTOCK_STOCK_SINGLE_PIN_V_DATA data = new StockSystem().GetSinglePinData(date, dateTo);
                    foreach (AISTOCK_STOCK_SINGLE_PIN_V_DATA.AISTOCK_STOCK_SINGLE_PIN_VRow dataRow in data.AISTOCK_STOCK_SINGLE_PIN_V.Rows)
                    {
                        AISTOCK_STOCK_BUY_STATS_DATA.AISTOCK_STOCK_BUY_STATSRow saveRow = stats.AISTOCK_STOCK_BUY_STATS.NewAISTOCK_STOCK_BUY_STATSRow();
                        Guid id = Guid.NewGuid();
                        saveRow.STOCK_BUY_ID = id.ToString().ToUpper();
                        saveRow.STOCK_CODE   = dataRow.STOCK_CODE;
                        saveRow.STOCK_NAME   = dataRow.STOCK_NAME;
                        saveRow.STOCK_TYPE   = "十字星探底";
                        saveRow.STOCK_DAY    = dateTo;
                        stats.AISTOCK_STOCK_BUY_STATS.AddAISTOCK_STOCK_BUY_STATSRow(saveRow);
                    }
                }
                else if (value.Equals("锤子线探底"))
                {
                    indexDay = 1;
                    date     = new StockSystem().GetIndexDay(qc.DatePickerFrom, indexDay);
                    date     = DateTimeFunction.ConvertDate(DateTime.Parse(date).ToShortDateString());

                    AISTOCK_STOCK_HAMMER_V_DATA data = new StockSystem().GetHammerData(date, dateTo);
                    foreach (AISTOCK_STOCK_HAMMER_V_DATA.AISTOCK_STOCK_HAMMER_VRow dataRow in data.AISTOCK_STOCK_HAMMER_V.Rows)
                    {
                        AISTOCK_STOCK_BUY_STATS_DATA.AISTOCK_STOCK_BUY_STATSRow saveRow = stats.AISTOCK_STOCK_BUY_STATS.NewAISTOCK_STOCK_BUY_STATSRow();
                        Guid id = Guid.NewGuid();
                        saveRow.STOCK_BUY_ID = id.ToString().ToUpper();
                        saveRow.STOCK_CODE   = dataRow.STOCK_CODE;
                        saveRow.STOCK_NAME   = dataRow.STOCK_NAME;
                        saveRow.STOCK_TYPE   = "锤子线探底";
                        saveRow.STOCK_DAY    = dateTo;
                        stats.AISTOCK_STOCK_BUY_STATS.AddAISTOCK_STOCK_BUY_STATSRow(saveRow);
                    }
                }
                else if (value.Equals("早晨之星"))
                {
                    indexDay = 2;
                    date     = new StockSystem().GetIndexDay(qc.DatePickerFrom, indexDay);
                    date     = DateTimeFunction.ConvertDate(DateTime.Parse(date).ToShortDateString());

                    string twoDate = new StockSystem().GetIndexDay(qc.DatePickerFrom, 1);
                    twoDate = DateTimeFunction.ConvertDate(DateTime.Parse(twoDate).ToShortDateString());
                    AISTOCK_STOCK_MORNING_STAR_V_DATA data = new StockSystem().GetMorningStarData(date, twoDate, dateTo);
                    foreach (AISTOCK_STOCK_MORNING_STAR_V_DATA.AISTOCK_STOCK_MORNING_STAR_VRow dataRow in data.AISTOCK_STOCK_MORNING_STAR_V.Rows)
                    {
                        AISTOCK_STOCK_BUY_STATS_DATA.AISTOCK_STOCK_BUY_STATSRow saveRow = stats.AISTOCK_STOCK_BUY_STATS.NewAISTOCK_STOCK_BUY_STATSRow();
                        Guid id = Guid.NewGuid();
                        saveRow.STOCK_BUY_ID = id.ToString().ToUpper();
                        saveRow.STOCK_CODE   = dataRow.STOCK_CODE;
                        saveRow.STOCK_NAME   = dataRow.STOCK_NAME;
                        saveRow.STOCK_TYPE   = "早晨之星";
                        saveRow.STOCK_DAY    = dateTo;
                        stats.AISTOCK_STOCK_BUY_STATS.AddAISTOCK_STOCK_BUY_STATSRow(saveRow);
                    }
                }
            }
            new StockSystem().SaveStockStatsData(stats);
        }
Ejemplo n.º 14
0
        private void RSIData(string dateTo, string date1)
        {
            int    indexDay = 14;
            string date     = new StockSystem().GetIndexDay(date1, indexDay);

            date = DateTimeFunction.ConvertDate(DateTime.Parse(date).ToShortDateString());
            AISTOCK_STOCK_INDEX_V_DATA dataRSI = new AISTOCK_STOCK_INDEX_V_DATA();

            dataRSI = new StockSystem().GetStockDataIndex(date, dateTo, "");
            AISTOCK_STOCK_STATS_DATA stockData = new StockSystem().GetStockData(dateTo, "");
            AISTOCK_STOCK_WMS_V_DATA dataWms   = new AISTOCK_STOCK_WMS_V_DATA();

            dataWms = new StockSystem().GetStockWmsData(date, dateTo, "");
            if (dataRSI == null)
            {
                return;
            }
            if (dataRSI.AISTOCK_STOCK_INDEX_V.Count <= 0)
            {
                return;
            }
            int           count = 0;
            StringBuilder sb    = new StringBuilder();
            AISTOCK_STOCK_COMMAND_DATA saveData = new AISTOCK_STOCK_COMMAND_DATA();

            for (int i = 0; i < stockData.AISTOCK_STOCK_INFORMATION.Rows.Count; i++)
            {
                decimal sumA  = 0;
                decimal sumB  = 0;
                decimal index = 0;
                AISTOCK_STOCK_STATS_DATA.AISTOCK_STOCK_INFORMATIONRow stockRow = ((AISTOCK_STOCK_STATS_DATA.AISTOCK_STOCK_INFORMATIONRow)stockData.AISTOCK_STOCK_INFORMATION.Rows[i]);
                string    stockCode = stockRow.STOCK_CODE.ToString();
                DataRow[] rows      = dataRSI.AISTOCK_STOCK_INDEX_V.Select("STOCK_CODE = '" + stockCode + "'");
                if (!stockCode.ToLower().StartsWith("sz002"))
                {
                    continue;
                }
                if (rows.Length <= 0)
                {
                    continue;
                }
                for (int j = 0; j < rows.Length; j++)
                {
                    AISTOCK_STOCK_INDEX_V_DATA.AISTOCK_STOCK_INDEX_VRow row = (AISTOCK_STOCK_INDEX_V_DATA.AISTOCK_STOCK_INDEX_VRow)rows[j];
                    if (row.DIFF > 0)
                    {
                        sumA += row.DIFF;
                    }
                    else
                    {
                        sumB += row.DIFF;
                    }
                }
                if (sumA - sumB != 0)
                {
                    index = sumA / (sumA - sumB) * 100;
                }
                if (index == 0 || index > 10)
                {
                    continue;
                }

                //WM Index
                DataRow[] wmrow     = dataWms.AISTOCK_STOCK_WMS_V.Select("STOCK_CODE = '" + stockCode + "'");
                decimal   max_price = 0;
                decimal   min_price = 0;
                decimal   end_price = 0;
                decimal   wmindex   = 0;
                max_price = ((AISTOCK_STOCK_WMS_V_DATA.AISTOCK_STOCK_WMS_VRow)wmrow[0]).MAX_PRICE;
                min_price = ((AISTOCK_STOCK_WMS_V_DATA.AISTOCK_STOCK_WMS_VRow)wmrow[0]).MIN_PRICE;
                end_price = stockRow.TODAY_END;
                if (max_price - min_price != 0)
                {
                    wmindex = (max_price - end_price) / (max_price - min_price) * 100;
                }

                if (wmindex > 0)
                {
                    continue;
                }

                int     quantity = new StockSystem().GetQuantity(stockCode);
                decimal ratio;
                if (quantity == 0)
                {
                    ratio = -1;
                }
                else
                {
                    ratio = (decimal)stockRow.QUANTITY / (decimal)quantity;
                }

                count++;
                AISTOCK_STOCK_COMMAND_DATA.AISTOCK_STOCK_COMMANDRow saveRow = saveData.AISTOCK_STOCK_COMMAND.NewAISTOCK_STOCK_COMMANDRow();
                saveRow.STOCK_ID    = Guid.NewGuid().ToString();
                saveRow.STOCK_CODE  = stockCode;
                saveRow.STOCK_NAME  = stockRow.STOCK_NAME;
                saveRow.STOCK_DAY   = stockRow.STOCK_DAY;
                saveRow.TODAY_BEGIN = stockRow.TODAY_BEGIN;
                saveRow.TODAY_END   = stockRow.TODAY_END;
                saveRow.MAX_PRICE   = stockRow.MAX_PRICE;
                saveRow.MIN_PRICE   = stockRow.MIN_PRICE;
                saveRow.RSI         = index;
                saveRow.WM          = wmindex;
                saveRow.RATIO       = ratio;
                saveData.AISTOCK_STOCK_COMMAND.AddAISTOCK_STOCK_COMMANDRow(saveRow);
                sb.Append("@" + stockCode + "@" + index.ToString("0.00") + "\n");
            }
            if (count > 0)
            {
                new StockSystem().SaveRSIData(saveData);
                SendEmail("敌情资讯", sb.ToString());
            }
        }
Ejemplo n.º 15
0
        private void ImportData()
        {
            string date = DateTimeFunction.ConvertDate(this.DatePickerImportDate.DateTime);
            AISTOCK_STOCK_STATS_DATA data = new AISTOCK_STOCK_STATS_DATA();
            //List<Stock> stocks = new ParseStock().ParseStockXml();
            AISTOCK_STOCK_IMPORT_DATA stocks = new StockSystem().GetStockImport();
            string    stockCode = string.Empty;
            WebClient client    = new WebClient();

            client.Headers.Add("Content-Type", "text/html; charset=gb2312");
            Stream       stockData;
            StreamReader reader;
            string       returnData;
            int          start;
            int          end;

            string[] tradeData;
            string   stockName = string.Empty;
            decimal  todayBegin;
            decimal  yesterdayEnd;
            decimal  current;
            decimal  max;
            decimal  min;
            decimal  buy;
            decimal  sell;
            int      quantity;
            decimal  money;

            decimal[] buyer_price;
            int[]     buyer_quantity;
            decimal[] seller_price;
            int[]     seller_quanlity;

            foreach (var item in stocks.AISTOCK_STOCK_IMPORT)
            {
                AISTOCK_STOCK_STATS_DATA.AISTOCK_STOCK_INFORMATIONRow row = data.AISTOCK_STOCK_INFORMATION.NewAISTOCK_STOCK_INFORMATIONRow();
                stockCode = item.STOCK_CODE.ToString();
                Guid stock_id = Guid.NewGuid();
                buyer_price     = new decimal[5];
                buyer_quantity  = new int[5];
                seller_price    = new decimal[5];
                seller_quanlity = new int[5];
                stockData       = client.OpenRead("http://hq.sinajs.cn/list=" + stockCode);
                reader          = new StreamReader(stockData, System.Text.Encoding.GetEncoding("gb2312"));
                returnData      = reader.ReadToEnd();
                start           = returnData.IndexOf('"');
                end             = returnData.LastIndexOf('"');
                returnData      = returnData.Substring(start + 1, end - start - 1);

                tradeData = returnData.Split(',');
                if (tradeData.Length == 33)
                {
                    stockName          = tradeData[0].ToString();
                    todayBegin         = decimal.Parse(tradeData[1].ToString());
                    yesterdayEnd       = decimal.Parse(tradeData[2].ToString());
                    current            = decimal.Parse(tradeData[3].ToString());
                    max                = decimal.Parse(tradeData[4].ToString());
                    min                = decimal.Parse(tradeData[5].ToString());
                    buy                = decimal.Parse(tradeData[6].ToString());
                    sell               = decimal.Parse(tradeData[7].ToString());
                    quantity           = int.Parse(tradeData[8].ToString());
                    money              = decimal.Parse(tradeData[9].ToString());
                    buyer_quantity[0]  = int.Parse(tradeData[10].ToString());
                    buyer_price[0]     = decimal.Parse(tradeData[11].ToString());
                    buyer_quantity[1]  = int.Parse(tradeData[12].ToString());
                    buyer_price[1]     = decimal.Parse(tradeData[13].ToString());
                    buyer_quantity[2]  = int.Parse(tradeData[14].ToString());
                    buyer_price[2]     = decimal.Parse(tradeData[15].ToString());
                    buyer_quantity[3]  = int.Parse(tradeData[16].ToString());
                    buyer_price[3]     = decimal.Parse(tradeData[17].ToString());
                    buyer_quantity[4]  = int.Parse(tradeData[18].ToString());
                    buyer_price[4]     = decimal.Parse(tradeData[19].ToString());
                    seller_quanlity[0] = int.Parse(tradeData[20].ToString());
                    seller_price[0]    = decimal.Parse(tradeData[21].ToString());
                    seller_quanlity[1] = int.Parse(tradeData[22].ToString());
                    seller_price[1]    = decimal.Parse(tradeData[23].ToString());
                    seller_quanlity[2] = int.Parse(tradeData[24].ToString());
                    seller_price[2]    = decimal.Parse(tradeData[25].ToString());
                    seller_quanlity[3] = int.Parse(tradeData[26].ToString());
                    seller_price[3]    = decimal.Parse(tradeData[27].ToString());
                    seller_quanlity[4] = int.Parse(tradeData[28].ToString());
                    seller_price[4]    = decimal.Parse(tradeData[29].ToString());
                }
                else
                {
                    todayBegin   = 0;
                    yesterdayEnd = 0;
                    current      = 0;
                    max          = 0;
                    min          = 0;
                    buy          = 0;
                    sell         = 0;
                    quantity     = 0;
                    money        = 0;
                    for (int i = 0; i < 5; i++)
                    {
                        buyer_quantity[i]  = 0;
                        buyer_price[i]     = 0;
                        seller_quanlity[i] = 0;
                        seller_price[i]    = 0;
                    }
                }

                reader.Close();
                stockData.Close();

                decimal percent;
                string  chart;
                if (yesterdayEnd > 0)
                {
                    percent = (current - yesterdayEnd) / yesterdayEnd * 100;
                }
                else
                {
                    percent = 0;
                }
                chart = this.GetChart(todayBegin, current, max, min);

                row.STOCK_ID          = stock_id.ToString().ToUpper();
                row.STOCK_CODE        = stockCode;
                row.STOCK_NAME        = stockName;
                row.STOCK_DAY         = date;
                row.TODAY_BEGIN       = todayBegin;
                row.YESTERDAY_END     = yesterdayEnd;
                row.TODAY_END         = current;
                row.MAX_PRICE         = max;
                row.MIN_PRICE         = min;
                row.BUY_PRICE         = buy;
                row.SELL_PRICE        = sell;
                row.QUANTITY          = quantity;
                row.TOTAL_MONEY       = money;
                row.BUY_ONE_QUANTITY  = buyer_quantity[0];
                row.BUY_ONE_PRICE     = buyer_price[0];
                row.BUY_TWO_QUANTITY  = buyer_quantity[1];
                row.BUY_TWO_PRICE     = buyer_price[1];
                row.BUY_THD_QUANTITY  = buyer_quantity[2];
                row.BUY_THD_PRICE     = buyer_price[2];
                row.BUY_FOU_QUANTITY  = buyer_quantity[3];
                row.BUY_FOU_PRICE     = buyer_price[3];
                row.BUY_FIF_QUANTITY  = buyer_quantity[4];
                row.BUY_FIF_PRICE     = buyer_price[4];
                row.SELL_ONE_QUANTITY = seller_quanlity[0];
                row.SELL_ONE_PRICE    = seller_price[0];
                row.SELL_TWO_QUANTITY = seller_quanlity[1];
                row.SELL_TWO_PRICE    = seller_price[1];
                row.SELL_THD_QUANTITY = seller_quanlity[2];
                row.SELL_THD_PRICE    = seller_price[2];
                row.SELL_FOU_QUANTITY = seller_quanlity[3];
                row.SELL_FOU_PRICE    = seller_price[3];
                row.SELL_FIF_QUANTITY = seller_quanlity[4];
                row.SELL_FIF_PRICE    = seller_price[4];
                row.INCREASE_PERCENT  = percent;
                row.CHART             = chart;

                data.AISTOCK_STOCK_INFORMATION.Rows.Add(row);
            }
            new StockSystem().ImportStockData(data);
        }
Ejemplo n.º 16
0
        private void Refresh()
        {
            StockQueryCondition qc = new StockQueryCondition();

            qc.DeserializeFromString(this.ViewState["_StockQueryCondition"].ToString());
            this.labPrompt.Text = "";

            int indexDay = 14;

            if (qc.Index.Equals("RSI(5)"))
            {
                indexDay = 5;
            }
            else if (qc.Index.Equals("RSI(9)"))
            {
                indexDay = 9;
            }
            else if (qc.Index.Equals("RSI(14)") || qc.Index.Equals("ADR(14)"))
            {
                indexDay = 11;
            }
            else if (qc.Index.Equals("WMS(10)") || qc.Index.Equals("ADR(10)"))
            {
                indexDay = 10;
            }
            else if (qc.Index.Equals("WMS(20)"))
            {
                indexDay = 20;
            }

            string dateTo = DateTimeFunction.ConvertDate(qc.DatePickerFrom);

            string date = new StockSystem().GetIndexDay(qc.DatePickerFrom, indexDay);

            date = DateTimeFunction.ConvertDate(DateTime.Parse(date).ToShortDateString());

            AISTOCK_STOCK_STATS_DATA stockData = new StockSystem().GetStockData(dateTo, txtStockCode.Text.Trim());

            if (qc.Index.Equals("RSI(5)") || qc.Index.Equals("RSI(9)") || qc.Index.Equals("RSI(14)"))
            {
                string today = DateTimeFunction.ConvertDate(DateTime.Now.ToShortDateString());
                today = new StockSystem().GetToday(today);
                bool flag = false;
                if (int.Parse(dateTo) < int.Parse(today))
                {
                    flag = true;
                }
                AISTOCK_STOCK_INDEX_V_DATA dataRSI = new AISTOCK_STOCK_INDEX_V_DATA();
                dataRSI = new StockSystem().GetStockDataIndex(date, dateTo, txtStockCode.Text.Trim());

                this.BmBlafTable.Clear();
                DrawRsiTableHeader();
                DrawRsiTableBody(dataRSI, stockData, txtStockCode.Text.Trim(), flag, today, qc.DatePickerFrom, indexDay);
            }
            else if (qc.Index.Equals("WMS(10)") || qc.Index.Equals("WMS(20)"))
            {
                AISTOCK_STOCK_WMS_V_DATA dataWms = new AISTOCK_STOCK_WMS_V_DATA();
                dataWms = new StockSystem().GetStockWmsData(date, dateTo, txtStockCode.Text.Trim());

                this.BmBlafTable.Clear();
                DrawWmsTableHeader();
                DrawWmsTableBody(stockData, dataWms);
            }
            else if (qc.Index.Equals("ADR(10)") || qc.Index.Equals("ADR(14)"))
            {
                AISTOCK_STOCK_ADR_INDEX_V_DATA dataAdr = new AISTOCK_STOCK_ADR_INDEX_V_DATA();
                dataAdr = new StockSystem().GetStockAdrData(date, dateTo, txtStockCode.Text.Trim());

                this.BmBlafTable.Clear();
                DrawAdrTableHeader();
                DrawAdrTableBody(dataAdr);
            }
        }
Ejemplo n.º 17
0
        private void Refresh()
        {
            string dateFrom     = Request.QueryString["datefrom"] == null ? string.Empty : Request.QueryString["datefrom"];
            string market       = Request.QueryString["market"] == null ? string.Empty : Request.QueryString["market"];
            string field        = Request.QueryString["field"] == null ? string.Empty : Request.QueryString["field"];
            string index        = Request.QueryString["index"] == null ? string.Empty : Request.QueryString["index"];
            string province     = Request.QueryString["province"] == null ? string.Empty : Request.QueryString["province"];
            string stockName    = Request.QueryString["stockName"] == null ? string.Empty : Request.QueryString["stockName"].ToString().Trim();
            string stockcode    = Request.QueryString["stockcode"] == null ? string.Empty : Request.QueryString["stockcode"];
            string MarketName   = Request.QueryString["MarketName"] == "--请选择--" ? string.Empty : Request.QueryString["MarketName"];
            string FieldName    = Request.QueryString["FieldName"] == "--请选择--" ? string.Empty : Request.QueryString["FieldName"].Trim();
            string IndexName    = Request.QueryString["IndexName"].Trim();
            string ProvinceName = Request.QueryString["ProvinceName"] == "--请选择--" ? string.Empty : Request.QueryString["ProvinceName"].Trim();

            StockQueryCondition qc = new StockQueryCondition();

            qc.DatePickerFrom = dateFrom;
            qc.StockCode      = stockcode;
            qc.StockName      = stockName;
            qc.Market         = MarketName;
            qc.Field          = FieldName;
            qc.Index          = IndexName;
            qc.Province       = ProvinceName;

            this.ViewState["_StockQueryCondition"] = qc.SerializeToString();

            int indexDay = 14;

            if (qc.Index.Equals("RSI(5)"))
            {
                indexDay = 5;
            }
            else if (qc.Index.Equals("RSI(9)"))
            {
                indexDay = 9;
            }
            else if (qc.Index.Equals("RSI(14)"))
            {
                indexDay = 14;
            }
            else if (qc.Index.Equals("WMS(10)"))
            {
                indexDay = 10;
            }
            else if (qc.Index.Equals("WMS(20)"))
            {
                indexDay = 20;
            }

            string dateTo = DateTimeFunction.ConvertDate(qc.DatePickerFrom);
            string date   = new StockSystem().GetIndexDay(qc.DatePickerFrom, indexDay);

            date = DateTimeFunction.ConvertDate(DateTime.Parse(date).ToShortDateString());

            AISTOCK_STOCK_STATS_DATA stockData = new StockSystem().GetStockData(dateTo, stockcode);

            if (qc.Index.Equals("RSI(5)") || qc.Index.Equals("RSI(9)") || qc.Index.Equals("RSI(14)"))
            {
                AISTOCK_STOCK_INDEX_V_DATA dataRSI = new AISTOCK_STOCK_INDEX_V_DATA();
                dataRSI = new StockSystem().GetStockDataIndex(date, dateTo, stockcode);

                this.BmBlafTable.Clear();
                this.BmBlafTable.BorderColor = Color.Black;
                this.BmBlafTable.BorderWidth = Unit.Point(1);
                DrawRsiTableHeader();
                DrawRsiTableBody(dataRSI, stockData);
            }
            else if (qc.Index.Equals("WMS(10)") || qc.Index.Equals("WMS(20)"))
            {
                AISTOCK_STOCK_WMS_V_DATA dataWms = new AISTOCK_STOCK_WMS_V_DATA();
                dataWms = new StockSystem().GetStockWmsData(date, dateTo, stockcode);

                this.BmBlafTable.Clear();
                this.BmBlafTable.BorderColor = Color.Black;
                this.BmBlafTable.BorderWidth = Unit.Point(1);
                DrawWmsTableHeader();
                DrawWmsTableBody(stockData, dataWms);
            }
            this.LabelTitle.Text = "名称:股票指标分析<br>" +
                                   "创建时间:" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss") + "<br>" +
                                   "时间:" + qc.DatePickerFrom + "<br>" +
                                   "所属证券市场:" + (qc.Market == string.Empty ? "ALL" : qc.Market) + "<br>" +
                                   "所属证监会行业:" + (qc.Field == string.Empty ? "ALL" : qc.Field) + "<br>" +
                                   "所属省份:" + (qc.Province == string.Empty ? "ALL" : qc.Province) + "<br>" +
                                   "指标类型:" + (qc.Index == string.Empty ? "ALL" : qc.Index) + "<br>" +
                                   "股票代码:" + (qc.StockCode == string.Empty ? "ALL" : qc.StockCode) +
                                   "股票名称:" + (qc.StockName == string.Empty ? "ALL" : qc.StockName);
        }