Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
0
        public XQt8409OutBlock GetBlock()
        {
            XQt8409OutBlock instance = XQt8409OutBlock.FromQuery(this);

            return(instance);
        }