Пример #1
0
        public static XQAllOutBlocks Get(string focode = default, char bdgubun = default, int nmin = default, char tcgubun = default, int cnt = default)
        {
            using (XQt2421 instance = new XQt2421())
            {
                instance.SetFieldData(XQt2421InBlock.BlockName, XQt2421InBlock.F.focode, 0, focode);                 // char 8
                instance.SetFieldData(XQt2421InBlock.BlockName, XQt2421InBlock.F.bdgubun, 0, bdgubun.ToString());    // char 1
                instance.SetFieldData(XQt2421InBlock.BlockName, XQt2421InBlock.F.nmin, 0, nmin.ToString("d3"));      // int 3
                instance.SetFieldData(XQt2421InBlock.BlockName, XQt2421InBlock.F.tcgubun, 0, tcgubun.ToString());    // char 1
                instance.SetFieldData(XQt2421InBlock.BlockName, XQt2421InBlock.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
        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);
        }
Пример #3
0
        public static XQt2421OutBlock1[] ListFromQuery(XQt2421 query)
        {
            int count = query.GetBlockCount(XQt2421OutBlock1.BlockName);
            List <XQt2421OutBlock1> list = new List <XQt2421OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt2421OutBlock1 block = new XQt2421OutBlock1();
                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
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, string focode = default,char bdgubun = default,int nmin = default,char tcgubun = default,int cnt = default */)
        {
            using (XQt2421 instance = new XQt2421())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQt2421OutBlock1" : $"XQt2421OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt2421OutBlock1>(qo);
                return(results);
            }
        }
Пример #5
0
        public static XQt2421OutBlock1[] Get(string focode = default, char bdgubun = default, int nmin = default, char tcgubun = default, int cnt = default)
        {
            using (XQt2421 instance = new XQt2421())
            {
                instance.SetFieldData(XQt2421InBlock.BlockName, XQt2421InBlock.F.focode, 0, focode);                 // char 8
                instance.SetFieldData(XQt2421InBlock.BlockName, XQt2421InBlock.F.bdgubun, 0, bdgubun.ToString());    // char 1
                instance.SetFieldData(XQt2421InBlock.BlockName, XQt2421InBlock.F.nmin, 0, nmin.ToString("d3"));      // int 3
                instance.SetFieldData(XQt2421InBlock.BlockName, XQt2421InBlock.F.tcgubun, 0, tcgubun.ToString());    // char 1
                instance.SetFieldData(XQt2421InBlock.BlockName, XQt2421InBlock.F.cnt, 0, cnt.ToString("d4"));        // int 4

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

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