Example #1
0
        public static XRMK2OutBlock FromQuery(XRMK2 query)
        {
            XRMK2OutBlock block = new XRMK2OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            try
            {
                block.date     = query.GetFieldData(block.GetBlockName(), "date").TrimEnd('?');              // char 8
                block.time     = query.GetFieldData(block.GetBlockName(), "time").TrimEnd('?');              // char 6
                block.kodate   = query.GetFieldData(block.GetBlockName(), "kodate").TrimEnd('?');            // char 8
                block.kotime   = query.GetFieldData(block.GetBlockName(), "kotime").TrimEnd('?');            // char 6
                block.open     = query.GetFieldData(block.GetBlockName(), "open").ParseFloat("open");        // float 9.2
                block.high     = query.GetFieldData(block.GetBlockName(), "high").ParseFloat("high");        // float 9.2
                block.low      = query.GetFieldData(block.GetBlockName(), "low").ParseFloat("low");          // float 9.2
                block.price    = query.GetFieldData(block.GetBlockName(), "price").ParseFloat("price");      // float 9.2
                block.sign     = query.GetFieldData(block.GetBlockName(), "sign").FirstOrDefault();          // char 1
                block.change   = query.GetFieldData(block.GetBlockName(), "change").ParseFloat("change");    // float 9.2
                block.uprate   = query.GetFieldData(block.GetBlockName(), "uprate").ParseFloat("uprate");    // float 9.2
                block.bidho    = query.GetFieldData(block.GetBlockName(), "bidho").ParseFloat("bidho");      // float 9.2
                block.bidrem   = query.GetFieldData(block.GetBlockName(), "bidrem").ParseLong("bidrem");     // long 9
                block.offerho  = query.GetFieldData(block.GetBlockName(), "offerho").ParseFloat("offerho");  // float 9.2
                block.offerrem = query.GetFieldData(block.GetBlockName(), "offerrem").ParseLong("offerrem"); // long 9
                block.volume   = query.GetFieldData(block.GetBlockName(), "volume").ParseFloat("volume");    // float 12.0
                block.xsymbol  = query.GetFieldData(block.GetBlockName(), "xsymbol").TrimEnd('?');           // char 16
                block.cvolume  = query.GetFieldData(block.GetBlockName(), "cvolume").ParseFloat("cvolume");  // float 8.0
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
Example #2
0
        public XRMK2OutBlock GetBlock()
        {
            XRMK2OutBlock instance = XRMK2OutBlock.FromQuery(this);

            return(instance);
        }