public static XQt1449OutBlock FromQuery(XQt1449 query) { XQt1449OutBlock block = new XQt1449OutBlock(); 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).ParseLong("price"); // long 8 block.sign = query.GetFieldData(block.GetBlockName(), "sign", 0).FirstOrDefault(); // char 1 block.change = query.GetFieldData(block.GetBlockName(), "change", 0).ParseLong("change"); // long 8 block.diff = query.GetFieldData(block.GetBlockName(), "diff", 0).ParseFloat("diff"); // float 6.2 block.volume = query.GetFieldData(block.GetBlockName(), "volume", 0).ParseLong("volume"); // long 12 block.msvolume = query.GetFieldData(block.GetBlockName(), "msvolume", 0).ParseLong("msvolume"); // long 12 block.mdvolume = query.GetFieldData(block.GetBlockName(), "mdvolume", 0).ParseLong("mdvolume"); // long 12 } catch (InvalidDataFormatException e) { block.IsValidData = false; block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\""; } return(block); }
public XQt1449OutBlock GetBlock() { XQt1449OutBlock instance = XQt1449OutBlock.FromQuery(this); return(instance); }