コード例 #1
0
ファイル: t1302.cs プロジェクト: tdoobw/XingAPI
        public static XQAllOutBlocks Get(string shcode = default, char gubun = default, string time = default, int cnt = default)
        {
            using (XQt1302 instance = new XQt1302())
            {
                instance.SetFieldData(XQt1302InBlock.BlockName, XQt1302InBlock.F.shcode, 0, shcode);             // char 6
                instance.SetFieldData(XQt1302InBlock.BlockName, XQt1302InBlock.F.gubun, 0, gubun.ToString());    // char 1
                instance.SetFieldData(XQt1302InBlock.BlockName, XQt1302InBlock.F.time, 0, time);                 // char 6
                instance.SetFieldData(XQt1302InBlock.BlockName, XQt1302InBlock.F.cnt, 0, cnt.ToString("d3"));    // int 3

                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
ファイル: t1302.cs プロジェクト: tdoobw/XingAPI
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, string shcode = default,char gubun = default,string time = default,int cnt = default */)
        {
            using (XQt1302 instance = new XQt1302())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQt1302OutBlock1" : $"XQt1302OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt1302OutBlock1>(qo);
                return(results);
            }
        }
コード例 #3
0
ファイル: t1302.cs プロジェクト: tdoobw/XingAPI
        public static XQt1302OutBlock1[] ListFromQuery(XQt1302 query)
        {
            int count = query.GetBlockCount(XQt1302OutBlock1.BlockName);
            List <XQt1302OutBlock1> list = new List <XQt1302OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1302OutBlock1 block = new XQt1302OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.chetime     = query.GetFieldData(block.GetBlockName(), "chetime", i).TrimEnd('?');                 // char 6
                    block.close       = query.GetFieldData(block.GetBlockName(), "close", i).ParseLong("close");             // 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.chdegree    = query.GetFieldData(block.GetBlockName(), "chdegree", i).ParseFloat("chdegree");      // float 8.2
                    block.mdvolume    = query.GetFieldData(block.GetBlockName(), "mdvolume", i).ParseLong("mdvolume");       // long 12
                    block.msvolume    = query.GetFieldData(block.GetBlockName(), "msvolume", i).ParseLong("msvolume");       // long 12
                    block.revolume    = query.GetFieldData(block.GetBlockName(), "revolume", i).ParseLong("revolume");       // long 12
                    block.mdchecnt    = query.GetFieldData(block.GetBlockName(), "mdchecnt", i).ParseLong("mdchecnt");       // long 8
                    block.mschecnt    = query.GetFieldData(block.GetBlockName(), "mschecnt", i).ParseLong("mschecnt");       // long 8
                    block.rechecnt    = query.GetFieldData(block.GetBlockName(), "rechecnt", i).ParseLong("rechecnt");       // long 8
                    block.volume      = query.GetFieldData(block.GetBlockName(), "volume", i).ParseLong("volume");           // long 12
                    block.open        = query.GetFieldData(block.GetBlockName(), "open", i).ParseLong("open");               // long 8
                    block.high        = query.GetFieldData(block.GetBlockName(), "high", i).ParseLong("high");               // long 8
                    block.low         = query.GetFieldData(block.GetBlockName(), "low", i).ParseLong("low");                 // long 8
                    block.cvolume     = query.GetFieldData(block.GetBlockName(), "cvolume", i).ParseLong("cvolume");         // long 12
                    block.mdchecnttm  = query.GetFieldData(block.GetBlockName(), "mdchecnttm", i).ParseLong("mdchecnttm");   // long 8
                    block.mschecnttm  = query.GetFieldData(block.GetBlockName(), "mschecnttm", i).ParseLong("mschecnttm");   // long 8
                    block.totofferrem = query.GetFieldData(block.GetBlockName(), "totofferrem", i).ParseLong("totofferrem"); // long 12
                    block.totbidrem   = query.GetFieldData(block.GetBlockName(), "totbidrem", i).ParseLong("totbidrem");     // long 12
                    block.mdvolumetm  = query.GetFieldData(block.GetBlockName(), "mdvolumetm", i).ParseLong("mdvolumetm");   // long 12
                    block.msvolumetm  = query.GetFieldData(block.GetBlockName(), "msvolumetm", i).ParseLong("msvolumetm");   // long 12
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
コード例 #4
0
ファイル: t1302.cs プロジェクト: iPeterPan/XingAPI
        public static XQt1302OutBlock1[] Get(string shcode = default, char gubun = default, string time = default, int cnt = default)
        {
            using (XQt1302 instance = new XQt1302())
            {
                instance.SetFieldData(XQt1302InBlock.BlockName, XQt1302InBlock.F.shcode, 0, shcode);             // char 6
                instance.SetFieldData(XQt1302InBlock.BlockName, XQt1302InBlock.F.gubun, 0, gubun.ToString());    // char 1
                instance.SetFieldData(XQt1302InBlock.BlockName, XQt1302InBlock.F.time, 0, time);                 // char 6
                instance.SetFieldData(XQt1302InBlock.BlockName, XQt1302InBlock.F.cnt, 0, cnt.ToString("d3"));    // int 3

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

                var outBlock = instance.GetBlock1s();
                return(outBlock);
            }
        }
コード例 #5
0
ファイル: t1302.cs プロジェクト: tdoobw/XingAPI
        public static XQt1302OutBlock FromQuery(XQt1302 query)
        {
            XQt1302OutBlock block = new XQt1302OutBlock();

            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_time = query.GetFieldData(block.GetBlockName(), "cts_time", 0).TrimEnd('?');                 // char 6
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }