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

            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).ParseFloat("price");          // float 6.2
                block.sign    = query.GetFieldData(block.GetBlockName(), "sign", 0).FirstOrDefault();              // char 1
                block.change  = query.GetFieldData(block.GetBlockName(), "change", 0).ParseFloat("change");        // float 6.2
                block.diff    = query.GetFieldData(block.GetBlockName(), "diff", 0).ParseFloat("diff");            // float 6.2
                block.cvolume = query.GetFieldData(block.GetBlockName(), "cvolume", 0).ParseLong("cvolume");       // long 8
                block.volume  = query.GetFieldData(block.GetBlockName(), "volume", 0).ParseDouble("volume");       // double 15.0
                block.openyak = query.GetFieldData(block.GetBlockName(), "openyak", 0).ParseLong("openyak");       // long 8
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
コード例 #2
0
ファイル: t2421.cs プロジェクト: tdoobw/XingAPI
        public XQt2421OutBlock GetBlock()
        {
            XQt2421OutBlock instance = XQt2421OutBlock.FromQuery(this);

            return(instance);
        }