Beispiel #1
0
        public void 계좌별주문체결현황요청응답처리(string orderDate, object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e, string sPrevNext)
        {
            log.Info("계좌별주문체결현황요청응답처리 start orderDate:" + orderDate + " sPrevNext:" + sPrevNext);

            int rowCount = OpenAPI.GetRepeatCnt(e.sTrCode, e.sRQName);

            for (int i = 0; i < rowCount; i++)
            {
                StockMyOrder myOrder = new StockMyOrder();
                myOrder.orderDate = orderDate;

                myOrder.stockBondGubun = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "주식채권구분").Trim();
                myOrder.orderNo        = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "주문번호").Trim();
                myOrder.stockCode      = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "종목번호").Trim();

                if (myOrder.stockCode.StartsWith("A"))
                {
                    myOrder.stockCode = myOrder.stockCode.Substring(1);
                }
                else if (myOrder.stockCode.StartsWith("*A"))
                {
                    myOrder.stockCode = myOrder.stockCode.Substring(2);
                }

                myOrder.sellFlag        = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "매매구분").Trim();
                myOrder.orderType       = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "주문유형구분").Trim();
                myOrder.Qty             = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "주문수량").Trim();
                myOrder.Price           = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "주문단가").Trim();
                myOrder.checkQty        = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "확인수량").Trim();
                myOrder.reserveDeny     = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "예약반대").Trim();
                myOrder.confirmNo       = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "체결번호").Trim();
                myOrder.acceptType      = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "접수구분").Trim();
                myOrder.orgOrderNo      = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "원주문번호").Trim();
                myOrder.stockName       = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "종목명").Trim();
                myOrder.payType         = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "결제구분").Trim();
                myOrder.creditTransType = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "신용거래구분").Trim();
                myOrder.confirmQty      = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "체결수량").Trim();
                myOrder.confirmPrice    = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "체결단가").Trim();
                myOrder.commType        = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "통신구분").Trim();
                myOrder.modifyFlag      = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "정정취소구분").Trim();
                myOrder.confirmedTime   = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "체결시간").Trim();

                log.Info("체결현황요청응답 : " + JsonConvert.SerializeObject(myOrder));

                if (!string.IsNullOrWhiteSpace(myOrder.orderNo))
                {
                    if (dacStock.체결내역있는지검사(myOrder) == null)
                    {
                        log.Info("신규등록");
                        dacStock.체결내역한건등록(myOrder);
                    }
                    else
                    {
                        log.Info("기존거 수정");
                        dacStock.체결내역업데이트(myOrder);
                    }
                }
            }

            if ("2".Equals(sPrevNext))
            {
                계좌주문별체결현황요청(sPrevNext);
            }

            log.Info("계좌별주문체결현황요청응답처리 start");
        }