Пример #1
0
        /// <summary>
        ///[26]설명 체결잔고 데이터를 반환한다.
        ///입력값 nFid – 체결잔고 아이템
        ///반환값 수신 데이터
        ///비고 Ex) 현재가출력 – openApi.GetChejanData(10);
        /// </summary>
        public String GetChejanData(int nFid)
        {
            String ret = axKHOpenAPI.GetChejanData(nFid);

            FileLog.PrintF("GetChejanData(" + nFid + "):" + ret);
            return(ret);
        }
Пример #2
0
 public string getData(string dataName)
 {
     if (s_fidMapper.ContainsKey(dataName) && m_fids.Contains(s_fidMapper[dataName]))
     {
         return(m_gateway.GetChejanData(s_fidMapper[dataName]));
     }
     return("Error");
 }
Пример #3
0
        private void OnReceiveChejanData(object sender, _DKHOpenAPIEvents_OnReceiveChejanDataEvent e)
        {
            sb = new StringBuilder(256);

            foreach (int fid in e.sGubun.Equals("0") ? catalog[5] : catalog[6])
            {
                sb.Append(axAPI.GetChejanData(fid)).Append(',');
            }

            if (e.sGubun.Equals("0"))
            {
                SendConclusion?.Invoke(this, new ConclusionEvent(sb));

                return;
            }
            if (e.sGubun.Equals("4"))
            {
                SendBalance?.Invoke(this, new BalanceEvent(sb));
            }
        }
Пример #4
0
        public override void ReceivedData(AxKHOpenAPI axKHOpenAPI, _DKHOpenAPIEvents_OnReceiveChejanDataEvent e)
        {
            /*주문체결
9201 계좌번호
9203 주문번호
9205 관리자사번
9001 종목코드, 업종코드
912 주문업무분류(JJ: 주식주문, FJ: 선물옵션, JG: 주식잔고, FG: 선물옵션잔고)
913 주문상태(10:원주문, 11:정정주문, 12:취소주문, 20:주문확인, 21:정정확인, 22:취소확인, 90 - 92:주문거부)
302 종목명
900 주문수량
901 주문가격
902 미체결수량
903 체결누계금액
904 원주문번호
905 주문구분(+현금내수, -현금매도…)
906 매매구분(보통, 시장가…)
907 매도수구분(1:매도, 2:매수)
908 주문 / 체결시간(HHMMSSMS)
909 체결번호
910 체결가
911 체결량
10 현재가, 체결가, 실시간종가
27(최우선)매도호가
28(최우선)매수호가
914 단위체결가
915 단위체결량
938 당일매매 수수료
939 당일매매세금
*/
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 구분 : 주문접수--통보");
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문/체결시간=>" + axKHOpenAPI.GetChejanData(908));   //[0]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 계좌번호=>" + axKHOpenAPI.GetChejanData(9201));   //[1]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문번호=>" + axKHOpenAPI.GetChejanData(9203));   //[2]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 관리자사번=>" + axKHOpenAPI.GetChejanData(9205));   //[3]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 종목코드, 업종코드=>" + axKHOpenAPI.GetChejanData(9001));   //[4]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문업무분류=>" + axKHOpenAPI.GetChejanData(912));   //[5]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문상태=>" + axKHOpenAPI.GetChejanData(913));   //[6]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 종목명=>" + axKHOpenAPI.GetChejanData(302));   //[7]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문수량=>" + axKHOpenAPI.GetChejanData(900));   //[8]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문가격=>" + axKHOpenAPI.GetChejanData(901));   //[9]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 미체결수량=>" + axKHOpenAPI.GetChejanData(902));   //[10]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 체결누계금액=>" + axKHOpenAPI.GetChejanData(903));   //[11]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 원주문번호=>" + axKHOpenAPI.GetChejanData(904));   //[12]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문구분(+현금내수, -현금매도…)=>" + axKHOpenAPI.GetChejanData(905));   //[13]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 매매구분(보통, 시장가…)=>" + axKHOpenAPI.GetChejanData(906));   //[14]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 매도수구분(1:매도, 2:매수)" + axKHOpenAPI.GetChejanData(907));   //[15]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 체결번호" + axKHOpenAPI.GetChejanData(909));   //[16]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 체결가=>" + axKHOpenAPI.GetChejanData(910));   //[17]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 체결량=>" + axKHOpenAPI.GetChejanData(911));   //[18]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 현재가, 체결가, 실시간종가=>" + axKHOpenAPI.GetChejanData(10));   //[19]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData (최우선)매도호가=>" + axKHOpenAPI.GetChejanData(27));   //[20]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData (최우선)매수호가=>" + axKHOpenAPI.GetChejanData(28));   //[21]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 단위체결가=>" + axKHOpenAPI.GetChejanData(914));   //[22]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 단위체결량=>" + axKHOpenAPI.GetChejanData(915));   //[23]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 당일매매 수수료=>" + axKHOpenAPI.GetChejanData(938));   //[24]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 당일매매세금=>" + axKHOpenAPI.GetChejanData(939));   //[25]

            /*카페 정보아래는 확인이 필요*/
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 화면번호=>" + axKHOpenAPI.GetChejanData(920));   //[26]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 터미널번호=>" + axKHOpenAPI.GetChejanData(921));   //[27]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 신용구분=>" + axKHOpenAPI.GetChejanData(922));   //[28]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 대출일=>" + axKHOpenAPI.GetChejanData(923));   //[29]
            Order_Data order_Data = new Order_Data();

            String 현재일자 = DateTime.Now.ToString("yyyy-MM-dd");
            String 체결시간TMP = axKHOpenAPI.GetChejanData(908).ToString().Trim();   //[0]
            //체결시간이 6자리이므로 HHMMSS ==> HH:MM:SS로 바꿔야한다.
            String 체결시간 = 체결시간TMP.Substring(0, 2) + ":" + 체결시간TMP.Substring(2, 2) + ":" + 체결시간TMP.Substring(4, 2);
            체결시간 = 현재일자 + " " + 체결시간;
            order_Data.체결시간 = 체결시간;
            order_Data.계좌번호 = axKHOpenAPI.GetChejanData(9201).ToString().Trim(); //[1]
            order_Data.주문번호 = axKHOpenAPI.GetChejanData(9203).ToString().Trim();  //[2]
            order_Data.관리자사번 = axKHOpenAPI.GetChejanData(9205).ToString().Trim();  //[3]
            order_Data.종목코드 = axKHOpenAPI.GetChejanData(9001).ToString().Trim();  //[4]
            order_Data.주문업무분류 = axKHOpenAPI.GetChejanData(912).ToString().Trim();   //[5]
            order_Data.주문상태 = axKHOpenAPI.GetChejanData(913).ToString().Trim();  //[6]
            order_Data.종목명 = axKHOpenAPI.GetChejanData(302).ToString().Trim();   //[7]
            order_Data.주문수량 = int.Parse(axKHOpenAPI.GetChejanData(900).ToString().Trim());  //[8]
            order_Data.주문가격 = int.Parse(axKHOpenAPI.GetChejanData(901).ToString().Trim());  //[9]
            order_Data.미체결수량 = int.Parse(axKHOpenAPI.GetChejanData(902).ToString().Trim());   //[10]
            order_Data.체결누계금액 = int.Parse(axKHOpenAPI.GetChejanData(903).ToString().Trim());  //[11]
            order_Data.원주문번호 = axKHOpenAPI.GetChejanData(904).ToString().Trim();   //[12]
            order_Data.주문구분 = axKHOpenAPI.GetChejanData(905).ToString().Trim();  //[13]
            order_Data.매매구분 = axKHOpenAPI.GetChejanData(906).ToString().Trim();   //[14]
            order_Data.매도수구분 = int.Parse(axKHOpenAPI.GetChejanData(907).ToString().Trim());   //[15]
            order_Data.체결번호 = axKHOpenAPI.GetChejanData(909).ToString().Trim();  //[16]
            order_Data.체결가 = int.Parse(axKHOpenAPI.GetChejanData(910).ToString().Trim());    //[17]
            order_Data.체결량 = int.Parse(axKHOpenAPI.GetChejanData(911).ToString().Trim());   //[18]
            order_Data.현재가 = int.Parse(axKHOpenAPI.GetChejanData(10).ToString().Trim());   //[19]
            order_Data.매도호가 = int.Parse(axKHOpenAPI.GetChejanData(27).ToString().Trim());   //[20]
            order_Data.매수호가 = int.Parse(axKHOpenAPI.GetChejanData(28).ToString().Trim());   //[21]
            order_Data.단위체결가 = int.Parse(axKHOpenAPI.GetChejanData(914).ToString().Trim());  //[22]
            order_Data.단위체결량 = int.Parse(axKHOpenAPI.GetChejanData(915).ToString().Trim());  //[23]
            order_Data.당일매매수수료 = int.Parse(axKHOpenAPI.GetChejanData(938).ToString().Trim());   //[24]
            order_Data.당일매매세금 = int.Parse(axKHOpenAPI.GetChejanData(939).ToString().Trim());    //[25]

            SendDirectFile(order_Data);
            SendDirectDb(order_Data);
        }
