Exemplo n.º 1
0
        public static XQt1471OutBlock FromQuery(XQt1471 query)
        {
            XQt1471OutBlock block = new XQt1471OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.time   = query.GetFieldData(block.GetBlockName(), "time", 0).TrimEnd('?');               // char 6
                block.price  = query.GetFieldData(block.GetBlockName(), "price", 0).ParseLong("price");        // long 8
                block.sign   = query.GetFieldData(block.GetBlockName(), "sign", 0).FirstOrDefault();           // char 1
                block.change = query.GetFieldData(block.GetBlockName(), "change", 0).ParseLong("change");      // long 8
                block.diff   = query.GetFieldData(block.GetBlockName(), "diff", 0).ParseFloat("diff");         // float 6.2
                block.volume = query.GetFieldData(block.GetBlockName(), "volume", 0).ParseLong("volume");      // long 12
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }
Exemplo n.º 2
0
        public static XQAllOutBlocks Get(string shcode = default, string gubun = default, string time = default, string cnt = default)
        {
            using (XQt1471 instance = new XQt1471())
            {
                instance.SetFieldData(XQt1471InBlock.BlockName, XQt1471InBlock.F.shcode, 0, shcode);           // char 6
                instance.SetFieldData(XQt1471InBlock.BlockName, XQt1471InBlock.F.gubun, 0, gubun);             // char 2
                instance.SetFieldData(XQt1471InBlock.BlockName, XQt1471InBlock.F.time, 0, time);               // char 6
                instance.SetFieldData(XQt1471InBlock.BlockName, XQt1471InBlock.F.cnt, 0, cnt);                 // char 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);
            }
        }
Exemplo n.º 3
0
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, string shcode = default,string gubun = default,string time = default,string cnt = default */)
        {
            using (XQt1471 instance = new XQt1471())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQt1471OutBlock1" : $"XQt1471OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt1471OutBlock1>(qo);
                return(results);
            }
        }
Exemplo n.º 4
0
        public static XQt1471OutBlock1[] Get(string shcode = default, string gubun = default, string time = default, string cnt = default)
        {
            using (XQt1471 instance = new XQt1471())
            {
                instance.SetFieldData(XQt1471InBlock.BlockName, XQt1471InBlock.F.shcode, 0, shcode);           // char 6
                instance.SetFieldData(XQt1471InBlock.BlockName, XQt1471InBlock.F.gubun, 0, gubun);             // char 2
                instance.SetFieldData(XQt1471InBlock.BlockName, XQt1471InBlock.F.time, 0, time);               // char 6
                instance.SetFieldData(XQt1471InBlock.BlockName, XQt1471InBlock.F.cnt, 0, cnt);                 // char 3

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

                var outBlock = instance.GetBlock1s();
                return(outBlock);
            }
        }
Exemplo n.º 5
0
        public static XQt1471OutBlock1[] ListFromQuery(XQt1471 query)
        {
            int count = query.GetBlockCount(XQt1471OutBlock1.BlockName);
            List <XQt1471OutBlock1> list = new List <XQt1471OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1471OutBlock1 block = new XQt1471OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.time         = query.GetFieldData(block.GetBlockName(), "time", i).TrimEnd('?');                      // char 6
                    block.preoffercha1 = query.GetFieldData(block.GetBlockName(), "preoffercha1", i).ParseLong("preoffercha1"); // long 12
                    block.offerrem1    = query.GetFieldData(block.GetBlockName(), "offerrem1", i).ParseLong("offerrem1");       // long 12
                    block.offerho1     = query.GetFieldData(block.GetBlockName(), "offerho1", i).ParseLong("offerho1");         // long 8
                    block.bidho1       = query.GetFieldData(block.GetBlockName(), "bidho1", i).ParseLong("bidho1");             // long 8
                    block.bidrem1      = query.GetFieldData(block.GetBlockName(), "bidrem1", i).ParseLong("bidrem1");           // long 12
                    block.prebidcha1   = query.GetFieldData(block.GetBlockName(), "prebidcha1", i).ParseLong("prebidcha1");     // long 12
                    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.totsun       = query.GetFieldData(block.GetBlockName(), "totsun", i).ParseLong("totsun");             // long 12
                    block.msrate       = query.GetFieldData(block.GetBlockName(), "msrate", i).ParseFloat("msrate");            // float 6.2
                    block.close        = query.GetFieldData(block.GetBlockName(), "close", i).ParseLong("close");               // long 8
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }