Beispiel #1
0
        public int Execute(XingSession sess, string acc_no, string acc_pw)
        {
            CSPAQ12200._CSPAQ12200InBlock1 in_block = new CSPAQ12200._CSPAQ12200InBlock1();
            in_block.RecCnt    = Encoding.ASCII.GetBytes("00001");
            in_block.MgmtBrnNo = Encoding.ASCII.GetBytes("   ");
            in_block.AcntNo    = Encoding.ASCII.GetBytes(acc_no.PadRight(20, ' '));
            in_block.Pwd       = Encoding.ASCII.GetBytes(acc_pw.PadRight(8, ' '));
            in_block.BalCreTp  = Encoding.ASCII.GetBytes("0");

            XingQuery query = new XingQuery();

            query.TRCode     = "CSPAQ12200";
            query.InBlock    = in_block;
            query.ReceivedCB = new XingQuery.ReceivedFunc(this.ReceivedFunc);
            query.ErrorCB    = new XingQuery.ErrorFunc(this.ErrorFunc);
            query.MessageCB  = new XingQuery.MessageFunc(this.MessageFunc);

            int ec = sess.Execute <CSPAQ12200._CSPAQ12200InBlock1>(query, false);

            if (ec < 0)
            {
                LogMsg("[CSPAQ12200::Request] Execute fail. : ec(" + ec + ")");
                return(-1);
            }

            return(0);
        }
Beispiel #2
0
        public int Request(XingSession sess, string acc_no, string acc_pw)
        {
            int ec = 0;


            t0424._t0424InBlock in_block = new t0424._t0424InBlock();
            in_block.accno       = Encoding.ASCII.GetBytes(acc_no.PadRight(11 + 1, ' '));
            in_block.passwd      = Encoding.ASCII.GetBytes(acc_pw.PadRight(8 + 1, ' '));
            in_block.prcgb       = Encoding.ASCII.GetBytes("1".PadRight(2, ' '));
            in_block.chegb       = Encoding.ASCII.GetBytes("2".PadRight(2, ' '));
            in_block.dangb       = Encoding.ASCII.GetBytes("0".PadRight(2, ' '));
            in_block.charge      = Encoding.ASCII.GetBytes("1".PadRight(2, ' '));
            in_block.cts_expcode = Encoding.ASCII.GetBytes(" ".PadRight(22 + 1, ' '));

            XingQuery query = new XingQuery();

            query.TRCode     = "t0424";
            query.InBlock    = in_block;
            query.ReceivedCB = new XingQuery.ReceivedFunc(this.ReceivedFunc);
            query.ErrorCB    = new XingQuery.ErrorFunc(this.ErrorFunc);
            query.MessageCB  = new XingQuery.MessageFunc(this.MessageFunc);

            ec = sess.Execute <t0424._t0424InBlock>(query, false);
            if (ec < 0)
            {
                LogMsg("[t0424::Request] Execute fail. : ec(" + ec + ")");
                return(-1);
            }

            return(0);
        }
Beispiel #3
0
        //order_price : if it specified with 0, order with market price
        //trade_cmd : sell / buy
        public int Request(XingSession sess, string trade_cmd, string acc_no, string acc_pw, string shcode, int order_qty, int order_price)
        {
            int ec = 0;

            CSPAT00600._CSPAT00600InBlock1 in_block = new CSPAT00600._CSPAT00600InBlock1();
            in_block.AcntNo  = Encoding.ASCII.GetBytes(acc_no.PadRight(20, ' '));
            in_block.InptPwd = Encoding.ASCII.GetBytes(acc_pw.PadRight(8, ' '));
            in_block.IsuNo   = Encoding.ASCII.GetBytes(("A" + shcode.PadRight(12, ' ')));
            in_block.OrdQty  = Encoding.ASCII.GetBytes(order_qty.ToString().PadLeft(16, '0'));
            in_block.OrdPrc  = Encoding.ASCII.GetBytes(order_price.ToString().PadLeft(10, '0') + ".00");

            if (trade_cmd == "sell")
            {
                in_block.BnsTpCode = System.Text.Encoding.ASCII.GetBytes("1");
            }
            else
            {
                in_block.BnsTpCode = System.Text.Encoding.ASCII.GetBytes("2");
            }

            //가격을 지정하지 않은경우 시장가로 주문한다
            if (order_price == 0)
            {
                in_block.OrdprcPtnCode = Encoding.ASCII.GetBytes("03");                                 //시장가
                in_block.OrdPrc        = Encoding.ASCII.GetBytes("0000000000.00");                      //시장가는 가격을 0으로 설정한다
            }
            else
            {
                in_block.OrdprcPtnCode = Encoding.ASCII.GetBytes("00");                                 //지정가
            }

            in_block.MgntrnCode    = Encoding.ASCII.GetBytes("000");
            in_block.LoanDt        = Encoding.ASCII.GetBytes("".PadRight(8, ' '));
            in_block.OrdCndiTpCode = Encoding.ASCII.GetBytes("0");

            XingQuery query = new XingQuery();

            query.TRCode     = "CSPAT00600";
            query.InBlock    = in_block;
            query.ReceivedCB = new XingQuery.ReceivedFunc(this.ReceivedFunc);
            query.ErrorCB    = new XingQuery.ErrorFunc(this.ErrorFunc);
            query.MessageCB  = new XingQuery.MessageFunc(this.MessageFunc);

            ec = sess.Execute <CSPAT00600._CSPAT00600InBlock1>(query, false);
            if (ec < 0)
            {
                LogMsg("[CSPAT00600Req::Request] Execute fail. : ec(" + ec + ")");
                return(-1);
            }

            return(0);
        }
Beispiel #4
0
        public int Request(XingSession sess, string shcode)
        {
            int ec = 0;


            t1102._t1102InBlock in_block = new t1102._t1102InBlock();
            in_block.shcode = Encoding.ASCII.GetBytes(shcode);

            XingQuery query = new XingQuery();

            query.TRCode     = "t1102";
            query.InBlock    = in_block;
            query.ReceivedCB = new XingQuery.ReceivedFunc(this.ReceivedFunc);
            query.ErrorCB    = new XingQuery.ErrorFunc(this.ErrorFunc);

            ec = sess.Execute <t1102._t1102InBlock>(query, false);
            if (ec < 0)
            {
                LogMsg("[t1102Req::Request] Execute fail. : ec(" + ec + ")");
                return(-1);
            }

            return(0);
        }