示例#1
0
文件: t8409.cs 项目: tdoobw/XingAPI
        public static XQAllOutBlocks Get(string focode = default, char bdgubun = default, int nmin = default, char tcgubun = default, int cnt = default)
        {
            using (XQt8409 instance = new XQt8409())
            {
                instance.SetFieldData(XQt8409InBlock.BlockName, XQt8409InBlock.F.focode, 0, focode);                 // char 8
                instance.SetFieldData(XQt8409InBlock.BlockName, XQt8409InBlock.F.bdgubun, 0, bdgubun.ToString());    // char 1
                instance.SetFieldData(XQt8409InBlock.BlockName, XQt8409InBlock.F.nmin, 0, nmin.ToString("d3"));      // int 3
                instance.SetFieldData(XQt8409InBlock.BlockName, XQt8409InBlock.F.tcgubun, 0, tcgubun.ToString());    // char 1
                instance.SetFieldData(XQt8409InBlock.BlockName, XQt8409InBlock.F.cnt, 0, cnt.ToString("d4"));        // int 4

                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);
            }
        }
示例#2
0
文件: t8409.cs 项目: tdoobw/XingAPI
        public static XQt8409OutBlock FromQuery(XQt8409 query)
        {
            XQt8409OutBlock block = new XQt8409OutBlock();

            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);
        }
示例#3
0
文件: t8409.cs 项目: tdoobw/XingAPI
        public static XQt8409OutBlock1[] ListFromQuery(XQt8409 query)
        {
            int count = query.GetBlockCount(XQt8409OutBlock1.BlockName);
            List <XQt8409OutBlock1> list = new List <XQt8409OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt8409OutBlock1 block = new XQt8409OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.dt           = query.GetFieldData(block.GetBlockName(), "dt", i).TrimEnd('?');                        // char 14
                    block.open         = query.GetFieldData(block.GetBlockName(), "open", i).ParseFloat("open");                // float 6.2
                    block.high         = query.GetFieldData(block.GetBlockName(), "high", i).ParseFloat("high");                // float 6.2
                    block.low          = query.GetFieldData(block.GetBlockName(), "low", i).ParseFloat("low");                  // float 6.2
                    block.close        = query.GetFieldData(block.GetBlockName(), "close", i).ParseFloat("close");              // float 6.2
                    block.openopenyak  = query.GetFieldData(block.GetBlockName(), "openopenyak", i).ParseLong("openopenyak");   // long 8
                    block.highopenyak  = query.GetFieldData(block.GetBlockName(), "highopenyak", i).ParseLong("highopenyak");   // long 8
                    block.lowopenyak   = query.GetFieldData(block.GetBlockName(), "lowopenyak", i).ParseLong("lowopenyak");     // long 8
                    block.closeopenyak = query.GetFieldData(block.GetBlockName(), "closeopenyak", i).ParseLong("closeopenyak"); // long 8
                    block.openupdn     = query.GetFieldData(block.GetBlockName(), "openupdn", i).ParseLong("openupdn");         // long 8
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
示例#4
0
文件: t8409.cs 项目: tdoobw/XingAPI
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, string focode = default,char bdgubun = default,int nmin = default,char tcgubun = default,int cnt = default */)
        {
            using (XQt8409 instance = new XQt8409())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQt8409OutBlock1" : $"XQt8409OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt8409OutBlock1>(qo);
                return(results);
            }
        }
示例#5
0
        public static XQt8409OutBlock1[] Get(string focode = default, char bdgubun = default, int nmin = default, char tcgubun = default, int cnt = default)
        {
            using (XQt8409 instance = new XQt8409())
            {
                instance.SetFieldData(XQt8409InBlock.BlockName, XQt8409InBlock.F.focode, 0, focode);                 // char 8
                instance.SetFieldData(XQt8409InBlock.BlockName, XQt8409InBlock.F.bdgubun, 0, bdgubun.ToString());    // char 1
                instance.SetFieldData(XQt8409InBlock.BlockName, XQt8409InBlock.F.nmin, 0, nmin.ToString("d3"));      // int 3
                instance.SetFieldData(XQt8409InBlock.BlockName, XQt8409InBlock.F.tcgubun, 0, tcgubun.ToString());    // char 1
                instance.SetFieldData(XQt8409InBlock.BlockName, XQt8409InBlock.F.cnt, 0, cnt.ToString("d4"));        // int 4

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

                var outBlock = instance.GetBlock1s();
                return(outBlock);
            }
        }