Пример #5
0
        public override void ReceivedData(AxKHOpenAPI axKHOpenAPI, _DKHOpenAPIEvents_OnReceiveChejanDataEvent e)
        {
            /*주문체결
             * 9201 계좌번호
             * 9203 주문번호
             * 9205 관리자사번
             * 9001 종목코드, 업종코드
             * 912 주문업무분류(JJ: 주식주문, FJ: 선물옵션, JG: 주식잔고, FG: 선물옵션잔고)
             * 913 주문상태(10:원주문, 11:정정주문, 12:취소주문, 20:주문확인, 21:정정확인, 22:취소확인, 90 - 92:주문거부)
             * 302 종목명
             * 900 주문수량
             * 901 주문가격
             * 902 미체결수량
             * 903 체결누계금액
             * 904 원주문번호
             * 905 주문구분(+현금내수, -현금매도…)
             * 906 매매구분(보통, 시장가…)
             * 907 매도수구분(1:매도, 2:매수)
             * 908 주문 / 체결시간(HHMMSSMS)
             * 909 체결번호
             * 910 체결가
             * 911 체결량
             * 10 현재가, 체결가, 실시간종가
             * 27(최우선)매도호가
             * 28(최우선)매수호가
             * 914 단위체결가
             * 915 단위체결량
             * 938 당일매매 수수료
             * 939 당일매매세금
             */
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 구분 : 주문접수--통보");
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문/체결시간=>" + axKHOpenAPI.GetChejanData(908));             //[0]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 계좌번호=>" + axKHOpenAPI.GetChejanData(9201));               //[1]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문번호=>" + axKHOpenAPI.GetChejanData(9203));               //[2]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 관리자사번=>" + axKHOpenAPI.GetChejanData(9205));              //[3]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 종목코드, 업종코드=>" + axKHOpenAPI.GetChejanData(9001));         //[4]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문업무분류=>" + axKHOpenAPI.GetChejanData(912));              //[5]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문상태=>" + axKHOpenAPI.GetChejanData(913));                //[6]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 종목명=>" + axKHOpenAPI.GetChejanData(302));                 //[7]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문수량=>" + axKHOpenAPI.GetChejanData(900));                //[8]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문가격=>" + axKHOpenAPI.GetChejanData(901));                //[9]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 미체결수량=>" + axKHOpenAPI.GetChejanData(902));               //[10]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 체결누계금액=>" + axKHOpenAPI.GetChejanData(903));              //[11]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 원주문번호=>" + axKHOpenAPI.GetChejanData(904));               //[12]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문구분(+현금내수, -현금매도…)=>" + axKHOpenAPI.GetChejanData(905)); //[13]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 매매구분(보통, 시장가…)=>" + axKHOpenAPI.GetChejanData(906));      //[14]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 매도수구분(1:매도, 2:매수)" + axKHOpenAPI.GetChejanData(907));     //[15]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 체결번호" + axKHOpenAPI.GetChejanData(909));                  //[16]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 체결가=>" + axKHOpenAPI.GetChejanData(910));                 //[17]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 체결량=>" + axKHOpenAPI.GetChejanData(911));                 //[18]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 현재가, 체결가, 실시간종가=>" + axKHOpenAPI.GetChejanData(10));      //[19]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData (최우선)매도호가=>" + axKHOpenAPI.GetChejanData(27));            //[20]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData (최우선)매수호가=>" + axKHOpenAPI.GetChejanData(28));            //[21]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 단위체결가=>" + axKHOpenAPI.GetChejanData(914));               //[22]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 단위체결량=>" + axKHOpenAPI.GetChejanData(915));               //[23]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 당일매매 수수료=>" + axKHOpenAPI.GetChejanData(938));            //[24]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 당일매매세금=>" + axKHOpenAPI.GetChejanData(939));              //[25]

            /*카페 정보아래는 확인이 필요*/
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 화면번호=>" + axKHOpenAPI.GetChejanData(920));  //[26]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 터미널번호=>" + axKHOpenAPI.GetChejanData(921)); //[27]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 신용구분=>" + axKHOpenAPI.GetChejanData(922));  //[28]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 대출일=>" + axKHOpenAPI.GetChejanData(923));   //[29]
            Order_Data order_Data = new Order_Data();

            String 현재일자    = DateTime.Now.ToString("yyyy-MM-dd");
            String 체결시간TMP = axKHOpenAPI.GetChejanData(908).ToString().Trim();   //[0]
            //체결시간이 6자리이므로 HHMMSS ==> HH:MM:SS로 바꿔야한다.
            String 체결시간 = 체결시간TMP.Substring(0, 2) + ":" + 체결시간TMP.Substring(2, 2) + ":" + 체결시간TMP.Substring(4, 2);

            체결시간 = 현재일자 + " " + 체결시간;

            order_Data.체결시간   = 체결시간;
            order_Data.계좌번호   = axKHOpenAPI.GetChejanData(9201).ToString().Trim();           //[1]
            order_Data.주문번호   = axKHOpenAPI.GetChejanData(9203).ToString().Trim();           //[2]
            order_Data.관리자사번  = axKHOpenAPI.GetChejanData(9205).ToString().Trim();           //[3]
            order_Data.종목코드   = axKHOpenAPI.GetChejanData(9001).ToString().Trim();           //[4]
            order_Data.주문업무분류 = axKHOpenAPI.GetChejanData(912).ToString().Trim();            //[5]
            order_Data.주문상태   = axKHOpenAPI.GetChejanData(913).ToString().Trim();            //[6]
            order_Data.종목명    = axKHOpenAPI.GetChejanData(302).ToString().Trim();            //[7]
            order_Data.주문수량   = int.Parse(axKHOpenAPI.GetChejanData(900).ToString().Trim()); //[8]
            order_Data.주문가격   = int.Parse(axKHOpenAPI.GetChejanData(901).ToString().Trim()); //[9]
            order_Data.미체결수량  = int.Parse(axKHOpenAPI.GetChejanData(902).ToString().Trim()); //[10]
            order_Data.체결누계금액 = int.Parse(axKHOpenAPI.GetChejanData(903).ToString().Trim()); //[11]
            order_Data.원주문번호  = axKHOpenAPI.GetChejanData(904).ToString().Trim();            //[12]
            order_Data.주문구분   = axKHOpenAPI.GetChejanData(905).ToString().Trim();            //[13]
            order_Data.매매구분   = axKHOpenAPI.GetChejanData(906).ToString().Trim();            //[14]
            order_Data.매도수구분  = int.Parse(axKHOpenAPI.GetChejanData(907).ToString().Trim()); //[15]
            order_Data.체결번호   = axKHOpenAPI.GetChejanData(909).ToString().Trim();            //[16]
            String str체결가 = axKHOpenAPI.GetChejanData(910).ToString().Trim();                //[17]

            order_Data.체결가 = 0;
            if (!str체결가.Equals(""))
            {
                order_Data.체결가 = int.Parse(str체결가);
            }
            String str체결량 = axKHOpenAPI.GetChejanData(911).ToString().Trim();//[18]

            order_Data.체결량 = 0;
            if (!str체결량.Equals(""))
            {
                order_Data.체결량 = int.Parse(str체결량);
            }
            order_Data.현재가  = int.Parse(axKHOpenAPI.GetChejanData(10).ToString().Trim()); //[19]
            order_Data.매도호가 = int.Parse(axKHOpenAPI.GetChejanData(27).ToString().Trim()); //[20]
            order_Data.매수호가 = int.Parse(axKHOpenAPI.GetChejanData(28).ToString().Trim()); //[21]

            String str단위체결가 = axKHOpenAPI.GetChejanData(914).ToString().Trim();           //[22]

            order_Data.단위체결가 = 0;
            if (!str단위체결가.Equals(""))
            {
                order_Data.단위체결가 = int.Parse(str단위체결가);
            }
            String str단위체결량 = axKHOpenAPI.GetChejanData(915).ToString().Trim(); //[23]

            order_Data.단위체결량 = 0;
            if (!str단위체결량.Equals(""))
            {
                order_Data.단위체결량 = int.Parse(str단위체결량);
            }
            order_Data.당일매매수수료 = int.Parse(axKHOpenAPI.GetChejanData(938).ToString().Trim());   //[24]
            order_Data.당일매매세금  = int.Parse(axKHOpenAPI.GetChejanData(939).ToString().Trim());   //[25]

            SendDirectFile(order_Data);
            SendDirectDb(order_Data);
        }
Пример #6
0
        public override void ReceivedData(AxKHOpenAPI axKHOpenAPI, _DKHOpenAPIEvents_OnReceiveChejanDataEvent e)
        {
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 구분 : 잔고통보");
            //FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문/기록시간=>" + axKHOpenAPI.GetChejanData(908));
            //시간이 없음
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 계좌번호=>" + axKHOpenAPI.GetChejanData(9201));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 종목코드, 업종코드=>" + axKHOpenAPI.GetChejanData(9001));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 현재가, 체결가, 실시간종가=>" + axKHOpenAPI.GetChejanData(10));

            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 보유수량=>" + axKHOpenAPI.GetChejanData(930));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 매입단가=>" + axKHOpenAPI.GetChejanData(931));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 총매입가=>" + axKHOpenAPI.GetChejanData(932));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문가능수량=>" + axKHOpenAPI.GetChejanData(933));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 당일순매수량=>" + axKHOpenAPI.GetChejanData(945));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 매도 / 매수구분=>" + axKHOpenAPI.GetChejanData(946));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 당일 총 매도 손익=>" + axKHOpenAPI.GetChejanData(950));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 예수금=>" + axKHOpenAPI.GetChejanData(951));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData (최우선)매도호가=>" + axKHOpenAPI.GetChejanData(27));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData (최우선)매수호가=>" + axKHOpenAPI.GetChejanData(28));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 기준가=>" + axKHOpenAPI.GetChejanData(307));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 손익율=>" + axKHOpenAPI.GetChejanData(8019));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주식옵션거래단위=>" + axKHOpenAPI.GetChejanData(397));


            Balance_Data balance_Data = new Balance_Data();
            String dayTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            balance_Data.기록시간 = dayTime;   //[0]
            balance_Data.계좌번호 = axKHOpenAPI.GetChejanData(9201).ToString().Trim(); //[1]
            balance_Data.종목코드 = axKHOpenAPI.GetChejanData(9001).ToString().Trim();  //[2]
            balance_Data.현재가 = int.Parse(axKHOpenAPI.GetChejanData(10).ToString().Trim());  //[3]
            balance_Data.보유수량 = int.Parse(axKHOpenAPI.GetChejanData(930).ToString().Trim());  //[4]
            balance_Data.매입단가 = int.Parse(axKHOpenAPI.GetChejanData(931).ToString().Trim());   //[5]
            balance_Data.총매입가 = int.Parse(axKHOpenAPI.GetChejanData(932).ToString().Trim());  //[6]
            balance_Data.주문가능수량 = int.Parse(axKHOpenAPI.GetChejanData(933).ToString().Trim());   //[7]
            balance_Data.당일순매수량 = int.Parse(axKHOpenAPI.GetChejanData(945).ToString().Trim());  //[8]
            balance_Data.매도수구분 = int.Parse(axKHOpenAPI.GetChejanData(946).ToString().Trim());  //[9]
            balance_Data.당일총매도손익 = int.Parse(axKHOpenAPI.GetChejanData(950).ToString().Trim());   //[10]
            balance_Data.예수금 = int.Parse(axKHOpenAPI.GetChejanData(951).ToString().Trim());  //[11]
            balance_Data.매도호가 = int.Parse(axKHOpenAPI.GetChejanData(27).ToString().Trim());  //[12]
            balance_Data.매수호가 = int.Parse(axKHOpenAPI.GetChejanData(28).ToString().Trim()); //[13]
            balance_Data.기준가 = int.Parse(axKHOpenAPI.GetChejanData(307).ToString().Trim());   //[14]
            balance_Data.손익율 = float.Parse(axKHOpenAPI.GetChejanData(8019).ToString().Trim());   //[15]
            balance_Data.주식옵션거래단위 = axKHOpenAPI.GetChejanData(397).ToString().Trim();  //[16]

            SendDirectFile(balance_Data);
            SendDirectDb(balance_Data);
        }
Пример #7
0
        public override void ReceivedData(AxKHOpenAPI axKHOpenAPI, _DKHOpenAPIEvents_OnReceiveChejanDataEvent e)
        {
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 구분 : 잔고통보");
            //FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문/기록시간=>" + axKHOpenAPI.GetChejanData(908));
            //시간이 없음
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 계좌번호=>" + axKHOpenAPI.GetChejanData(9201));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 종목코드, 업종코드=>" + axKHOpenAPI.GetChejanData(9001));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 현재가, 체결가, 실시간종가=>" + axKHOpenAPI.GetChejanData(10));

            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 신용구분=>" + axKHOpenAPI.GetChejanData(917));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 대출일=>" + axKHOpenAPI.GetChejanData(916));


            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 보유수량=>" + axKHOpenAPI.GetChejanData(930));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 매입단가=>" + axKHOpenAPI.GetChejanData(931));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 총매입가=>" + axKHOpenAPI.GetChejanData(932));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문가능수량=>" + axKHOpenAPI.GetChejanData(933));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 당일순매수량=>" + axKHOpenAPI.GetChejanData(945));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 매도 / 매수구분=>" + axKHOpenAPI.GetChejanData(946));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 당일 총 매도 손익=>" + axKHOpenAPI.GetChejanData(950));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 예수금=>" + axKHOpenAPI.GetChejanData(951));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData (최우선)매도호가=>" + axKHOpenAPI.GetChejanData(27));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData (최우선)매수호가=>" + axKHOpenAPI.GetChejanData(28));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 기준가=>" + axKHOpenAPI.GetChejanData(307));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 손익율=>" + axKHOpenAPI.GetChejanData(8019));


            /*추가-살아있다.*/
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 신용금액=>" + axKHOpenAPI.GetChejanData(957));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 신용이자=>" + axKHOpenAPI.GetChejanData(958));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 만기일=>" + axKHOpenAPI.GetChejanData(918));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 당일실현손익(유가)=>" + axKHOpenAPI.GetChejanData(990));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 당일실현손익률(유가) =>" + axKHOpenAPI.GetChejanData(991));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 당일실현손익(신용)  =>" + axKHOpenAPI.GetChejanData(992));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 당일실현손익률(신용)  =>" + axKHOpenAPI.GetChejanData(993));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 담보대출수량  =>" + axKHOpenAPI.GetChejanData(959));



            TB_CHEJAN_BALANCE balance_Data = new TB_CHEJAN_BALANCE();
            String            dayTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            balance_Data.acct_num               = axKHOpenAPI.GetChejanData(9201).ToString().Trim();                    //[1]
            balance_Data.stock_cd               = axKHOpenAPI.GetChejanData(9001).ToString().Trim();                    //[2]
            balance_Data.curr_amt               = int.Parse(axKHOpenAPI.GetChejanData(10).ToString().Trim());           //[3]
            balance_Data.loan_dt                = axKHOpenAPI.GetChejanData(916).ToString().Trim();                     //[3]
            balance_Data.credit_gubun           = axKHOpenAPI.GetChejanData(917).ToString().Trim();                     //[3]
            balance_Data.possession_qty         = int.Parse(axKHOpenAPI.GetChejanData(930).ToString().Trim());          //[4]
            balance_Data.purchase_amt           = int.Parse(axKHOpenAPI.GetChejanData(931).ToString().Trim());          //[5]
            balance_Data.tot_purchase_amt       = int.Parse(axKHOpenAPI.GetChejanData(932).ToString().Trim());          //[6]
            balance_Data.order_possible_qty     = int.Parse(axKHOpenAPI.GetChejanData(933).ToString().Trim());          //[7]
            balance_Data.today_net_buy_qty      = int.Parse(axKHOpenAPI.GetChejanData(945).ToString().Trim());          //[8]
            balance_Data.order_type             = int.Parse(axKHOpenAPI.GetChejanData(946).ToString().Trim());          //[9]
            balance_Data.today_sell_profit_loss = int.Parse(axKHOpenAPI.GetChejanData(950).ToString().Trim());          //[10]
            balance_Data.deposit                = int.Parse(axKHOpenAPI.GetChejanData(951).ToString().Trim());          //[11]
            balance_Data.offered_amt            = int.Parse(axKHOpenAPI.GetChejanData(27).ToString().Trim());           //[12]
            balance_Data.bid_amt                = int.Parse(axKHOpenAPI.GetChejanData(28).ToString().Trim());           //[13]
            balance_Data.yesterday_amt          = int.Parse(axKHOpenAPI.GetChejanData(307).ToString().Trim());          //[14]
            balance_Data.profit_loss_rt         = float.Parse(axKHOpenAPI.GetChejanData(8019).ToString().Trim());       //[15]

            balance_Data.profit_loss_rt               = float.Parse(axKHOpenAPI.GetChejanData(8019).ToString().Trim()); //[15]
            balance_Data.credit_gubun                 = axKHOpenAPI.GetChejanData(917);                                 //[15]
            balance_Data.loan_dt                      = axKHOpenAPI.GetChejanData(916);                                 //[15]
            balance_Data.loan_qty                     = int.Parse(axKHOpenAPI.GetChejanData(959));                      //[15]
            balance_Data.credit_amt                   = int.Parse(axKHOpenAPI.GetChejanData(957));                      //[15]
            balance_Data.credit_interest              = float.Parse(axKHOpenAPI.GetChejanData(958));                    //[15]
            balance_Data.expiry_dt                    = axKHOpenAPI.GetChejanData(918);                                 //[15]
            balance_Data.today_profit_loss_amt        = int.Parse(axKHOpenAPI.GetChejanData(990));                      //[15]
            balance_Data.today_profit_loss_rt         = float.Parse(axKHOpenAPI.GetChejanData(991));                    //[15]
            balance_Data.credit_today_profit_loss_amt = int.Parse(axKHOpenAPI.GetChejanData(992));                      //[15]
            balance_Data.credit_today_profit_loss_rt  = float.Parse(axKHOpenAPI.GetChejanData(993));                    //[15]

            ChejanData chejanData = new ChejanData();

            chejanData.insertChejanBalance(balance_Data);
        }
Пример #8
0
        public override void ReceivedData(AxKHOpenAPI axKHOpenAPI, _DKHOpenAPIEvents_OnReceiveChejanDataEvent e)
        {
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 구분 : 잔고통보");
            //FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문/기록시간=>" + axKHOpenAPI.GetChejanData(908));
            //시간이 없음
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 계좌번호=>" + axKHOpenAPI.GetChejanData(9201));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 종목코드, 업종코드=>" + axKHOpenAPI.GetChejanData(9001));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 현재가, 체결가, 실시간종가=>" + axKHOpenAPI.GetChejanData(10));

            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 보유수량=>" + axKHOpenAPI.GetChejanData(930));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 매입단가=>" + axKHOpenAPI.GetChejanData(931));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 총매입가=>" + axKHOpenAPI.GetChejanData(932));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문가능수량=>" + axKHOpenAPI.GetChejanData(933));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 당일순매수량=>" + axKHOpenAPI.GetChejanData(945));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 매도 / 매수구분=>" + axKHOpenAPI.GetChejanData(946));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 당일 총 매도 손익=>" + axKHOpenAPI.GetChejanData(950));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 예수금=>" + axKHOpenAPI.GetChejanData(951));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData (최우선)매도호가=>" + axKHOpenAPI.GetChejanData(27));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData (최우선)매수호가=>" + axKHOpenAPI.GetChejanData(28));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 기준가=>" + axKHOpenAPI.GetChejanData(307));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 손익율=>" + axKHOpenAPI.GetChejanData(8019));
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주식옵션거래단위=>" + axKHOpenAPI.GetChejanData(397));


            Balance_Data balance_Data = new Balance_Data();
            String       dayTime      = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

            balance_Data.기록시간     = dayTime;                                                        //[0]
            balance_Data.계좌번호     = axKHOpenAPI.GetChejanData(9201).ToString().Trim();              //[1]
            balance_Data.종목코드     = axKHOpenAPI.GetChejanData(9001).ToString().Trim();              //[2]
            balance_Data.현재가      = int.Parse(axKHOpenAPI.GetChejanData(10).ToString().Trim());     //[3]
            balance_Data.보유수량     = int.Parse(axKHOpenAPI.GetChejanData(930).ToString().Trim());    //[4]
            balance_Data.매입단가     = int.Parse(axKHOpenAPI.GetChejanData(931).ToString().Trim());    //[5]
            balance_Data.총매입가     = int.Parse(axKHOpenAPI.GetChejanData(932).ToString().Trim());    //[6]
            balance_Data.주문가능수량   = int.Parse(axKHOpenAPI.GetChejanData(933).ToString().Trim());    //[7]
            balance_Data.당일순매수량   = int.Parse(axKHOpenAPI.GetChejanData(945).ToString().Trim());    //[8]
            balance_Data.매도수구분    = int.Parse(axKHOpenAPI.GetChejanData(946).ToString().Trim());    //[9]
            balance_Data.당일총매도손익  = int.Parse(axKHOpenAPI.GetChejanData(950).ToString().Trim());    //[10]
            balance_Data.예수금      = int.Parse(axKHOpenAPI.GetChejanData(951).ToString().Trim());    //[11]
            balance_Data.매도호가     = int.Parse(axKHOpenAPI.GetChejanData(27).ToString().Trim());     //[12]
            balance_Data.매수호가     = int.Parse(axKHOpenAPI.GetChejanData(28).ToString().Trim());     //[13]
            balance_Data.기준가      = int.Parse(axKHOpenAPI.GetChejanData(307).ToString().Trim());    //[14]
            balance_Data.손익율      = float.Parse(axKHOpenAPI.GetChejanData(8019).ToString().Trim()); //[15]
            balance_Data.주식옵션거래단위 = axKHOpenAPI.GetChejanData(397).ToString().Trim();               //[16]

            SendDirectFile(balance_Data);
            SendDirectDb(balance_Data);
        }
Пример #9
0
        private void API_OnReceiveChejanData(object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveChejanDataEvent e)
        {
            CoreEngine.GetInstance().SendLogMessage("API_OnReceiveChejanData");
            if (e.sGubun.Equals(ConstName.RECEIVE_CHEJAN_DATA_SUBMIT_OR_CONCLUSION))
            {
                CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_DATA_SUBMIT_OR_CONCLUSION");
                string orderState  = axKHOpenAPI1.GetChejanData(913).Trim();
                string outstanding = axKHOpenAPI1.GetChejanData(902).Trim();
                string orderType   = axKHOpenAPI1.GetChejanData(905).Replace("+", "").Replace("-", "").Trim();
                string ordernum    = axKHOpenAPI1.GetChejanData(9203).Trim();
                string itemCode    = axKHOpenAPI1.GetChejanData(9001).Replace("A", "");

                string conclusionPrice    = axKHOpenAPI1.GetChejanData(910).Trim();
                string conclusionQuantity = axKHOpenAPI1.GetChejanData(911).Trim();

                if (orderState.Equals(ConstName.RECEIVE_CHEJAN_DATA_SUBMIT))
                {
                    CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_DATA_SUBMIT");
                    if (orderType.Equals(ConstName.RECEIVE_CHEJAN_DATA_BUY))
                    {
                        CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_DATA_BUY : " + ordernum);
                        CoreEngine.GetInstance().SendLogWarningMessage("conclusionQuantity : " + conclusionQuantity);
                        if (tradingStrategy == null)
                        {
                            return;
                        }

                        List <TradingItem> tradeItemArray = tradingStrategy.tradingItemList.FindAll(o => o.itemCode.Equals(itemCode));
                        if (tradeItemArray.Count > 0)
                        {
                            foreach (var item in tradeItemArray)
                            {
                                if (Item != null && Item.itemCode == itemCode && string.IsNullOrEmpty(item.buyOrderNum) == false)
                                {
                                    Item.buyOrderNum = item.buyOrderNum;
                                }
                            }
                        }
                    }
                    else if (orderType.Equals(ConstName.RECEIVE_CHEJAN_DATA_SELL))
                    {
                        CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_DATA_SELL");
                    }
                    else if (orderType.Equals(ConstName.RECEIVE_CHEJAN_CANCEL_BUY_ORDER))
                    {
                        CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_CANCEL_BUY_ORDER");
                    }
                    else if (orderType.Equals(ConstName.RECEIVE_CHEJAN_CANCEL_SELL_ORDER))
                    {
                        CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_CANCEL_SELL_ORDER");
                    }
                }
                else if (orderState.Equals(ConstName.RECEIVE_CHEJAN_DATA_CONCLUSION))
                {
                    CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_DATA_CONCLUSION");
                    if (orderType.Contains(ConstName.RECEIVE_CHEJAN_DATA_BUY))
                    {
                        CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_DATA_BUY");
                        if (tradingStrategy == null)
                        {
                            return;
                        }
                        CoreEngine.GetInstance().SendLogWarningMessage("RECEIVE_CHEJAN_DATA_BUY ORDER NUM : " + ordernum);
                        CoreEngine.GetInstance().SendLogWarningMessage("conclusionQuantity : " + conclusionQuantity);

                        TradingItem tradeItem = tradingStrategy.tradingItemList.Find(o => o.buyOrderNum.Equals(ordernum));

                        if (tradeItem != null && string.IsNullOrEmpty(conclusionQuantity) == false)
                        {
                            if (Item != null)
                            {
                                CoreEngine.GetInstance().SendLogMessage(Item.curQnt + "/" + Item.buyQnt);

                                Item.curQnt      = long.Parse(conclusionQuantity);
                                Item.buyPrice    = tradeItem.buyingPrice;
                                Item.buyOrderNum = tradeItem.buyOrderNum;
                                if (Item.curQnt == Item.buyQnt)
                                {
                                    PushMartinGailItem(itemCode);
                                }
                            }
                        }
                        else
                        {
                            CoreEngine.GetInstance().SendLogWarningMessage("tradeItem is null ");
                        }
                    }
                    else if (orderType.Contains(ConstName.RECEIVE_CHEJAN_DATA_SELL))
                    {
                        if (tradingStrategy == null)
                        {
                            return;
                        }

                        TradingItem tradeItem = tradingStrategy.tradingItemList.Find(o => o.sellOrderNum.Equals(ordernum));
                        if (tradeItem != null && string.IsNullOrEmpty(outstanding) == false && string.IsNullOrEmpty(conclusionPrice) == false)
                        {
                            long buyingPrice = tradeItem.buyingPrice;
                            long sellPrice   = long.Parse(conclusionPrice.Replace("+", ""));

                            if (long.Parse(outstanding) == 0)
                            {
                                CoreEngine.GetInstance().SendLogMessage("Outstanding 0 : Profit : " + (sellPrice - buyingPrice) * tradeItem.buyingQnt);
                                TodayAllProfitAmount += (sellPrice - buyingPrice) * tradeItem.buyingQnt;
                                PopMartinGailItem((sellPrice - buyingPrice));
                            }
                            else
                            {
                                if (Item != null)
                                {
                                    Item.curQnt       = long.Parse(outstanding);
                                    Item.sellOrderNum = tradeItem.sellOrderNum;
                                }
                            }
                        }
                    }
                }
                else if (orderState.Equals(ConstName.RECEIVE_CHEJAN_DATA_OK))
                {
                    CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_DATA_OK");
                    if (orderType.Contains(ConstName.RECEIVE_CHEJAN_CANCEL_BUY_ORDER))
                    {
                        CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_CANCEL_BUY_ORDER");
                        if (int.Parse(outstanding) == 0)
                        {
                            if (Item != null)
                            {
                                PopMartinGailItem(0);
                            }
                        }
                    }
                    else if (orderType.Contains(ConstName.RECEIVE_CHEJAN_CANCEL_SELL_ORDER))
                    {
                        CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_CANCEL_SELL_ORDER");
                        if (int.Parse(outstanding) == 0)
                        {
                            if (Item != null)
                            {
                                PopMartinGailItem(0);
                            }
                        }
                    }
                }
            }
            else if (e.sGubun.Equals(ConstName.RECEIVE_CHEJAN_DATA_BALANCE))
            {
            }
        }
Пример #10
0
        private void API_OnReceiveChejanData(object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveChejanDataEvent e)
        {
            CoreEngine.GetInstance().SendLogMessage("API_OnReceiveChejanData");
            if (e.sGubun.Equals(ConstName.RECEIVE_CHEJAN_DATA_SUBMIT_OR_CONCLUSION))
            {
                CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_DATA_SUBMIT_OR_CONCLUSION");
                string orderState    = axKHOpenAPI1.GetChejanData(913).Trim();
                string orderQuantity = axKHOpenAPI1.GetChejanData(900).Trim();
                string outstanding   = axKHOpenAPI1.GetChejanData(902).Trim();
                string orderType     = axKHOpenAPI1.GetChejanData(905).Replace("+", "").Replace("-", "").Trim();
                string ordernum      = axKHOpenAPI1.GetChejanData(9203).Trim();
                string itemCode      = axKHOpenAPI1.GetChejanData(9001).Replace("A", "");

                string conclusionPrice    = axKHOpenAPI1.GetChejanData(910).Trim();
                string conclusionQuantity = axKHOpenAPI1.GetChejanData(911).Trim();

                if (orderState.Equals(ConstName.RECEIVE_CHEJAN_DATA_SUBMIT))
                {
                    CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_DATA_SUBMIT");
                    if (orderType.Equals(ConstName.RECEIVE_CHEJAN_DATA_BUY))
                    {
                        CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_DATA_BUY : " + ordernum);
                        CoreEngine.GetInstance().SendLogWarningMessage("conclusionQuantity : " + conclusionQuantity);
                    }
                    else if (orderType.Equals(ConstName.RECEIVE_CHEJAN_DATA_SELL))
                    {
                        CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_DATA_SELL");
                    }
                    else if (orderType.Equals(ConstName.RECEIVE_CHEJAN_CANCEL_BUY_ORDER))
                    {
                        CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_CANCEL_BUY_ORDER");
                    }
                    else if (orderType.Equals(ConstName.RECEIVE_CHEJAN_CANCEL_SELL_ORDER))
                    {
                        CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_CANCEL_SELL_ORDER");
                    }
                }
                else if (orderState.Equals(ConstName.RECEIVE_CHEJAN_DATA_CONCLUSION))
                {
                    CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_DATA_CONCLUSION");
                    if (orderType.Contains(ConstName.RECEIVE_CHEJAN_DATA_BUY))
                    {
                        CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_DATA_BUY");

                        CoreEngine.GetInstance().SendLogWarningMessage("RECEIVE_CHEJAN_DATA_BUY ORDER NUM : " + ordernum);
                        CoreEngine.GetInstance().SendLogWarningMessage("conclusionQuantity : " + conclusionQuantity);
                    }
                    else if (orderType.Contains(ConstName.RECEIVE_CHEJAN_DATA_SELL))
                    {
                    }
                }
                else if (orderState.Equals(ConstName.RECEIVE_CHEJAN_DATA_OK))
                {
                    CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_DATA_OK");
                    if (orderType.Contains(ConstName.RECEIVE_CHEJAN_CANCEL_BUY_ORDER))
                    {
                        CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_CANCEL_BUY_ORDER");
                        if (int.Parse(outstanding) == 0)
                        {
                        }
                    }
                    else if (orderType.Contains(ConstName.RECEIVE_CHEJAN_CANCEL_SELL_ORDER))
                    {
                        CoreEngine.GetInstance().SendLogMessage("RECEIVE_CHEJAN_CANCEL_SELL_ORDER");
                        if (int.Parse(outstanding) == 0)
                        {
                        }
                    }
                }
            }
            else if (e.sGubun.Equals(ConstName.RECEIVE_CHEJAN_DATA_BALANCE))
            {
            }
        }
Пример #11
0
        public override void ReceivedData(AxKHOpenAPI axKHOpenAPI, _DKHOpenAPIEvents_OnReceiveChejanDataEvent e)
        {
            /*주문체결
             * 9201 계좌번호
             * 9203 주문번호
             * 9205 관리자사번
             * 9001 종목코드, 업종코드
             * 912 주문업무분류(JJ: 주식주문, FJ: 선물옵션, JG: 주식잔고, FG: 선물옵션잔고)
             * 913 주문상태(10:원주문, 11:정정주문, 12:취소주문, 20:주문확인, 21:정정확인, 22:취소확인, 90 - 92:주문거부)
             * 302 종목명
             * 900 주문수량
             * 901 주문가격
             * 902 미체결수량
             * 903 체결누계금액
             * 904 원주문번호
             * 905 주문구분(+현금내수, -현금매도…)
             * 906 매매구분(보통, 시장가…)
             * 907 매도수구분(1:매도, 2:매수)
             * 908 주문 / 체결시간(HHMMSSMS)
             * 909 체결번호
             * 910 체결가
             * 911 체결량
             * 10 현재가, 체결가, 실시간종가
             * 27(최우선)매도호가
             * 28(최우선)매수호가
             * 914 단위체결가
             * 915 단위체결량
             * 938 당일매매 수수료
             * 939 당일매매세금
             */
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 구분 : 주문접수--통보");
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문/체결시간=>" + axKHOpenAPI.GetChejanData(908));             //[0]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 계좌번호=>" + axKHOpenAPI.GetChejanData(9201));               //[1]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문번호=>" + axKHOpenAPI.GetChejanData(9203));               //[2]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 관리자사번=>" + axKHOpenAPI.GetChejanData(9205));              //[3]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 종목코드, 업종코드=>" + axKHOpenAPI.GetChejanData(9001));         //[4]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문업무분류=>" + axKHOpenAPI.GetChejanData(912));              //[5]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문상태=>" + axKHOpenAPI.GetChejanData(913));                //[6]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 종목명=>" + axKHOpenAPI.GetChejanData(302));                 //[7]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문수량=>" + axKHOpenAPI.GetChejanData(900));                //[8]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문가격=>" + axKHOpenAPI.GetChejanData(901));                //[9]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 미체결수량=>" + axKHOpenAPI.GetChejanData(902));               //[10]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 체결누계금액=>" + axKHOpenAPI.GetChejanData(903));              //[11]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 원주문번호=>" + axKHOpenAPI.GetChejanData(904));               //[12]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문구분(+현금내수, -현금매도…)=>" + axKHOpenAPI.GetChejanData(905)); //[13]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 매매구분(보통, 시장가…)=>" + axKHOpenAPI.GetChejanData(906));      //[14]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 매도수구분(1:매도, 2:매수)" + axKHOpenAPI.GetChejanData(907));     //[15]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 체결번호" + axKHOpenAPI.GetChejanData(909));                  //[16]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 체결가=>" + axKHOpenAPI.GetChejanData(910));                 //[17]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 체결량=>" + axKHOpenAPI.GetChejanData(911));                 //[18]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 현재가, 체결가, 실시간종가=>" + axKHOpenAPI.GetChejanData(10));      //[19]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData (최우선)매도호가=>" + axKHOpenAPI.GetChejanData(27));            //[20]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData (최우선)매수호가=>" + axKHOpenAPI.GetChejanData(28));            //[21]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 단위체결가=>" + axKHOpenAPI.GetChejanData(914));               //[22]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 단위체결량=>" + axKHOpenAPI.GetChejanData(915));               //[23]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 당일매매 수수료=>" + axKHOpenAPI.GetChejanData(938));            //[24]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 당일매매세금=>" + axKHOpenAPI.GetChejanData(939));              //[25]

            /*카페 정보아래는 확인이 필요*/
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 화면번호=>" + axKHOpenAPI.GetChejanData(920));  //[26]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 터미널번호=>" + axKHOpenAPI.GetChejanData(921)); //[27]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 신용구분=>" + axKHOpenAPI.GetChejanData(922));  //[28]
            FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 대출일=>" + axKHOpenAPI.GetChejanData(923));   //[29]


            /*추가적인 기록--주문에서 아래 데이터가 나오나 ??*/

            /* 안나온다.
             * FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 거부사유=>" + axKHOpenAPI.GetChejanData(919));   //[29]
             * FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 보유수량=>" + axKHOpenAPI.GetChejanData(930));   //[29]
             * FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 매입단가=>" + axKHOpenAPI.GetChejanData(931));   //[29]
             * FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 총매입가=>" + axKHOpenAPI.GetChejanData(932));   //[29]
             * FileLog.PrintF("axKHOpenAPI_OnReceiveChejanData 주문가능수량=>" + axKHOpenAPI.GetChejanData(933));   //[29]
             */



            TB_CHEJAN_ORDER order_Data = new TB_CHEJAN_ORDER();

            order_Data.curr_time = axKHOpenAPI.GetChejanData(908).ToString().Trim();
            order_Data.acct_num  = axKHOpenAPI.GetChejanData(9201).ToString().Trim();                    //[1]
            order_Data.order_num = axKHOpenAPI.GetChejanData(9203).ToString().Trim();                    //[2]
            order_Data.stock_cd  = axKHOpenAPI.GetChejanData(9001).ToString().Trim();                    //[4]
            order_Data.order_business_classification = axKHOpenAPI.GetChejanData(912).ToString().Trim(); //[5]
            order_Data.order_status     = axKHOpenAPI.GetChejanData(913).ToString().Trim();              //[6]
            order_Data.order_qty        = int.Parse(axKHOpenAPI.GetChejanData(900).ToString().Trim());   //[8]
            order_Data.order_amt        = int.Parse(axKHOpenAPI.GetChejanData(901).ToString().Trim());   //[9]
            order_Data.not_contract_qty = int.Parse(axKHOpenAPI.GetChejanData(902).ToString().Trim());   //[10]
            order_Data.contract_tot_amt = int.Parse(axKHOpenAPI.GetChejanData(903).ToString().Trim());   //[11]
            order_Data.ongn_order_num   = axKHOpenAPI.GetChejanData(904).ToString().Trim();              //[12]
            order_Data.order_gubun      = axKHOpenAPI.GetChejanData(905).ToString().Trim();              //[13]
            order_Data.trade_gubun      = axKHOpenAPI.GetChejanData(906).ToString().Trim();              //[14]
            order_Data.order_type       = int.Parse(axKHOpenAPI.GetChejanData(907).ToString().Trim());   //[15]
            order_Data.contract_num     = axKHOpenAPI.GetChejanData(909).ToString().Trim();              //[16]
            String str체결가 = axKHOpenAPI.GetChejanData(910).ToString().Trim();                            //[17]

            order_Data.contract_amt = 0;
            if (!str체결가.Equals(""))
            {
                order_Data.contract_amt = int.Parse(str체결가);
            }
            String str체결량 = axKHOpenAPI.GetChejanData(911).ToString().Trim();//[18]

            order_Data.contract_qty = 0;
            if (!str체결량.Equals(""))
            {
                order_Data.contract_qty = int.Parse(str체결량);
            }
            order_Data.curr_amt    = int.Parse(axKHOpenAPI.GetChejanData(10).ToString().Trim()); //[19]
            order_Data.offered_amt = int.Parse(axKHOpenAPI.GetChejanData(27).ToString().Trim()); //[20]
            order_Data.bid_amt     = int.Parse(axKHOpenAPI.GetChejanData(28).ToString().Trim()); //[21]

            String str단위체결가 = axKHOpenAPI.GetChejanData(914).ToString().Trim();                  //[22]

            order_Data.contract_amt_unit = 0;
            if (!str단위체결가.Equals(""))
            {
                order_Data.contract_amt_unit = int.Parse(str단위체결가);
            }
            String str단위체결량 = axKHOpenAPI.GetChejanData(915).ToString().Trim(); //[23]

            order_Data.contract_amt_qty = 0;
            if (!str단위체결량.Equals(""))
            {
                order_Data.contract_amt_qty = int.Parse(str단위체결량);
            }
            order_Data.today_commission = int.Parse(axKHOpenAPI.GetChejanData(938).ToString().Trim()); //[24]
            order_Data.today_tax        = int.Parse(axKHOpenAPI.GetChejanData(939).ToString().Trim()); //[25]

            order_Data.screen_num   = axKHOpenAPI.GetChejanData(920).ToString().Trim();                //[25]
            order_Data.terminal_num = axKHOpenAPI.GetChejanData(921).ToString().Trim();                //[25]
            order_Data.credit_gubun = axKHOpenAPI.GetChejanData(922).ToString().Trim();                //[25]
            order_Data.loan_dt      = axKHOpenAPI.GetChejanData(923).ToString().Trim();                //[25]

            ChejanData chejanData = new ChejanData();

            chejanData.insertChejanOrder(order_Data);
        }