Ejemplo n.º 1
0
        private Bid Parse(string data)
        {
            Bid bid = null;

            bid = new Bid();
            string[] item = data.Split(new Char[] { ':', ',' });
            if (item[9].Length != 8)
            {
                return(null);
            }
            string exchange = item[11].Substring(1, 4);
            string code     = item[9].Substring(1, 6);

            if (exchange == "XSHG")
            {
                bid.Code = "sh" + item[9].Substring(1, 6);
            }
            else // if (exchange == "XSHE")
            {
                bid.Code = "sz" + item[9].Substring(1, 6);
            }

            //if (!bid.Code.StartsWith("sz150") && !bid.Code.StartsWith("sh502") &&
            //    !bid.Code.StartsWith("sh000") && !bid.Code.StartsWith("sz399"))
            //    return null;

            bid.CurrentPrice = float.Parse(item[53]);
            bid.High         = float.Parse(item[57]);
            bid.Open         = float.Parse(item[55]);
            bid.Low          = float.Parse(item[59]);
            bid.LastClose    = float.Parse(item[61]);
            bid.PushTime     = new DateTime(long.Parse(item[63])).ToString();
            bid.Name         = item[7].Substring(1, item[7].Length - 2);
            bid.Volumn       = long.Parse(item[5]);
            bid.Turnover     = float.Parse(item[3]);

            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(item[13]), int.Parse(item[23])));
            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(item[15]), int.Parse(item[25])));
            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(item[17]), int.Parse(item[27])));
            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(item[19]), int.Parse(item[29])));
            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(item[21]), int.Parse(item[31])));

            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(item[33]), int.Parse(item[43])));
            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(item[35]), int.Parse(item[45])));
            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(item[37]), int.Parse(item[47])));
            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(item[39]), int.Parse(item[49])));
            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(item[41]), int.Parse(item[51])));

            return(bid);
        }
Ejemplo n.º 2
0
        private Bid Parse(string data)
        {
            String[] items = data.Split(new char[] { ',' });
            if (items.Length < 10)
            {
                return(null);
            }

            Bid bid = new Bid();

            bid.Code         = data.Substring(11, 8);
            bid.Name         = items[0].Substring(21, items[0].Length - 21); // var hq_str_sz150023="深成指B
            bid.Open         = float.Parse(items[1]);
            bid.LastClose    = float.Parse(items[2]);
            bid.CurrentPrice = float.Parse(items[3]);
            bid.High         = float.Parse(items[4]);
            bid.Low          = float.Parse(items[5]);
            //bid.Buy = decimal.Parse(items[6]);
            //bid.Sell = decimal.Parse(items[7]);
            bid.Volumn   = long.Parse(items[8]);
            bid.Turnover = float.Parse(items[9]);

            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(items[BUY_1_P]), int.Parse(items[BUY_1_A])));
            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(items[BUY_2_P]), int.Parse(items[BUY_2_A])));
            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(items[BUY_3_P]), int.Parse(items[BUY_3_A])));
            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(items[BUY_4_P]), int.Parse(items[BUY_4_A])));
            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(items[BUY_5_P]), int.Parse(items[BUY_5_A])));


            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(items[SELL_1_P]), int.Parse(items[SELL_1_A])));
            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(items[SELL_2_P]), int.Parse(items[SELL_2_A])));
            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(items[SELL_3_P]), int.Parse(items[SELL_3_A])));
            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(items[SELL_4_P]), int.Parse(items[SELL_4_A])));
            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(items[SELL_5_P]), int.Parse(items[SELL_5_A])));

            bid.PushTime = items[31];
            return(bid);
        }
Ejemplo n.º 3
0
        private Bid Parse(string data)
        {
            String[] items = data.Split(new char[] { ',' });
            if (items.Length < 10) return null;

            Bid bid = new Bid();

            bid.Code = data.Substring(11, 8);
            bid.Name = items[0].Substring(21, items[0].Length-21);    // var hq_str_sz150023="深成指B
            bid.Open = float.Parse(items[1]);
            bid.LastClose = float.Parse(items[2]);
            bid.CurrentPrice = float.Parse(items[3]);
            bid.High = float.Parse(items[4]);
            bid.Low = float.Parse(items[5]);
            //bid.Buy = decimal.Parse(items[6]);
            //bid.Sell = decimal.Parse(items[7]);
            bid.Volumn = long.Parse(items[8]);
            bid.Turnover = float.Parse(items[9]);

            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(items[BUY_1_P]), int.Parse(items[BUY_1_A])));
            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(items[BUY_2_P]), int.Parse(items[BUY_2_A])));
            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(items[BUY_3_P]), int.Parse(items[BUY_3_A])));
            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(items[BUY_4_P]), int.Parse(items[BUY_4_A])));
            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(items[BUY_5_P]), int.Parse(items[BUY_5_A])));

            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(items[SELL_1_P]), int.Parse(items[SELL_1_A])));
            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(items[SELL_2_P]), int.Parse(items[SELL_2_A])));
            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(items[SELL_3_P]), int.Parse(items[SELL_3_A])));
            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(items[SELL_4_P]), int.Parse(items[SELL_4_A])));
            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(items[SELL_5_P]), int.Parse(items[SELL_5_A])));

            return bid;
        }
        private Bid Parse(string data)
        {
            Bid bid = null;
            bid = new Bid();
            string[] item = data.Split(new Char[] { ':', ',' });
            if (item[9].Length != 8) return null;
            string exchange = item[11].Substring(1, 4);
            string code = item[9].Substring(1, 6);
            if (exchange == "XSHG")
                bid.Code = "sh" + item[9].Substring(1, 6);
            else // if (exchange == "XSHE")
                bid.Code = "sz" + item[9].Substring(1, 6);

            //if (!bid.Code.StartsWith("sz150") && !bid.Code.StartsWith("sh502") &&
            //    !bid.Code.StartsWith("sh000") && !bid.Code.StartsWith("sz399"))
            //    return null;

            bid.CurrentPrice = float.Parse(item[53]);
            bid.High = float.Parse(item[57]);
            bid.Open = float.Parse(item[55]);
            bid.Low = float.Parse(item[59]);
            bid.LastClose = float.Parse(item[61]);
            bid.PushTime = new DateTime(long.Parse(item[63])).ToString();
            bid.Name = item[7].Substring(1,item[7].Length-2);
            bid.Volumn = long.Parse(item[5]);
            bid.Turnover = float.Parse(item[3]);

            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(item[13]), int.Parse(item[23])));
            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(item[15]), int.Parse(item[25])));
            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(item[17]), int.Parse(item[27])));
            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(item[19]), int.Parse(item[29])));
            bid.AddBuyGoodsData(new Bid.GoodsData(float.Parse(item[21]), int.Parse(item[31])));

            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(item[33]), int.Parse(item[43])));
            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(item[35]), int.Parse(item[45])));
            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(item[37]), int.Parse(item[47])));
            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(item[39]), int.Parse(item[49])));
            bid.AddSellGoodsData(new Bid.GoodsData(float.Parse(item[41]), int.Parse(item[51])));

            return bid;
        }