private void DrawBmTableBody(AISTOCK_STOCK_STATS_DATA data) { if (data == null) { return; } if (data.AISTOCK_STOCK_INFORMATION.Count <= 0) { return; } TableRow bodyRow; foreach (AISTOCK_STOCK_STATS_DATA.AISTOCK_STOCK_INFORMATIONRow row in data.AISTOCK_STOCK_INFORMATION.Rows) { bodyRow = this.BmBlafTableStock.AddBodyRow(); this.BmBlafTableStock.AddCell(bodyRow, row.STOCK_CODE, HorizontalAlign.Left); this.BmBlafTableStock.AddCell(bodyRow, row.STOCK_NAME, HorizontalAlign.Left); this.BmBlafTableStock.AddCell(bodyRow, row.YESTERDAY_END.ToString(), HorizontalAlign.Left); this.BmBlafTableStock.AddCell(bodyRow, row.TODAY_BEGIN.ToString(), HorizontalAlign.Left); this.BmBlafTableStock.AddCell(bodyRow, row.TODAY_END.ToString(), HorizontalAlign.Left); this.BmBlafTableStock.AddCell(bodyRow, row.INCREASE_PERCENT.ToString(), HorizontalAlign.Left); this.BmBlafTableStock.AddCell(bodyRow, row.QUANTITY.ToString(), HorizontalAlign.Left); this.BmBlafTableStock.AddCell(bodyRow, row.TOTAL_MONEY.ToString(), HorizontalAlign.Left); this.BmBlafTableStock.AddCell(bodyRow, row.CHART, HorizontalAlign.Left); } }
private void DrawRsiTableBody(AISTOCK_STOCK_INDEX_V_DATA dataRSI, AISTOCK_STOCK_STATS_DATA stockData) { 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; 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 (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 < 75 || index > 80) { continue; } bodyRow = this.BmBlafTable.AddBodyRow(); bodyRow.BorderColor = Color.Black; bodyRow.BorderWidth = Unit.Point(1); this.BmBlafTable.AddCell(bodyRow, stockRow.STOCK_CODE, HorizontalAlign.Left); this.BmBlafTable.AddCell(bodyRow, stockRow.STOCK_NAME, HorizontalAlign.Left); this.BmBlafTable.AddCell(bodyRow, index.ToString(), 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); } }
public AISTOCK_STOCK_STATS_DATA GetStockData(string date, string code) { AISTOCK_STOCK_STATS_DATA data = new AISTOCK_STOCK_STATS_DATA(); using (DaStock da = new DaStock()) { da.LoadStockInfo(data.AISTOCK_STOCK_INFORMATION, date, code); } return(data); }
public void ImportStockData(AISTOCK_STOCK_STATS_DATA data) { using (DaStock da = new DaStock()) { try { da.SaveStockData(data.AISTOCK_STOCK_INFORMATION); } catch (Exception ex) { throw new CommonException("保存股票信息数据时出错,请联系管理!" + ex.Message); } } }
private void DrawWmsTableBody(AISTOCK_STOCK_STATS_DATA stockData, AISTOCK_STOCK_WMS_V_DATA data) { if (stockData == null) { return; } if (stockData.AISTOCK_STOCK_INFORMATION.Count <= 0) { return; } decimal max_price = 0; decimal min_price = 0; decimal end_price = 0; decimal index = 0; TableRow bodyRow; for (int i = 0; i < stockData.AISTOCK_STOCK_INFORMATION.Rows.Count; i++) { AISTOCK_STOCK_STATS_DATA.AISTOCK_STOCK_INFORMATIONRow stockRow = (AISTOCK_STOCK_STATS_DATA.AISTOCK_STOCK_INFORMATIONRow)stockData.AISTOCK_STOCK_INFORMATION.Rows[i]; DataRow[] row = data.AISTOCK_STOCK_WMS_V.Select("STOCK_CODE = '" + stockRow.STOCK_CODE + "' AND STOCK_NAME = '" + stockRow.STOCK_NAME + "'"); max_price = ((AISTOCK_STOCK_WMS_V_DATA.AISTOCK_STOCK_WMS_VRow)row[0]).MAX_PRICE; min_price = ((AISTOCK_STOCK_WMS_V_DATA.AISTOCK_STOCK_WMS_VRow)row[0]).MIN_PRICE; end_price = stockRow.TODAY_END; if (max_price - min_price != 0) { index = (max_price - end_price) / (max_price - min_price) * 100; } bodyRow = this.BmBlafTable.AddBodyRow(); bodyRow.BorderColor = Color.Black; bodyRow.BorderWidth = Unit.Point(1); this.BmBlafTable.AddCell(bodyRow, stockRow.STOCK_CODE, HorizontalAlign.Left); this.BmBlafTable.AddCell(bodyRow, stockRow.STOCK_NAME, HorizontalAlign.Left); this.BmBlafTable.AddCell(bodyRow, index.ToString(), 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); } }
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/>"; }
private void DrawRsiTableBody(AISTOCK_STOCK_INDEX_V_DATA data2RSI, AISTOCK_STOCK_STATS_DATA stockData, string code, bool isToday, string today, string dateTo2, string date2RSI12, string dateTo, string dateRSI6, string dateRSI12) { if (data2RSI == null || data2RSI.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; 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 = data2RSI.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 > 40) { continue; } else { //符合条件,计算12日RSI decimal sumA12 = 0; decimal sumB12 = 0; decimal index12 = 0; AISTOCK_STOCK_INDEX_V_DATA data2RSI12 = new AISTOCK_STOCK_INDEX_V_DATA(); data2RSI12 = new StockSystem().GetStockDataIndex(date2RSI12, dateTo2, stockCode); foreach (var row2RSI12 in data2RSI12.AISTOCK_STOCK_INDEX_V) { if (row2RSI12.DIFF > 0) { sumA12 += row2RSI12.DIFF; } else { sumB12 += row2RSI12.DIFF; } } if (sumA12 - sumB12 != 0) { index12 = sumA12 / (sumA12 - sumB12) * 100; if (index12 > index) { //符合条件,计算查询日RSI6 decimal sumARSI6 = 0, sumBRSI6 = 0, indexRSI6 = 0; AISTOCK_STOCK_INDEX_V_DATA dataRSI6 = new AISTOCK_STOCK_INDEX_V_DATA(); dataRSI6 = new StockSystem().GetStockDataIndex(dateRSI6, dateTo, stockCode); foreach (var rowRSI6 in dataRSI6.AISTOCK_STOCK_INDEX_V) { if (rowRSI6.DIFF > 0) { sumARSI6 += rowRSI6.DIFF; } else { sumBRSI6 += rowRSI6.DIFF; } } if (sumARSI6 - sumBRSI6 != 0) { indexRSI6 = sumARSI6 / (sumARSI6 - sumBRSI6) * 100; decimal sumARSI12 = 0, sumBRSI12 = 0, indexRSI12 = 0; AISTOCK_STOCK_INDEX_V_DATA dataRSI12 = new AISTOCK_STOCK_INDEX_V_DATA(); dataRSI12 = new StockSystem().GetStockDataIndex(dateRSI12, dateTo, stockCode); foreach (var rowRSI12 in dataRSI12.AISTOCK_STOCK_INDEX_V) { if (rowRSI12.DIFF > 0) { sumARSI12 += rowRSI12.DIFF; } else { sumBRSI12 += rowRSI12.DIFF; } } if (sumARSI12 - sumBRSI12 != 0) { indexRSI12 = sumARSI12 / (sumARSI12 - sumBRSI12) * 100; if (indexRSI6 > indexRSI12) { //符合条件,输出 //成交量指标 int quantity = new StockSystem().GetQuantity(stockCode); decimal ratio; if (quantity == 0) { ratio = -1; } ratio = (decimal)stockRow.QUANTITY / (decimal)quantity; if (ratio < 2) { continue; } if (index == 0) { continue; } bodyRow = this.BmBlafTable.AddBodyRow(); 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, ratio.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 } } } else { continue; } } else { continue; } } } } }
private void ImportData(string date) { AISTOCK_STOCK_STATS_DATA data = new AISTOCK_STOCK_STATS_DATA(); 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, yesterdayEnd); 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); }
public void ImportStockData(AISTOCK_STOCK_STATS_DATA data) { new Stock().ImportStockData(data); }