Esempio n. 1
0
        public static XQAllOutBlocks Get(string shcode = default, long dwmcode = default, string date = default, long idx = default, long cnt = default)
        {
            using (XQt1305 instance = new XQt1305())
            {
                instance.SetFieldData(XQt1305InBlock.BlockName, XQt1305InBlock.F.shcode, 0, shcode);                  // char 6
                instance.SetFieldData(XQt1305InBlock.BlockName, XQt1305InBlock.F.dwmcode, 0, dwmcode.ToString("d1")); // long 1
                instance.SetFieldData(XQt1305InBlock.BlockName, XQt1305InBlock.F.date, 0, date);                      // char 8
                instance.SetFieldData(XQt1305InBlock.BlockName, XQt1305InBlock.F.idx, 0, idx.ToString("d4"));         // long 4
                instance.SetFieldData(XQt1305InBlock.BlockName, XQt1305InBlock.F.cnt, 0, cnt.ToString("d4"));         // long 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);
            }
        }
Esempio n. 2
0
        public static XQt1305OutBlock1[] ListFromQuery(XQt1305 query)
        {
            int count = query.GetBlockCount(XQt1305OutBlock1.BlockName);
            List <XQt1305OutBlock1> list = new List <XQt1305OutBlock1>();

            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                return(list.ToArray());
            }
            for (int i = 0; i < count; i++)
            {
                XQt1305OutBlock1 block = new XQt1305OutBlock1();
                block.IsValidData   = true;
                block.InvalidReason = "";
                try
                {
                    block.date       = query.GetFieldData(block.GetBlockName(), "date", i).TrimEnd('?');                   // char 8
                    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.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.volume     = query.GetFieldData(block.GetBlockName(), "volume", i).ParseLong("volume");          // long 12
                    block.diff_vol   = query.GetFieldData(block.GetBlockName(), "diff_vol", i).ParseFloat("diff_vol");     // float 10.2
                    block.chdegree   = query.GetFieldData(block.GetBlockName(), "chdegree", i).ParseFloat("chdegree");     // float 6.2
                    block.sojinrate  = query.GetFieldData(block.GetBlockName(), "sojinrate", i).ParseFloat("sojinrate");   // float 6.2
                    block.changerate = query.GetFieldData(block.GetBlockName(), "changerate", i).ParseFloat("changerate"); // float 6.2
                    block.fpvolume   = query.GetFieldData(block.GetBlockName(), "fpvolume", i).ParseLong("fpvolume");      // long 12
                    block.covolume   = query.GetFieldData(block.GetBlockName(), "covolume", i).ParseLong("covolume");      // long 12
                    block.shcode     = query.GetFieldData(block.GetBlockName(), "shcode", i).TrimEnd('?');                 // char 6
                    block.value      = query.GetFieldData(block.GetBlockName(), "value", i).ParseLong("value");            // long 12
                    block.ppvolume   = query.GetFieldData(block.GetBlockName(), "ppvolume", i).ParseLong("ppvolume");      // long 12
                    block.o_sign     = query.GetFieldData(block.GetBlockName(), "o_sign", i).FirstOrDefault();             // char 1
                    block.o_change   = query.GetFieldData(block.GetBlockName(), "o_change", i).ParseLong("o_change");      // long 8
                    block.o_diff     = query.GetFieldData(block.GetBlockName(), "o_diff", i).ParseFloat("o_diff");         // float 6.2
                    block.h_sign     = query.GetFieldData(block.GetBlockName(), "h_sign", i).FirstOrDefault();             // char 1
                    block.h_change   = query.GetFieldData(block.GetBlockName(), "h_change", i).ParseLong("h_change");      // long 8
                    block.h_diff     = query.GetFieldData(block.GetBlockName(), "h_diff", i).ParseFloat("h_diff");         // float 6.2
                    block.l_sign     = query.GetFieldData(block.GetBlockName(), "l_sign", i).FirstOrDefault();             // char 1
                    block.l_change   = query.GetFieldData(block.GetBlockName(), "l_change", i).ParseLong("l_change");      // long 8
                    block.l_diff     = query.GetFieldData(block.GetBlockName(), "l_diff", i).ParseFloat("l_diff");         // float 6.2
                    block.marketcap  = query.GetFieldData(block.GetBlockName(), "marketcap", i).ParseLong("marketcap");    // long 12
                } catch (InvalidDataFormatException e) {
                    block.IsValidData   = false;
                    block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
                }
                list.Add(block);
            }
            return(list.ToArray());
        }
Esempio n. 3
0
        public static XQAllOutBlocks ReadFromDB(string tableNamePostfix = null /*, string shcode = default,long dwmcode = default,string date = default,long idx = default,long cnt = default */)
        {
            using (XQt1305 instance = new XQt1305())
            {
                XQAllOutBlocks results = new XQAllOutBlocks();

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

                tableName         = (tableNamePostfix == null) ? "XQt1305OutBlock1" : $"XQt1305OutBlock1_{tableNamePostfix}";
                qo                = new QueryOption(tableName);
                results.OutBlock1 = instance.SelectMany <XQt1305OutBlock1>(qo);
                return(results);
            }
        }
Esempio n. 4
0
        public static XQt1305OutBlock1[] Get(string shcode = default, long dwmcode = default, string date = default, long idx = default, long cnt = default)
        {
            using (XQt1305 instance = new XQt1305())
            {
                instance.SetFieldData(XQt1305InBlock.BlockName, XQt1305InBlock.F.shcode, 0, shcode);                  // char 6
                instance.SetFieldData(XQt1305InBlock.BlockName, XQt1305InBlock.F.dwmcode, 0, dwmcode.ToString("d1")); // long 1
                instance.SetFieldData(XQt1305InBlock.BlockName, XQt1305InBlock.F.date, 0, date);                      // char 8
                instance.SetFieldData(XQt1305InBlock.BlockName, XQt1305InBlock.F.idx, 0, idx.ToString("d4"));         // long 4
                instance.SetFieldData(XQt1305InBlock.BlockName, XQt1305InBlock.F.cnt, 0, cnt.ToString("d4"));         // long 4

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

                var outBlock = instance.GetBlock1s();
                return(outBlock);
            }
        }
Esempio n. 5
0
        public static XQt1305OutBlock FromQuery(XQt1305 query)
        {
            XQt1305OutBlock block = new XQt1305OutBlock();

            block.IsValidData   = true;
            block.InvalidReason = "";
            if (query.QueryResult != null && query.QueryResult.IsSystemError == true)
            {
                block.IsValidData   = false;
                block.InvalidReason = query.ReceiveMessage;
                return(block);
            }
            try
            {
                block.cnt  = query.GetFieldData(block.GetBlockName(), "cnt", 0).ParseLong("cnt");              // long 4
                block.date = query.GetFieldData(block.GetBlockName(), "date", 0).TrimEnd('?');                 // char 8
                block.idx  = query.GetFieldData(block.GetBlockName(), "idx", 0).ParseLong("idx");              // long 4
            } catch (InvalidDataFormatException e) {
                block.IsValidData   = false;
                block.InvalidReason = $"FieldName == {e.DataFieldName}, FieldData == \"{e.DataValue}\"";
            }
            return(block);
        }