public void SaveRSIData(AISTOCK_STOCK_COMMAND_DATA data) { using (DaStock da = new DaStock()) { da.SaveRSIData(data.AISTOCK_STOCK_COMMAND); } }
public AISTOCK_STOCK_COMMAND_DATA GetRSIData(string date) { AISTOCK_STOCK_COMMAND_DATA data = new AISTOCK_STOCK_COMMAND_DATA(); using (DaStock da = new DaStock()) { da.LoadRSIData(data.AISTOCK_STOCK_COMMAND, date); } return(data); }
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()); } }
public void SaveRSIData(AISTOCK_STOCK_COMMAND_DATA data) { new Stock().SaveRSIData(data); }