コード例 #1
0
ファイル: t2209.cs プロジェクト: tdoobw/XingAPI
        public static XQt2209OutBlock1[] ReadFromDB(string tableNamePostfix = null /*, string focode = default,char cgubun = default,int bgubun = default,int cnt = default */)
        {
            using (XQt2209 instance = new XQt2209())
            {
                string      tableName = (tableNamePostfix == null) ? "XQt2209OutBlock1" : $"XQt2209OutBlock1_{tableNamePostfix}";
                QueryOption qo        = new QueryOption(tableName);
                // if (focode != default) qo.Add("focode", focode);
                // if (cgubun != default) qo.Add("cgubun", cgubun);
                // if (bgubun != default) qo.Add("bgubun", bgubun);
                // if (cnt != default) qo.Add("cnt", cnt);


                var outBlock = instance.SelectMany <XQt2209OutBlock1>(qo);
                return(outBlock);
            }
        }
コード例 #2
0
ファイル: t2209.cs プロジェクト: tdoobw/XingAPI
        public static XQt2209OutBlock1[] Get(string focode = default, char cgubun = default, int bgubun = default, int cnt = default)
        {
            using (XQt2209 instance = new XQt2209())
            {
                instance.SetFieldData(XQt2209InBlock.BlockName, XQt2209InBlock.F.focode, 0, focode);                 // char 8
                instance.SetFieldData(XQt2209InBlock.BlockName, XQt2209InBlock.F.cgubun, 0, cgubun.ToString());      // char 1
                instance.SetFieldData(XQt2209InBlock.BlockName, XQt2209InBlock.F.bgubun, 0, bgubun.ToString("d3"));  // int 3
                instance.SetFieldData(XQt2209InBlock.BlockName, XQt2209InBlock.F.cnt, 0, cnt.ToString("d3"));        // int 3

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

                var outBlock = instance.GetBlock1s();
                return(outBlock);
            }
        }
コード例 #3
0
ファイル: t2209.cs プロジェクト: tdoobw/XingAPI
        public static XQt2209OutBlock1[] ListFromQuery(XQt2209 query)
        {
            int count = query.GetBlockCount(XQt2209OutBlock1.BlockName);
            List <XQt2209OutBlock1> list = new List <XQt2209OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt2209OutBlock1 block = new XQt2209OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.chetime     = query.GetFieldData(block.GetBlockName(), "chetime", i).TrimEnd('?');                   // char 10
                    block.price       = query.GetFieldData(block.GetBlockName(), "price", i).ParseFloat("price");              // float 6.2
                    block.sign        = query.GetFieldData(block.GetBlockName(), "sign", i).FirstOrDefault();                  // char 1
                    block.change      = query.GetFieldData(block.GetBlockName(), "change", i).ParseFloat("change");            // float 6.2
                    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.volume      = query.GetFieldData(block.GetBlockName(), "volume", i).ParseDouble("volume");           // double 12.0
                    block.value       = query.GetFieldData(block.GetBlockName(), "value", i).ParseDouble("value");             // double 12.0
                    block.openyak     = query.GetFieldData(block.GetBlockName(), "openyak", i).ParseLong("openyak");           // long 8
                    block.openupdn    = query.GetFieldData(block.GetBlockName(), "openupdn", i).ParseLong("openupdn");         // long 8
                    block.cvolume     = query.GetFieldData(block.GetBlockName(), "cvolume", i).ParseLong("cvolume");           // long 8
                    block.s_mschecnt  = query.GetFieldData(block.GetBlockName(), "s_mschecnt", i).ParseLong("s_mschecnt");     // long 8
                    block.s_mdchecnt  = query.GetFieldData(block.GetBlockName(), "s_mdchecnt", i).ParseLong("s_mdchecnt");     // long 8
                    block.ss_mschecnt = query.GetFieldData(block.GetBlockName(), "ss_mschecnt", i).ParseLong("ss_mschecnt");   // long 8
                    block.s_mschevol  = query.GetFieldData(block.GetBlockName(), "s_mschevol", i).ParseDouble("s_mschevol");   // double 12.0
                    block.s_mdchevol  = query.GetFieldData(block.GetBlockName(), "s_mdchevol", i).ParseDouble("s_mdchevol");   // double 12.0
                    block.ss_mschevol = query.GetFieldData(block.GetBlockName(), "ss_mschevol", i).ParseDouble("ss_mschevol"); // double 12.0
                    block.chdegvol    = query.GetFieldData(block.GetBlockName(), "chdegvol", i).ParseFloat("chdegvol");        // float 8.2
                    block.chdegcnt    = query.GetFieldData(block.GetBlockName(), "chdegcnt", i).ParseFloat("chdegcnt");        // float 8.2
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }