Example #1
0
        public static XQt1516OutBlock FromQuery(XQt1516 query)
        {
            XQt1516OutBlock block = new XQt1516OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.shcode    = query.GetFieldData(block.GetBlockName(), "shcode", 0).TrimEnd('?');               // char 6
                block.pricejisu = query.GetFieldData(block.GetBlockName(), "pricejisu", 0).ParseFloat("pricejisu"); // float 12.2
                block.sign      = query.GetFieldData(block.GetBlockName(), "sign", 0).FirstOrDefault();             // char 1
                block.change    = query.GetFieldData(block.GetBlockName(), "change", 0).ParseFloat("change");       // float 7.2
                block.jdiff     = query.GetFieldData(block.GetBlockName(), "jdiff", 0).ParseFloat("jdiff");         // float 6.2
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
Example #2
0
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, string upcode = default,char gubun = default,string shcode = default */)
        {
            using (XQt1516 instance = new XQt1516())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQt1516OutBlock1" : $"XQt1516OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt1516OutBlock1>(qo);
                return(results);
            }
        }
Example #3
0
        public static XQt1516OutBlock1[] Get(string upcode = default, char gubun = default, string shcode = default)
        {
            using (XQt1516 instance = new XQt1516())
            {
                instance.SetFieldData(XQt1516InBlock.BlockName, XQt1516InBlock.F.upcode, 0, upcode);                 // char 3
                instance.SetFieldData(XQt1516InBlock.BlockName, XQt1516InBlock.F.gubun, 0, gubun.ToString());        // char 1
                instance.SetFieldData(XQt1516InBlock.BlockName, XQt1516InBlock.F.shcode, 0, shcode);                 // char 6

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

                var outBlock = instance.GetBlock1s();
                return(outBlock);
            }
        }
Example #4
0
        public static XQt1516OutBlock1[] ListFromQuery(XQt1516 query)
        {
            int count = query.GetBlockCount(XQt1516OutBlock1.BlockName);
            List <XQt1516OutBlock1> list = new List <XQt1516OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1516OutBlock1 block = new XQt1516OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.hname      = query.GetFieldData(block.GetBlockName(), "hname", i).TrimEnd('?');                 // char 20
                    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.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.sojinrate  = query.GetFieldData(block.GetBlockName(), "sojinrate", i).ParseFloat("sojinrate");  // float 6.2
                    block.beta       = query.GetFieldData(block.GetBlockName(), "beta", i).ParseFloat("beta");            // float 6.5
                    block.perx       = query.GetFieldData(block.GetBlockName(), "perx", i).ParseFloat("perx");            // float 8.2
                    block.frgsvolume = query.GetFieldData(block.GetBlockName(), "frgsvolume", i).ParseLong("frgsvolume"); // long 12
                    block.orgsvolume = query.GetFieldData(block.GetBlockName(), "orgsvolume", i).ParseLong("orgsvolume"); // long 12
                    block.diff_vol   = query.GetFieldData(block.GetBlockName(), "diff_vol", i).ParseFloat("diff_vol");    // float 10.2
                    block.shcode     = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?');                // char 6
                    block.total      = query.GetFieldData(block.GetBlockName(), "total", i).ParseLong("total");           // long 12
                    block.value      = query.GetFieldData(block.GetBlockName(), "value", i).ParseLong("value");           // long 12
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
Example #5
0
        public static XQAllOutBlocks Get(string upcode = default, char gubun = default, string shcode = default)
        {
            using (XQt1516 instance = new XQt1516())
            {
                instance.SetFieldData(XQt1516InBlock.BlockName, XQt1516InBlock.F.upcode, 0, upcode);                 // char 3
                instance.SetFieldData(XQt1516InBlock.BlockName, XQt1516InBlock.F.gubun, 0, gubun.ToString());        // char 1
                instance.SetFieldData(XQt1516InBlock.BlockName, XQt1516InBlock.F.shcode, 0, shcode);                 // char 6

                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);
            }
        }