コード例 #1
0
ファイル: t3401.cs プロジェクト: iPeterPan/XingAPI
        public static XQt3401OutBlock FromQuery(XQt3401 query)
        {
            XQt3401OutBlock block = new XQt3401OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.cts_date = query.GetFieldData(block.GetBlockName(), "cts_date", 0).TrimEnd('?');             // char 8
                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.value    = query.GetFieldData(block.GetBlockName(), "value", 0).ParseLong("value");          // long 12
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
コード例 #2
0
ファイル: t3401.cs プロジェクト: iPeterPan/XingAPI
        public XQt3401OutBlock GetBlock()
        {
            XQt3401OutBlock instance = XQt3401OutBlock.FromQuery(this);

            return(instance);
        }