Esempio n. 1
0
        public static XQt2201OutBlock FromQuery(XQt2201 query)
        {
            XQt2201OutBlock block = new XQt2201OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.cts_time = query.GetFieldData(block.GetBlockName(), "cts_time", 0).TrimEnd('?');                 // char 10
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
Esempio n. 2
0
        public static XQt2201OutBlock1[] ListFromQuery(XQt2201 query)
        {
            int count = query.GetBlockCount(XQt2201OutBlock1.BlockName);
            List <XQt2201OutBlock1> list = new List <XQt2201OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt2201OutBlock1 block = new XQt2201OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.chetime      = query.GetFieldData(block.GetBlockName(), "chetime", i).TrimEnd('?');                   // char 10
                    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.cvolume      = query.GetFieldData(block.GetBlockName(), "cvolume", i).ParseLong("cvolume");           // long 8
                    block.chdegree     = query.GetFieldData(block.GetBlockName(), "chdegree", i).ParseFloat("chdegree");        // float 8.2
                    block.offerho      = query.GetFieldData(block.GetBlockName(), "offerho", i).ParseFloat("offerho");          // float 6.2
                    block.bidho        = query.GetFieldData(block.GetBlockName(), "bidho", i).ParseFloat("bidho");              // float 6.2
                    block.volume       = query.GetFieldData(block.GetBlockName(), "volume", i).ParseDouble("volume");           // double 12.0
                    block.openyak      = query.GetFieldData(block.GetBlockName(), "openyak", i).ParseLong("openyak");           // long 8
                    block.jnilopenupdn = query.GetFieldData(block.GetBlockName(), "jnilopenupdn", i).ParseLong("jnilopenupdn"); // long 8
                    block.ibasis       = query.GetFieldData(block.GetBlockName(), "ibasis", i).ParseFloat("ibasis");            // float 6.2
                    block.sbasis       = query.GetFieldData(block.GetBlockName(), "sbasis", i).ParseFloat("sbasis");            // float 6.2
                    block.kasis        = query.GetFieldData(block.GetBlockName(), "kasis", i).ParseFloat("kasis");              // float 6.2
                    block.value        = query.GetFieldData(block.GetBlockName(), "value", i).ParseDouble("value");             // double 12.0
                    block.j_openupdn   = query.GetFieldData(block.GetBlockName(), "j_openupdn", i).ParseLong("j_openupdn");     // long 8
                    block.n_msvolume   = query.GetFieldData(block.GetBlockName(), "n_msvolume", i).ParseDouble("n_msvolume");   // double 12.0
                    block.n_mdvolume   = query.GetFieldData(block.GetBlockName(), "n_mdvolume", i).ParseDouble("n_mdvolume");   // double 12.0
                    block.s_msvolume   = query.GetFieldData(block.GetBlockName(), "s_msvolume", i).ParseDouble("s_msvolume");   // double 12.0
                    block.n_mschecnt   = query.GetFieldData(block.GetBlockName(), "n_mschecnt", i).ParseLong("n_mschecnt");     // long 8
                    block.n_mdchecnt   = query.GetFieldData(block.GetBlockName(), "n_mdchecnt", i).ParseLong("n_mdchecnt");     // long 8
                    block.s_mschecnt   = query.GetFieldData(block.GetBlockName(), "s_mschecnt", i).ParseLong("s_mschecnt");     // long 8
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }