/// <summary> /// 更新深圳行情 /// </summary> /// <param name="strSourceFile">源行情(来自行情队列)(如:SJSHQ_20100410102323.DBF)</param> /// <param name="strTargetFile">要更新的行情(SJSHQ.DBF)</param> public static string UpdateSZHQ(string strSourceFile) { #region 逻辑 string outfilepath = CommonSetting.RealTimeLinePath + @"SZNSE\"; string sql = "select * from " + strSourceFile; conn_old = GetConnection(strSourceFile); sbs = new StringBuilder(); //try //{ conn_old.Open(); dr = OdbcHelper.ExecuteReader(conn_old, CommandType.Text, sql); #region 循环 SecondeLine SL = new SecondeLine(); while (dr.Read()) { //string mycode = dr["HQZQDM"].ToString(); ////sbs.Append(GetString(dr["HQZQDM"])); sbs.Append(",");//证券代码 ////sbs.Append(GetString(dr["HQZQJC"])); sbs.Append(",");//证券简称 ////sbs.Append(GetDouble(dr["HQZRSP"])); sbs.Append(",");//昨日收盘价 //sbs.Append(dr["HQJRKP"]); sbs.Append(",");//今日开盘价 //sbs.Append(dr["HQZJCJ"]); sbs.Append(",");//最近成交价 ////sbs.Append(GetDouble(dr["HQCJSL"])); sbs.Append(",");//成交数量 ////sbs.Append(GetDouble(dr["HQCJJE"])); sbs.Append(",");//成交金额 //sbs.Append(dr["HQCJBS"]); sbs.Append(",");//成交笔数 ////sbs.Append(GetDouble(dr["HQZGCJ"])); sbs.Append(",");//最高成交价 ////sbs.Append(GetDouble(dr["HQZDCJ"])); sbs.Append(",");//最低成交价 ////sbs.Append(GetDouble(dr["HQSYL1"])); sbs.Append(",");//市盈率1 //////sbs.Append( GetDouble(dr["HQSYL2"])); sbs.Append( ",");//市盈率2 //////sbs.Append( GetDouble(dr["HQJSD1"])); sbs.Append( ",");//价格升跌1 //////sbs.Append( GetDouble(dr["HQJSD2"])); sbs.Append( ",");//价格升跌2 //////sbs.Append( GetDouble(dr["HQHYCC"])); sbs.Append( ",");//合约持仓量 ////sbs.Append(GetDouble(dr["HQSJW5"])); sbs.Append(",");//卖价位五 ////sbs.Append(GetDouble(dr["HQSSL5"])); sbs.Append(",");//卖数量五 ////sbs.Append(GetDouble(dr["HQSJW4"])); sbs.Append(",");//卖价位四 ////sbs.Append(GetDouble(dr["HQSSL4"])); sbs.Append(",");//卖数量四 ////sbs.Append(GetDouble(dr["HQSJW3"])); sbs.Append(",");//卖价位三 ////sbs.Append(GetDouble(dr["HQSSL3"])); sbs.Append(",");//卖数量三 ////sbs.Append(GetDouble(dr["HQSJW2"])); sbs.Append(",");//卖价位二 ////sbs.Append(GetDouble(dr["HQSSL2"])); sbs.Append(",");//卖数量二 //sbs.Append(dr["HQSJW1"]); sbs.Append(",");//卖价位一/叫卖揭示价 //sbs.Append(dr["HQSSL1"]); sbs.Append(",");//卖数量一 //sbs.Append(dr["HQBJW1"]); sbs.Append(",");//买价位一/叫买揭示价 //sbs.Append(dr["HQBSL1"]); sbs.Append(",");//买数量一 ////sbs.Append(GetDouble(dr["HQBJW2"])); sbs.Append(",");//买价位二 ////sbs.Append(GetDouble(dr["HQBSL2"])); sbs.Append(",");//买数量二 ////sbs.Append(GetDouble(dr["HQBJW3"])); sbs.Append(",");//买价位三 ////sbs.Append(GetDouble(dr["HQBSL3"])); sbs.Append(",");//买数量三 ////sbs.Append(GetDouble(dr["HQBJW4"])); sbs.Append(",");//买价位四 ////sbs.Append(GetDouble(dr["HQBSL4"])); sbs.Append(",");//买数量四 ////sbs.Append(GetDouble(dr["HQBJW5"])); sbs.Append(",");//买价位五 ////sbs.Append(GetDouble(dr["HQBSL5"])); sbs.Append(""); //买数量五 ////sbs.Append(DateTime.Now.ToString("HH:mm:ss")); string ccj = dr["HQZJCJ"].ToString(); //成交价 string kpj = dr["HQJRKP"].ToString(); string mrj = dr["HQBJW1"].ToString(); string mcj = dr["HQSJW1"].ToString(); string mrl = dr["HQBSL1"].ToString(); string mcl = dr["HQSSL1"].ToString(); string gpdm = dr["HQZQDM"].ToString(); string bs = dr["HQCJBS"].ToString(); string sqlstr = "insert into SZNSE(cjj,kpj,mrj,mcj,mrl,mcl,gpdm,bs) values(" + ccj + "," + kpj + "," + mrj + "," + mcj + "," + mrl + "," + mcl + ",'" + gpdm + "'," + bs + ")"; SqlHelper.ExecuteNonQuery(SqlHelper.SqlConnStringZX, CommandType.Text, sqlstr, null); // SL.CreateSencond(outfilepath + mycode + ".scd", sbs.ToString()); } #endregion //} //catch (Exception exp) //{ // Console.WriteLine("深圳读取异常:" + exp.Message); //} //finally //{ // conn_old.Close(); //} return(sbs.ToString()); #endregion }
/// <summary> /// 更新上海行情 /// </summary> /// <param name="strSourceFile">源行情(来自行情队列)(如:SHOW2003_20100410102323.DBF)</param> /// <param name="strTargetFile">要更新的行情(SHOW2003.DBF)</param> public static string UpdateSHHQ(string strSourceFile) { #region 逻辑 string outfilepath = CommonSetting.RealTimeLinePath + @"SHASE\"; string sql = "select * from " + strSourceFile; conn_old = GetConnection(strSourceFile); sbs = new StringBuilder(); //try //{ conn_old.Open(); dr = OdbcHelper.ExecuteReader(conn_old, CommandType.Text, sql); #region 循环 SecondeLine SL = new SecondeLine(); while (dr.Read()) { //string mycode = dr["s1"].ToString(); ////sbs.Append(GetString(dr["s1"])); sbs.Append(",");//证券代码 -0 ////sbs.Append(GetString(dr["s2"])); sbs.Append(",");//证券名称- ////sbs.Append(GetDouble(dr["s3"])); sbs.Append(",");//昨收盘价格- //sbs.Append(dr["s4"]); sbs.Append(",");//今开盘价格- //sbs.Append(dr["s8"]); sbs.Append(",");//最新价- ////sbs.Append(GetDouble(dr["s11"])); sbs.Append(",");//成交数量- ////sbs.Append(GetDouble(dr["s5"])); sbs.Append(",");//今成交金额- //sbs.Append("0"); sbs.Append(","); //成交笔数-成交数量 ////sbs.Append(GetDouble(dr["s6"])); sbs.Append(",");//最高价- ////sbs.Append(GetDouble(dr["s7"])); sbs.Append(",");//最低价- ////sbs.Append(GetDouble(dr["s13"])); sbs.Append(",");//市盈率- ////sbs.Append(GetDouble(dr["s32"])); sbs.Append(",");//卖价5 ////sbs.Append(GetDouble(dr["s33"])); sbs.Append(",");//卖量5 ////sbs.Append(GetDouble(dr["s30"])); sbs.Append(",");//卖价4 ////sbs.Append(GetDouble(dr["s31"])); sbs.Append(",");//卖量4 ////sbs.Append(GetDouble(dr["s24"])); sbs.Append(",");//卖价3 ////sbs.Append(GetDouble(dr["s25"])); sbs.Append(",");//卖量3 ////sbs.Append(GetDouble(dr["s22"])); sbs.Append(",");//卖价2 ////sbs.Append(GetDouble(dr["s23"])); sbs.Append(",");//卖量2 //sbs.Append(dr["s10"]); sbs.Append(",");//当前卖出价-卖价1 //sbs.Append(dr["s21"]); sbs.Append(",");//卖量1 //sbs.Append(dr["s9"]); sbs.Append(",");//当前买入价-买价1 //sbs.Append(dr["s15"]); sbs.Append(",");//买量1 ////sbs.Append(GetDouble(dr["s16"])); sbs.Append(",");//买价2 ////sbs.Append(GetDouble(dr["s17"])); sbs.Append(",");//买量2 ////sbs.Append(GetDouble(dr["s18"])); sbs.Append(",");//买价3 ////sbs.Append(GetDouble(dr["s19"])); sbs.Append(",");//买量3 ////sbs.Append(GetDouble(dr["s26"])); sbs.Append(",");//买价4 ////sbs.Append(GetDouble(dr["s27"])); sbs.Append(",");//买量4 ////sbs.Append(GetDouble(dr["s28"])); sbs.Append(",");//买价5 ////sbs.Append(GetDouble(dr["s29"])); sbs.Append(",");//买量5 ////sbs.Append(DateTime.Now.ToString("HH:mm:ss")); string ccj = dr["s8"].ToString(); //成交价 string kpj = dr["s4"].ToString(); string mrj = dr["s9"].ToString(); string mcj = dr["s10"].ToString(); string mrl = dr["s15"].ToString(); string mcl = dr["s21"].ToString(); string gpdm = dr["s1"].ToString(); string bs = "0"; string sqlstr = "insert into SHASE(cjj,kpj,mrj,mcj,mrl,mcl,gpdm,bs) values(" + ccj + "," + kpj + "," + mrj + "," + mcj + "," + mrl + "," + mcl + ",'" + gpdm + "'," + bs + ")"; SqlHelper.ExecuteNonQuery(SqlHelper.SqlConnStringZX, CommandType.Text, sqlstr, null); // SL.CreateSencond(outfilepath + mycode + ".scd", sbs.ToString()); } #endregion //} //catch (Exception exp) //{ // sbs.Append(exp.Message); //} //finally //{ // conn_old.Close(); //} #endregion return(sbs.ToString()); }