Ejemplo n.º 1
0
        public static XRESNOutBlock FromQuery(XRESN query)
        {
            XRESNOutBlock block = new XRESNOutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            try
            {
                block.time        = query.GetFieldData(block.GetBlockName(), "time").TrimEnd('?');                     // char 6
                block.theoryprice = query.GetFieldData(block.GetBlockName(), "theoryprice").ParseFloat("theoryprice"); // float 10.2
                block.delt        = query.GetFieldData(block.GetBlockName(), "delt").ParseFloat("delt");               // float 7.6
                block.gama        = query.GetFieldData(block.GetBlockName(), "gama").ParseFloat("gama");               // float 7.6
                block.ceta        = query.GetFieldData(block.GetBlockName(), "ceta").ParseFloat("ceta");               // float 12.6
                block.vega        = query.GetFieldData(block.GetBlockName(), "vega").ParseFloat("vega");               // float 12.6
                block.rhox        = query.GetFieldData(block.GetBlockName(), "rhox").ParseFloat("rhox");               // float 12.6
                block.impv        = query.GetFieldData(block.GetBlockName(), "impv").ParseFloat("impv");               // float 5.2
                block.egearing    = query.GetFieldData(block.GetBlockName(), "egearing").ParseFloat("egearing");       // float 8.2
                block.shcode      = query.GetFieldData(block.GetBlockName(), "shcode").TrimEnd('?');                   // char 6
                block.elwclose    = query.GetFieldData(block.GetBlockName(), "elwclose").ParseLong("elwclose");        // long 8
                block.sign        = query.GetFieldData(block.GetBlockName(), "sign").FirstOrDefault();                 // char 1
                block.change      = query.GetFieldData(block.GetBlockName(), "change").ParseLong("change");            // long 8
                block.date        = query.GetFieldData(block.GetBlockName(), "date").TrimEnd('?');                     // char 8
                block.tickvalue   = query.GetFieldData(block.GetBlockName(), "tickvalue").ParseFloat("tickvalue");     // float 10.2
                block.lp_impv     = query.GetFieldData(block.GetBlockName(), "lp_impv").ParseFloat("lp_impv");         // float 5.2
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
Ejemplo n.º 2
0
        public XRESNOutBlock GetBlock()
        {
            XRESNOutBlock instance = XRESNOutBlock.FromQuery(this);

            return(instance);
        }