Exemple #1
0
        public static XQt2835OutBlock FromQuery(XQt2835 query)
        {
            XQt2835OutBlock block = new XQt2835OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.gmprice  = query.GetFieldData(block.GetBlockName(), "gmprice", 0).ParseFloat("gmprice");         // float 6.2
                block.gmsign   = query.GetFieldData(block.GetBlockName(), "gmsign", 0).FirstOrDefault();               // char 1
                block.gmchange = query.GetFieldData(block.GetBlockName(), "gmchange", 0).ParseFloat("gmchange");       // float 6.2
                block.gmdiff   = query.GetFieldData(block.GetBlockName(), "gmdiff", 0).ParseFloat("gmdiff");           // float 6.2
                block.gmvolume = query.GetFieldData(block.GetBlockName(), "gmvolume", 0).ParseLong("gmvolume");        // long 12
                block.gmshcode = query.GetFieldData(block.GetBlockName(), "gmshcode", 0).TrimEnd('?');                 // char 8
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
Exemple #2
0
        public static XQt2835OutBlock1[] ListFromQuery(XQt2835 query)
        {
            int count = query.GetBlockCount(XQt2835OutBlock1.BlockName);
            List <XQt2835OutBlock1> list = new List <XQt2835OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt2835OutBlock1 block = new XQt2835OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.actprice  = query.GetFieldData(block.GetBlockName(), "actprice", i).ParseFloat("actprice");     // float 6.2
                    block.optcode   = query.GetFieldData(block.GetBlockName(), "optcode", i).TrimEnd('?');                // char 8
                    block.price     = query.GetFieldData(block.GetBlockName(), "price", i).ParseFloat("price");           // float 6.2
                    block.sign      = query.GetFieldData(block.GetBlockName(), "sign", i).FirstOrDefault();               // char 1
                    block.change    = query.GetFieldData(block.GetBlockName(), "change", i).ParseFloat("change");         // float 6.2
                    block.diff      = query.GetFieldData(block.GetBlockName(), "diff", i).ParseFloat("diff");             // float 6.2
                    block.volume    = query.GetFieldData(block.GetBlockName(), "volume", i).ParseLong("volume");          // long 12
                    block.offerho1  = query.GetFieldData(block.GetBlockName(), "offerho1", i).ParseFloat("offerho1");     // float 6.2
                    block.bidho1    = query.GetFieldData(block.GetBlockName(), "bidho1", i).ParseFloat("bidho1");         // float 6.2
                    block.cvolume   = query.GetFieldData(block.GetBlockName(), "cvolume", i).ParseLong("cvolume");        // long 12
                    block.impv      = query.GetFieldData(block.GetBlockName(), "impv", i).ParseFloat("impv");             // float 6.2
                    block.timevl    = query.GetFieldData(block.GetBlockName(), "timevl", i).ParseFloat("timevl");         // float 6.2
                    block.offerrem1 = query.GetFieldData(block.GetBlockName(), "offerrem1", i).ParseLong("offerrem1");    // long 12
                    block.bidrem1   = query.GetFieldData(block.GetBlockName(), "bidrem1", i).ParseLong("bidrem1");        // long 12
                    block.open      = query.GetFieldData(block.GetBlockName(), "open", i).ParseFloat("open");             // float 6.2
                    block.high      = query.GetFieldData(block.GetBlockName(), "high", i).ParseFloat("high");             // float 6.2
                    block.low       = query.GetFieldData(block.GetBlockName(), "low", i).ParseFloat("low");               // float 6.2
                    block.atmgubun  = query.GetFieldData(block.GetBlockName(), "atmgubun", i).FirstOrDefault();           // char 1
                    block.jisuconv  = query.GetFieldData(block.GetBlockName(), "jisuconv", i).ParseFloat("jisuconv");     // float 6.2
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }