示例#1
0
        public static XQt1475OutBlock1[] ListFromQuery(XQt1475 query)
        {
            int count = query.GetBlockCount(XQt1475OutBlock1.BlockName);
            List <XQt1475OutBlock1> list = new List <XQt1475OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1475OutBlock1 block = new XQt1475OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.datetime = query.GetFieldData(block.GetBlockName(), "datetime", i).TrimEnd('?');                 // char 10
                    block.price    = query.GetFieldData(block.GetBlockName(), "price", i).ParseLong("price");              // long 8
                    block.sign     = query.GetFieldData(block.GetBlockName(), "sign", i).FirstOrDefault();                 // char 1
                    block.change   = query.GetFieldData(block.GetBlockName(), "change", i).ParseLong("change");            // long 8
                    block.diff     = query.GetFieldData(block.GetBlockName(), "diff", i).ParseFloat("diff");               // float 6.2
                    block.volume   = query.GetFieldData(block.GetBlockName(), "volume", i).ParseLong("volume");            // long 12
                    block.todayvp  = query.GetFieldData(block.GetBlockName(), "todayvp", i).ParseFloat("todayvp");         // float 8.2
                    block.ma5vp    = query.GetFieldData(block.GetBlockName(), "ma5vp", i).ParseFloat("ma5vp");             // float 8.2
                    block.ma20vp   = query.GetFieldData(block.GetBlockName(), "ma20vp", i).ParseFloat("ma20vp");           // float 8.2
                    block.ma60vp   = query.GetFieldData(block.GetBlockName(), "ma60vp", i).ParseFloat("ma60vp");           // float 8.2
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
示例#2
0
文件: t1475.cs 项目: tdoobw/XingAPI
        public static XQAllOutBlocks Get(string shcode = default, char vptype = default, long datacnt = default, long date = default, long time = default, long rankcnt = default, char gubun = default)
        {
            using (XQt1475 instance = new XQt1475())
            {
                instance.SetFieldData(XQt1475InBlock.BlockName, XQt1475InBlock.F.shcode, 0, shcode);                  // char 6
                instance.SetFieldData(XQt1475InBlock.BlockName, XQt1475InBlock.F.vptype, 0, vptype.ToString());       // char 1
                instance.SetFieldData(XQt1475InBlock.BlockName, XQt1475InBlock.F.datacnt, 0, datacnt.ToString("d4")); // long 4
                instance.SetFieldData(XQt1475InBlock.BlockName, XQt1475InBlock.F.date, 0, date.ToString("d8"));       // long 8
                instance.SetFieldData(XQt1475InBlock.BlockName, XQt1475InBlock.F.time, 0, time.ToString("d6"));       // long 6
                instance.SetFieldData(XQt1475InBlock.BlockName, XQt1475InBlock.F.rankcnt, 0, rankcnt.ToString("d3")); // long 3
                instance.SetFieldData(XQt1475InBlock.BlockName, XQt1475InBlock.F.gubun, 0, gubun.ToString());         // char 1

                if (instance.Request() < 0)
                {
                    return(null);
                }

                XQAllOutBlocks results = new XQAllOutBlocks();
                results.OutBlock = instance.GetBlock();
                if (results.OutBlock.IsValidData == false)
                {
                    return(null);
                }

                results.OutBlock1 = instance.GetBlock1s();
                return(results);
            }
        }
示例#3
0
文件: t1475.cs 项目: tdoobw/XingAPI
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, string shcode = default,char vptype = default,long datacnt = default,long date = default,long time = default,long rankcnt = default,char gubun = default */)
        {
            using (XQt1475 instance = new XQt1475())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

                string      tableName = (tableNamePostfix == null) ? "XQt1475OutBlock" : $"XQt1475OutBlock_{tableNamePostfix}";
                QueryOption qo        = new QueryOption(tableName);
                results.OutBlock = instance.Select <XQt1475OutBlock>(qo);

                tableName         = (tableNamePostfix == null) ? "XQt1475OutBlock1" : $"XQt1475OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt1475OutBlock1>(qo);
                return(results);
            }
        }
示例#4
0
        public static XQt1475OutBlock FromQuery(XQt1475 query)
        {
            XQt1475OutBlock block = new XQt1475OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.date    = query.GetFieldData(block.GetBlockName(), "date", 0).ParseLong("date");              // long 8
                block.time    = query.GetFieldData(block.GetBlockName(), "time", 0).ParseLong("time");              // long 6
                block.rankcnt = query.GetFieldData(block.GetBlockName(), "rankcnt", 0).ParseLong("rankcnt");        // long 3
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }