Exemple #1
0
        public static XQt8409OutBlock1[] ListFromQuery(XQt8409 query)
        {
            int count = query.GetBlockCount(XQt8409OutBlock1.BlockName);
            List <XQt8409OutBlock1> list = new List <XQt8409OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt8409OutBlock1 block = new XQt8409OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.dt           = query.GetFieldData(block.GetBlockName(), "dt", i).TrimEnd('?');                        // char 14
                    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.close        = query.GetFieldData(block.GetBlockName(), "close", i).ParseFloat("close");              // float 6.2
                    block.openopenyak  = query.GetFieldData(block.GetBlockName(), "openopenyak", i).ParseLong("openopenyak");   // long 8
                    block.highopenyak  = query.GetFieldData(block.GetBlockName(), "highopenyak", i).ParseLong("highopenyak");   // long 8
                    block.lowopenyak   = query.GetFieldData(block.GetBlockName(), "lowopenyak", i).ParseLong("lowopenyak");     // long 8
                    block.closeopenyak = query.GetFieldData(block.GetBlockName(), "closeopenyak", i).ParseLong("closeopenyak"); // long 8
                    block.openupdn     = query.GetFieldData(block.GetBlockName(), "openupdn", i).ParseLong("openupdn");         // long 8
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
Exemple #2
0
        public static XQt8409OutBlock FromQuery(XQt8409 query)
        {
            XQt8409OutBlock block = new XQt8409OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.price   = query.GetFieldData(block.GetBlockName(), "price", 0).ParseFloat("price");          // float 6.2
                block.sign    = query.GetFieldData(block.GetBlockName(), "sign", 0).FirstOrDefault();              // char 1
                block.change  = query.GetFieldData(block.GetBlockName(), "change", 0).ParseFloat("change");        // float 6.2
                block.diff    = query.GetFieldData(block.GetBlockName(), "diff", 0).ParseFloat("diff");            // float 6.2
                block.cvolume = query.GetFieldData(block.GetBlockName(), "cvolume", 0).ParseLong("cvolume");       // long 8
                block.volume  = query.GetFieldData(block.GetBlockName(), "volume", 0).ParseDouble("volume");       // double 15.0
                block.openyak = query.GetFieldData(block.GetBlockName(), "openyak", 0).ParseLong("openyak");       // long 8
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }