public static XQt1640OutBlock FromQuery(XQt1640 query) { XQt1640OutBlock block = new XQt1640OutBlock(); block.IsValidData = true; block.InvalidReason = ""; if (query.QueryResult != null && query.QueryResult.IsSystemError == true) { block.IsValidData = false; block.InvalidReason = query.ReceiveMessage; return(block); } try { block.offervolume = query.GetFieldData(block.GetBlockName(), "offervolume", 0).ParseLong("offervolume"); // long 8 block.bidvolume = query.GetFieldData(block.GetBlockName(), "bidvolume", 0).ParseLong("bidvolume"); // long 8 block.volume = query.GetFieldData(block.GetBlockName(), "volume", 0).ParseLong("volume"); // long 8 block.offerdiff = query.GetFieldData(block.GetBlockName(), "offerdiff", 0).ParseLong("offerdiff"); // long 8 block.biddiff = query.GetFieldData(block.GetBlockName(), "biddiff", 0).ParseLong("biddiff"); // long 8 block.sundiff = query.GetFieldData(block.GetBlockName(), "sundiff", 0).ParseLong("sundiff"); // long 8 block.basis = query.GetFieldData(block.GetBlockName(), "basis", 0).ParseFloat("basis"); // float 6.2 block.offervalue = query.GetFieldData(block.GetBlockName(), "offervalue", 0).ParseDouble("offervalue"); // double 12.0 block.bidvalue = query.GetFieldData(block.GetBlockName(), "bidvalue", 0).ParseDouble("bidvalue"); // double 12.0 block.value = query.GetFieldData(block.GetBlockName(), "value", 0).ParseDouble("value"); // double 12.0 block.offervaldiff = query.GetFieldData(block.GetBlockName(), "offervaldiff", 0).ParseDouble("offervaldiff"); // double 12.0 block.bidvaldiff = query.GetFieldData(block.GetBlockName(), "bidvaldiff", 0).ParseDouble("bidvaldiff"); // double 12.0 block.sunvaldiff = query.GetFieldData(block.GetBlockName(), "sunvaldiff", 0).ParseDouble("sunvaldiff"); // double 12.0 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }
public XQt1640OutBlock GetBlock() { XQt1640OutBlock instance = XQt1640OutBlock.FromQuery(this); return(instance); }