Exemple #1
0
        public override void ReceivedData(AxKHOpenAPILib.AxKHOpenAPI axKHOpenAPI, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e)
        {
           FileLog.PrintF("ReceivedData OPW00003");
           try {
                StringBuilder sbAll = new StringBuilder();
                StringBuilder sb = new StringBuilder();


                String 조회일자 = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                /*추정예탁자산*/
                sb.Append("{0}|{1}|{2}");
                String tmp = sb.ToString();
                String 계좌번호 = "XXXXXXXXXX";
                //int nCnt = axKHOpenAPI.GetRepeatCnt(e.sTrCode, e.sRQName);
                String keyStockCodeLayout = "sRQName:{0}|sTrCode:{1}|sScreenNo:{2}";
                String keyStockCode = String.Format(keyStockCodeLayout
                    , e.sRQName
                    , e.sTrCode
                    , e.sScrNo
                );
                계좌번호 = AppLib.getClass1Instance().getStockCode(keyStockCode);
                String keyLayout = "sRQName:{0}|sTrCode:{1}|sScreenNo:{2}|accountNum:{3}";
                String key = String.Format(keyLayout
                    , e.sRQName
                    , e.sTrCode
                    , e.sScrNo
                    , 계좌번호
                );
    //            int nCnt = axKHOpenAPI.GetRepeatCnt(e.sTrCode, e.sRQName);  이거 무조건 0이다.
                String 추정예탁자산 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "추정예탁자산").Trim();//[0]
                String tmp1 = String.Format(tmp
                , 조회일자
                , 계좌번호
                , 추정예탁자산
                );
                sbAll.AppendLine(tmp1);
                String ret = sbAll.ToString();
                FileLog.PrintF("ReceivedData OPW00003 ret=>" + ret);
                ScreenNumber.getClass1Instance().DisconnectRealData(e.sScrNo);
                //this.SetRealRemove(axKHOpenAPI, "ALL", "ALL");
                AppLib.getClass1Instance().removeStockCodeDictionary(keyStockCode);
                AppLib.getClass1Instance().removeSpellDictionary(key);
                Send(key, ret, "OPW00003");
            } catch (Exception ex)
           {
               FileLog.PrintF("[ALERT-ReceivedData-OPW00003]Exception ex=" + ex.Message);
            
           }
        }
Exemple #2
0
        public override void ReceivedData(AxKHOpenAPILib.AxKHOpenAPI axKHOpenAPI, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e)
        {

            /*
       sScrNo – 화면번호
       sRQName – 사용자구분 명
       sTrCode – Tran 명
       sRecordName – Record 명
       sPreNext – 연속조회 유무
       */
            FileLog.PrintF("ReceivedData OPT10081");
            try
            {
                StringBuilder sbAll = new StringBuilder();
                StringBuilder sb = new StringBuilder();
                //sb.Append("일자:{0}|종목코드:{1}|현재가:{2}|거래량:{3}|거래대금:{4}|시가:{5}|고가:{6}|저가:{7}");
                //sb.Append("stock_date:{0}|stock_code:{1}|current_price:{2}|trade_quantity:{3}|trade_price:{4}|start_price:{5}|high_price:{6}|low_price:{7}");
                sb.Append("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}");
                String tmp = sb.ToString();
                String 종목코드="XXXX";
                int nCnt = axKHOpenAPI.GetRepeatCnt(e.sTrCode, e.sRQName);
            
                String keyStockCodeLayout = "sRQName:{0}|sTrCode:{1}|sScreenNo:{2}";
                String keyStockCode = String.Format(keyStockCodeLayout
                    , e.sRQName
                    , e.sTrCode
                    , e.sScrNo
                );
                종목코드 = AppLib.getClass1Instance().getStockCode(keyStockCode);

                String keyLayout = "sRQName:{0}|sTrCode:{1}|sScreenNo:{2}|stockCode:{3}";
                String key = String.Format(keyLayout
                    , e.sRQName
                    , e.sTrCode
                    , e.sScrNo
                    , 종목코드
                );

                FileLog.PrintF("keyStockCode1  ==" + keyStockCode);
                FileLog.PrintF("key1  ==" + key);

                spell = AppLib.getClass1Instance().getSpell(key).ShallowCopy();
                String startDate = spell.startDate;
                FileLog.PrintF("startDate  ==" + startDate);

                String lastStockDate = "";
                int startDate일자 = 0;
                if (!int.TryParse(startDate, out startDate일자))
                {
                    startDate일자 = 0;
                }

                if (nCnt > 0)
                {
                    for (int i = 0; i < nCnt; i++)
                    {
                        /*
                        if (i == 0) {
                            종목코드1 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "종목코드").Trim();
                        }
                        */

                    

                        String 종목코드1 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "종목코드").Trim();
                    
                        if (종목코드1 == null || 종목코드1.Trim().Equals(""))
                        {
                            종목코드1 = 종목코드;
                        }
                        // FileLog.PrintF("거래대금  ==" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "거래대금").Trim());

                        int 현재가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "현재가").Trim());
                        int 거래량 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "거래량").Trim());
                        int 거래대금 = 0;  //이게 INF 로 나올때가 있다.. 주식코드는 013900 두원중공업
                        if(!Int32.TryParse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "거래대금").Trim(),out 거래대금) )
                        {
                            거래대금 = 0;
                        }
                        int 일자 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "일자").Trim());
                        int 시가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "시가").Trim());
                        int 고가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "고가").Trim());
                        int 저가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "저가").Trim());
                        //              int 수정주가구분 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "수정주가구분").Trim());
                        //              int 수정비율 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "수정비율").Trim());
                        //              int 대업종구분 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "대업종구분").Trim());
                        //              int 소업종구분 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "소업종구분").Trim());
                        //              int 종목정보 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "종목정보").Trim());
                        //              int 수정주가이벤트 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "수정주가이벤트").Trim());
                        //             int 전일종가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "전일종가").Trim());

                        String tmp1 = String.Format(tmp
                            , 일자
                            , 종목코드
                            , 현재가
                            , 거래량
                            , 거래대금
                            , 시가
                            , 고가
                            , 저가
                        );
                        lastStockDate = 일자.ToString();

                        if (startDate != null)
                        {
                            if (startDate.Equals("ZERO") || startDate.Equals("TWO"))
                            {
                                sbAll.AppendLine(tmp1);
                            }
                            else
                            {
                                if (일자 >= startDate일자)
                                {
                                    sbAll.AppendLine(tmp1);
                                } else
                                {
                                    break;
                                }
                            }
                        }
                        else
                        {
                            sbAll.AppendLine(tmp1);
                        }
                    }
                } else
                {
                    종목코드 = "00000";
                }

                int prevNext = 0;
                if (!int.TryParse(e.sPrevNext, out prevNext))
                {
                    prevNext = 0;
                }
                ScreenNumber.getClass1Instance().DisconnectRealData(e.sScrNo);
                ScreenNumber.getClass1Instance().SetRealRemove("ALL", "ALL");
                putReceivedQueueAndsetNextSpell(key,sbAll.ToString(), prevNext, lastStockDate);
            }
            catch (Exception ex)
            {
                FileLog.PrintF("[ALERT-ReceivedData-OPT10081]Exception ex=" + ex.Message);
            }
        }  
Exemple #3
0
        public override void ReceivedData(AxKHOpenAPILib.AxKHOpenAPI axKHOpenAPI, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e)
        {
            /*
            sScrNo – 화면번호
            sRQName – 사용자구분 명
            sTrCode – Tran 명
            sRecordName – Record 명
            sPreNext – 연속조회 유무
            */

            String stockDate = DateTime.Today.ToString("yyyyMMdd");
            

            StringBuilder sbAll = new StringBuilder();
            StringBuilder sb = new StringBuilder();
            String 계좌명 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "계좌명").Trim();  //account_name
            String 지점명 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "지점명").Trim();  //place_name
            int 예수금= Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "예수금").Trim());   //deposit
            int D2추정예수금 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "D+2추정예수금").Trim()); //twodays_after_deposit
            int 유가잔고평가액 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "유가잔고평가액").Trim()); //stock_evaluation,
            int 예탁자산평가액 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "예탁자산평가액").Trim()); //:stock_balance_evaluation,
            int 총매입금액 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "총매입금액").Trim()); //:total_amount_of_purchase,
            int 추정예탁자산 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "추정예탁자산").Trim()); //:estimation_deposit
            int 매도담보대출금 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "매도담보대출금").Trim()); //stock_collacteral_loan,
            int 당일투자원금 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "당일투자원금").Trim()); //:today_investment_money,
            int 당월투자원금 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "당월투자원금").Trim()); //:this_month_investment_money,
            int 누적투자원금 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "누적투자원금").Trim()); //:accumulative_investment_money,
            int 당일투자손익 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "당일투자손익").Trim()); //:today_profit_and_loss,
            int 당월투자손익 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "당월투자손익").Trim()); //:today_profit_and_loss,
            int 누적투자손익 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "누적투자손익").Trim()); //:today_profit_and_loss,
            int 당일손익율 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "당일손익율").Trim());   //:today_profit_and_loss_rate
            int 당월손익율 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "당월손익율").Trim()); //:this_month_profit_and_loss_rate
            int 누적손익율 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "누적손익율").Trim());  //:accumulative_profit_and_loss_rate
            int 출력건수 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "출력건수").Trim()); //:accumulative_profit_and_loss_rate
            sb.Append("날짜:{0}|계좌명:{1}|지점명:{2}|예수금:{3}|D+2추정예수금:{4}|유가잔고평가액:{5}|예탁자산평가액:{6}|총매입금액:{7}|추정예탁자산:{8}");
            sb.Append("|매도담보대출금:{9}|당일투자원금:{10}|당월투자원금:{11}|누적투자원금:{12}|당일투자손익:{13}|당월투자손익:{14}|누적투자손익:{15}");
            sb.Append("|당일손익율:{16}|당월손익율:{17}|누적손익율:{18}|출력건수:{19}");
            String tmp = sb.ToString();
            String tmp1=String.Format(tmp
                , stockDate
                , 계좌명
                , 지점명
                , 예수금
                , D2추정예수금
                , 유가잔고평가액
                , 예탁자산평가액
                , 총매입금액
                , 추정예탁자산
                , 매도담보대출금
                , 당일투자원금
                , 당월투자원금
                , 누적투자원금
                , 당일투자손익
                , 당월투자손익
                , 누적투자손익
                , 당일손익율
                , 당월손익율
                , 누적손익율
                , 출력건수
            );
            sbAll.AppendLine(tmp1);
            
            int nCnt = axKHOpenAPI.GetRepeatCnt(e.sTrCode, e.sRQName); 
            for(int i = 1; i < nCnt; i++)
            {
                String 계좌명1 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "계좌명").Trim();
                String 지점명1 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "지점명").Trim(); 
                int 예수금1 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "예수금").Trim()); 
                int D2추정예수금1 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "D+2추정예수금").Trim()); 
                int 유가잔고평가액1 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "유가잔고평가액").Trim()); 
                int 예탁자산평가액1 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "예탁자산평가액").Trim()); 
                int 총매입금액1 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "총매입금액").Trim()); 
                int 추정예탁자산1 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "추정예탁자산").Trim()); 
                int 매도담보대출금1 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "매도담보대출금").Trim()); 
                int 당일투자원금1 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "당일투자원금").Trim()); 
                int 당월투자원금1 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "당월투자원금").Trim()); 
                int 누적투자원금1 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "누적투자원금").Trim()); 
                int 당일투자손익1 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "당일투자손익").Trim()); 
                int 당월투자손익1 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "당월투자손익").Trim()); 
                int 누적투자손익1 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "누적투자손익").Trim()); 
                int 당일손익율1 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "당일손익율").Trim());
                int 당월손익율1 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, 0, "당월손익율").Trim());
                int 누적손익율1 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "누적손익율").Trim()); 
                int 출력건수1 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "출력건수").Trim());

                tmp1=String.Format(tmp
                    , stockDate
                    , 계좌명1
                    , 지점명1
                    , 예수금1
                    , D2추정예수금1
                    , 유가잔고평가액1
                    , 예탁자산평가액1
                    , 총매입금액1
                    , 추정예탁자산1
                    , 매도담보대출금1
                    , 당일투자원금1
                    , 당월투자원금1
                    , 누적투자원금1
                    , 당일투자손익1
                    , 당월투자손익1
                    , 누적투자손익1
                    , 당일손익율1
                    , 당월손익율1
                    , 누적손익율1
                    , 출력건수1
                );
                sbAll.AppendLine(tmp1);
            }
            
            path = System.IO.Path.GetDirectoryName(path);
            path = path + "\\OPW00004_"+stockDate+".log";
            System.IO.StreamWriter file = new System.IO.StreamWriter(path, false);
            file.Write(sbAll.ToString());
            file.Close();
        }
Exemple #4
0
        public override void ReceivedData(AxKHOpenAPILib.AxKHOpenAPI axKHOpenAPI, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e)
        {
            FileLog.PrintF("ReceivedData OPT10059");
            try
            {
                /*
                sScrNo – 화면번호
                sRQName – 사용자구분 명
                sTrCode – Tran 명
                sRecordName – Record 명
                sPreNext – 연속조회 유무
                */
                StringBuilder sbAll = new StringBuilder();
                StringBuilder sb = new StringBuilder();
                //sb.Append("일자:{0}|종목코드:{1}|현재가:{2}|거래량:{3}|거래대금:{4}|시가:{5}|고가:{6}|저가:{7}");
                //sb.Append("stock_date:{0}|current_price:{1}|current_price:{2}|trade_quantity:{3}|trade_price:{4}|start_price:{5}|high_price:{6}|low_price:{7}");

                /*일자 ,현재가,대비기호,전일대비,등락율,누적거래대금,개인투자자,외국인투자자,기관계,금융투자,보험,투신,기타금융,은행,연기금등,사모펀드,국가,기타법인,내외국인,종목코드,매매구분,금액수량구분*/
                sb.Append("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}|{12}|{13}|{14}|{15}|{16}|{17}|{18}|{19}|{20}|{21}");
                String tmp = sb.ToString();
                String 종목코드 = "XXXX";
                int nCnt = axKHOpenAPI.GetRepeatCnt(e.sTrCode, e.sRQName);

                String keyStockCodeLayout = "sRQName:{0}|sTrCode:{1}|sScreenNo:{2}";
                String keyStockCode = String.Format(keyStockCodeLayout
                    , e.sRQName
                    , e.sTrCode
                    , e.sScrNo
                );
                종목코드 = AppLib.getClass1Instance().getStockCode(keyStockCode);

                String keyLayout = "sRQName:{0}|sTrCode:{1}|sScreenNo:{2}|stockCode:{3}";
                String key = String.Format(keyLayout
                    , e.sRQName
                    , e.sTrCode
                    , e.sScrNo
                    , 종목코드
                );
            
                spell = AppLib.getClass1Instance().getSpell(key);
                String startDate = spell.startDate;

                String lastStockDate = "";
                int startDate일자 = 0;
                if (!int.TryParse(startDate, out startDate일자))
                {
                    startDate일자 = 0;
                }

                if (nCnt > 0)
                {
                    for (int i = 0; i < nCnt; i++)
                    {                   
                        int 일자 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "일자").Trim());//[0]
                        int 현재가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "현재가").Trim());//[1]
                        float 대비기호 = 0;//[2]

                        if(!float.TryParse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "대비기호").Trim(),out 대비기호))
                        {
                        }
                    
                        int 전일대비 = 0;//[3]
                        if (!Int32.TryParse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "전일대비").Trim(), out 전일대비))
                        {
                            전일대비 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "전일대비").Trim().Replace("--", "-"));
                        }
                        float 등락율 = 0;//[4]

                        if (!float.TryParse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "등락율").Trim(), out 등락율))
                        {
                            등락율 = float.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "등락율").Trim());
                        }
                    
                        int 누적거래대금 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "누적거래대금").Trim());//[5
                        int 개인투자자 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "개인투자자").Trim());//[6]
                        int 외국인투자자 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "외국인투자자").Trim());//[7]
                        int 기관계 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "기관계").Trim());//[8]
                        int 금융투자 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "금융투자").Trim());//[9]
                        int 보험 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "보험").Trim());//[10]
                        int 투신 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "투신").Trim());//[11]
                        int 기타금융 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "기타금융").Trim());//[12]
                        int 은행 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "은행").Trim());//[13]
                        int 연기금등 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "연기금등").Trim());//[14]
                        int 사모펀드 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "사모펀드").Trim());//[15]
                        int 국가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "국가").Trim());//[16]
                        int 기타법인 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "기타법인").Trim());//[17]
                        int 내외국인 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "내외국인").Trim());//[18]

                        String tmp1 = String.Format(tmp,
                            일자 ,
                            현재가,
                            대비기호,
                            전일대비,
                            등락율,
                            누적거래대금,
                            개인투자자,
                            외국인투자자,
                            기관계,
                            금융투자,
                            보험,
                            투신,
                            기타금융,
                            은행,
                            연기금등,
                            사모펀드,
                            국가,
                            기타법인,
                            내외국인,
                            종목코드,
                            spell.buyOrSell,
                            spell.priceOrAmount
                        );
                        lastStockDate = 일자.ToString();
                        if (startDate != null)
                        {
                            if (startDate.Equals("ZERO") || startDate.Equals("TWO"))
                            {
                                sbAll.AppendLine(tmp1);
                            }
                            else
                            {
                                if (일자 >= startDate일자)
                                {
                                    sbAll.AppendLine(tmp1);
                                } else
                                {
                                    break;
                                }
                            }
                        }
                        else
                        {
                            sbAll.AppendLine(tmp1);
                        }
                    }
                }
                else
                {
                    종목코드 = "00000";
                }

                int prevNext = 0;
                if (!int.TryParse(e.sPrevNext, out prevNext))
                {
                    prevNext = 0;
                }

                ScreenNumber.getClass1Instance().DisconnectRealData( e.sScrNo);
                ScreenNumber.getClass1Instance().SetRealRemove( "ALL", "ALL");

                putReceivedQueueAndsetNextSpell(key,sbAll.ToString(), prevNext, lastStockDate);
            }
            catch (Exception ex)
            {
                FileLog.PrintF("[ALERT-ReceivedData-OPT10059]Exception ex=" + ex.Message);
            }
        }
Exemple #5
0
        public override void ReceivedData(AxKHOpenAPILib.AxKHOpenAPI axKHOpenAPI, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e)
        {

            /*
       sScrNo – 화면번호
       sRQName – 사용자구분 명
       sTrCode – Tran 명
       sRecordName – Record 명
       sPreNext – 연속조회 유무
       */
            FileLog.PrintF("ReceivedData OPT10080");
            try
            {
                StringBuilder sbAll = new StringBuilder();
                StringBuilder sb = new StringBuilder();
                //sb.Append("일자:{0}|종목코드:{1}|현재가:{2}|거래량:{3}|거래대금:{4}|시가:{5}|고가:{6}|저가:{7}");
                //sb.Append("stock_date:{0}|stock_code:{1}|current_price:{2}|trade_quantity:{3}|trade_price:{4}|start_price:{5}|high_price:{6}|low_price:{7}");
                sb.Append("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}|{12}|{13}");
                String tmp = sb.ToString();
                String 종목코드="XXXX";
                int nCnt = axKHOpenAPI.GetRepeatCnt(e.sTrCode, e.sRQName);
            
                String keyStockCodeLayout = "sRQName:{0}|sTrCode:{1}|sScreenNo:{2}";
                String keyStockCode = String.Format(keyStockCodeLayout
                    , e.sRQName
                    , e.sTrCode
                    , e.sScrNo
                );
                종목코드 = AppLib.getClass1Instance().getStockCode(keyStockCode);

                String keyLayout = "sRQName:{0}|sTrCode:{1}|sScreenNo:{2}|stockCode:{3}";
                String key = String.Format(keyLayout
                    , e.sRQName
                    , e.sTrCode
                    , e.sScrNo
                    , 종목코드
                );
            
                spell = AppLib.getClass1Instance().getSpell(key).ShallowCopy();
                String startDate = spell.startDate;
                String lastStockDate = "";
                long startDate일자 = 0;
                //시분초를 더함
                if (!long.TryParse(startDate+"000000", out startDate일자))
                {
                    startDate일자 = 0;
                }

                if (nCnt > 0)
                {
                    String 종목코드1 = "";
                    for (int i = 0; i < nCnt; i++)
                    {
                        if (i == 0)
                        {
                            종목코드1 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "종목코드").Trim();           //[0] 싱글 -첫번째에만 나타남
                        }
                    
                        int 현재가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "현재가").Trim());      //[1]
                        int 거래량 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "거래량").Trim());      //[2]
                        String 체결시간 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "체결시간").Trim();              //[3]
                        int 시가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "시가").Trim());            //[4]
                        int 고가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "고가").Trim());            //[5]
                        int 저가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "저가").Trim());            //[6]
                        int 수정주가구분 = 0;
                        if (axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "수정주가구분") !=null && !axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "수정주가구분").ToString().Trim().Equals("")){
                            수정주가구분 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "수정주가구분").Trim());    //[7]
                        }
                        float 수정비율 = 0;
                        if (axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "수정비율") != null && !axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "수정비율").ToString().Trim().Equals("")){
                            수정비율 = float.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "수정비율").Trim());            //[8]
                        }
                        int 대업종구분 = 0;
                        if (axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "대업종구분") != null && !axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "대업종구분").ToString().Trim().Equals("")){
                            대업종구분 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "대업종구분").Trim());        //[9]
                        }
                        int 소업종구분 = 0;
                        if (axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "소업종구분") != null && !axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "소업종구분").ToString().Trim().Equals(""))
                        {
                            소업종구분 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "소업종구분").Trim());        //[10]
                        }
                        int 종목정보 = 0;
                        if (axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "종목정보") != null && !axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "종목정보").ToString().Trim().Equals(""))
                        {
                            종목정보 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "종목정보").Trim());            //[11]
                        }
                        int 수정주가이벤트 = 0;
                        if (axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "수정주가이벤트") != null && !axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "수정주가이벤트").ToString().Trim().Equals(""))
                        {
                            수정주가이벤트 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "수정주가이벤트").Trim());//[12]
                        }
                        int 전일종가 = 0;
                        if (axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "전일종가") != null && !axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "전일종가").ToString().Trim().Equals(""))
                        {
                            전일종가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "전일종가").Trim());            //[13]
                        }
    
                        String tmp1 = String.Format(tmp
                            , 종목코드1
                            , 현재가
                            , 거래량
                            , 체결시간
                            , 시가
                            , 고가
                            , 저가
                            , 수정주가구분
                            , 수정비율
                            , 대업종구분
                            , 소업종구분
                            , 종목정보
                            , 수정주가이벤트
                            , 전일종가
                        );
                        //String str일자 = 체결시간.Substring(0, 8);
                        long 일자 = long.Parse(체결시간);
                        lastStockDate = 체결시간;

                        if (startDate != null)
                        {
                            if (startDate.Equals("ZERO") || startDate.Equals("TWO"))
                            {
                                sbAll.AppendLine(tmp1);
                            }
                            else
                            {
                                if (일자 >= startDate일자)
                                {
                                    sbAll.AppendLine(tmp1);
                                } else
                                {
                                    break;
                                }
                            }
                        }
                        else
                        {
                            sbAll.AppendLine(tmp1);
                        }
                    }
                } else
                {
                    종목코드 = "00000";
                }

                int prevNext = 0;
                if (!int.TryParse(e.sPrevNext, out prevNext))
                {
                    prevNext = 0;
                }

                ScreenNumber.getClass1Instance().DisconnectRealData(e.sScrNo);
                ScreenNumber.getClass1Instance().SetRealRemove("ALL", "ALL");
                putReceivedQueueAndsetNextSpell(key,sbAll.ToString(), prevNext, lastStockDate);
             }
            catch (Exception ex)
            {
                FileLog.PrintF("[ALERT-ReceivedData-OPT10080]Exception ex=" + ex.Message);
            }

        }  
Exemple #6
0
        public override void ReceivedData(AxKHOpenAPILib.AxKHOpenAPI axKHOpenAPI, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e)
        {
            FileLog.PrintF("ReceivedData OPT10001");
            try { 
                /*
                sScrNo – 화면번호
                sRQName – 사용자구분 명
                sTrCode – Tran 명
                sRecordName – Record 명
                sPreNext – 연속조회 유무
                */
                StringBuilder sbAll = new StringBuilder();
                StringBuilder sb = new StringBuilder();

                /*일자,종목코드 ,종가,전일대비기호,전일대비,등락율,거래량,공매도량,매매비중,공매도거래대금,공매도평균가*/
                sb.Append("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}|{11}|{12}|{13}|{14}|{15}|{16}|{17}|{18}|{19}|{20}|{21}|{22}|{23}|{24}|{25}|{26}|{27}|{28}|{29}|{30}|{31}|{32}|{33}|{34}|{35}|{36}|{37}|{38}|{39}|{40}|{41}|{42}");
                String tmp = sb.ToString();
                String 종목코드 = "XXXX";
                int nCnt = axKHOpenAPI.GetRepeatCnt(e.sTrCode, e.sRQName);
                String keyStockCodeLayout = "sRQName:{0}|sTrCode:{1}|sScreenNo:{2}";
                String keyStockCode = String.Format(keyStockCodeLayout
                    , e.sRQName
                    , e.sTrCode
                    , e.sScrNo
                );
                종목코드 = AppLib.getClass1Instance().getStockCode(keyStockCode);

                String keyLayout = "sRQName:{0}|sTrCode:{1}|sScreenNo:{2}|stockCode:{3}";
                String key = String.Format(keyLayout
                    , e.sRQName
                    , e.sTrCode
                    , e.sScrNo
                    , 종목코드
                );
                String 일자 = DateTime.Now.ToString("yyyyMMdd");

                spell = AppLib.getClass1Instance().getSpell(key).ShallowCopy();

                //Array arr =(Array)axKHOpenAPI.GetCommDataEx(e.sTrCode, e.sRQName);
            
                if (nCnt > 0) {
                    for (int i = 0; i < nCnt; i++) {
                        String 종목코드1 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "종목코드").Trim();//[0]
                        if (종목코드1.Equals(""))
                        {
                            종목코드1 = 종목코드;//일부 종목코드들은 아래 데이터가 아예 안나온다. ///51A077
                        }
                        String 종목명 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "종목명").Trim();//[1]
                        int 결산월 = 0;
                        String str결산월=axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "결산월");
                        if (isNotNull(str결산월)==true)
                        {
                            결산월 = Int32.Parse(str결산월.Trim());//[2]
                        }
                        String str액면가 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "액면가");
                        float 액면가 = 0;
                        if (isNotNull(str액면가) == true)
                        {
                            액면가 = float.Parse(str액면가.Trim());//[3]
                        }
                        String str자본금 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "자본금");
                        int 자본금 = 0;
                        if (isNotNull(str자본금) == true)
                        {
                            자본금 = Int32.Parse(str자본금.Trim());//[4]
                        }
                        String str상장주식 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "상장주식");
                        int 상장주식 = 0;
                        if (isNotNull(str상장주식) == true)
                        {
                            상장주식 = Int32.Parse(str상장주식.Trim());//[5]
                        }
                        String str신용비율 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "신용비율");
                        float 신용비율 = 0;
                        if (isNotNull(str신용비율) == true)
                        {
                            신용비율 = float.Parse(str신용비율.Trim());//[6]
                        }
                        String str연중최고 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "연중최고");
                        int 연중최고 = 0;
                        if (isNotNull(str연중최고) == true)
                        {
                            연중최고 = int.Parse(str연중최고.Trim());//[7]
                        }
                        String str연중최저 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "연중최저");
                        int 연중최저 = 0;
                        if (isNotNull(str연중최저) == true)
                        {
                            연중최저 = int.Parse(str연중최저.Trim());//[8]
                        }
                        String str시가총액 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "시가총액");
                        int 시가총액 = 0;
                        if (isNotNull(str시가총액) == true)
                        {
                            시가총액 = int.Parse(str시가총액.Trim());//[9]
                        }
                        String str시가총액비중 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "시가총액비중");
                        int 시가총액비중 = 0;
                        if (isNotNull(str시가총액비중) == true)
                        {
                            시가총액비중 = Int32.Parse(str시가총액비중.Trim());//[10]
                        }
                        String str외인소진률 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "외인소진률");
                        float 외인소진률 = 0;
                        if (isNotNull(str외인소진률) == true)
                        {
                            외인소진률 = float.Parse(str외인소진률.Trim());//[11]
                        }
                        String str대용가 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "대용가");
                        int 대용가 = 0;
                        if (isNotNull(str대용가) == true)
                        {
                            대용가 = int.Parse(str대용가.Trim());//[12]
                        }
                        String strPER = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "PER");
                        float PER = 0;
                        if (isNotNull(strPER) == true)
                        {
                            PER = float.Parse(strPER.Trim());//[13]
                        }
                        String strEPS = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "EPS");
                        int EPS = 0;
                        if (isNotNull(strEPS) == true)
                        {
                            EPS = int.Parse(strEPS.Trim());//[14]
                        }
                        String strROE = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "ROE");
                        float ROE = 0;
                        if (isNotNull(strROE) == true)
                        { 
                            ROE = float.Parse(strROE.Trim());//[15]    
                        }
                        String strPBR = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "PBR");
                        float PBR = 0;
                        if (isNotNull(strPBR) == true)
                        {
                            PBR = float.Parse(strPBR.Trim());//[16]    
                        }
                        String strEV = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "EV");
                        float EV = 0;
                        if (isNotNull(strEV) == true)
                        {
                            EV = float.Parse(strEV.Trim());//[17]    
                        }
                        String strBPS = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "BPS");
                        int BPS = 0;
                        if (isNotNull(strBPS) == true)
                        {
                            BPS = int.Parse(strBPS.Trim());//[18]    
                        }
                        String str매출액 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "매출액");
                        int 매출액 = 0;
                        if (isNotNull(str매출액) == true)
                        { 
                            매출액 = Int32.Parse(str매출액.Trim());//[19]
                        }
                        String str영업이익 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "영업이익");
                        int 영업이익 = 0;
                        if (isNotNull(str영업이익) == true)
                        { 
                            영업이익 = Int32.Parse(str영업이익.Trim());//[20]
                        }
                        String strD250최고 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "250최고");
                        int D250최고 = 0;
                        if (isNotNull(strD250최고) == true)
                        {
                            D250최고 = Int32.Parse(strD250최고.Trim());//[21]
                        }
                        String strD250최저 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "250최저");
                        int D250최저 = 0;
                        if (isNotNull(strD250최저) == true)
                        {
                            D250최저 = Int32.Parse(strD250최저.Trim());//[22]
                        }


                    
                        int 시가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "시가").Trim());//[23]
                        int 고가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "고가").Trim());//[24]
                        int 저가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "저가").Trim());//[25]
                        int 상한가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "상한가").Trim());//[26]
                        int 하한가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "하한가").Trim());//[27]
                        int 기준가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "기준가").Trim());//[28]

                        String str예상체결가 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "예상체결가");
                        int 예상체결가 = 0;
                        if (isNotNull(str예상체결가) == true)
                        {
                            예상체결가 = Int32.Parse(str예상체결가.Trim());//[29]
                        }

                        String str예상체결수량 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "예상체결수량");
                        int 예상체결수량 = 0;
                        if (isNotNull(str예상체결수량) == true)
                        {
                            예상체결수량 = Int32.Parse(str예상체결수량.Trim());//[30]
                        }
                        String D250최고가일 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "250최고가일").Trim();//[31]
                        float D250최고가대비율 = float.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "250최고가대비율").Trim());//[32]
                        String D250최저가일 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "250최저가일").Trim();//[33]
                        float D250최저가대비율 = float.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "250최저가대비율").Trim());//[34]
                        int 현재가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "현재가").Trim());//[35]
                        int 대비기호 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "대비기호").Trim());//[36]
                        int 전일대비 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "전일대비").Trim());//[37]
                        float 등락율 = float.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "등락율").Trim());//[38]
                        int 거래량 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "거래량").Trim());//[39]
                        float 거래대비 = float.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "거래대비").Trim());//[40]
                        String 액면가단위 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "액면가단위").Trim();//[41]

                        String tmp1 = String.Format(tmp,
                            일자,
                            종목코드1,
                            종목명,
                            결산월,
                            액면가,
                            자본금,
                            상장주식,
                            신용비율,
                            연중최고,
                            연중최저,
                            시가총액,
                            시가총액비중,
                            외인소진률,
                            대용가,
                            PER,
                            EPS,
                            ROE,
                            PBR,
                            EV,
                            BPS,
                            매출액,
                            영업이익,
                            D250최고,
                            D250최저,
                            시가,
                            고가,
                            저가,
                            상한가,
                            하한가,
                            기준가,
                            예상체결가,
                            예상체결수량,
                            D250최고가일,
                            D250최고가대비율,
                            D250최저가일,
                            D250최저가대비율,
                            현재가,
                            대비기호,
                            전일대비,
                            등락율,
                            거래량,
                            거래대비,
                            액면가단위
                        );
                        sbAll.AppendLine(tmp1);
                    }
                } else {
                    종목코드 = "00000";
                }

                //이건 nPreNext가 항상 0이다. 당일 조회만 됨
                int prevNext = 0;
                if (!int.TryParse(e.sPrevNext, out prevNext)) {
                    prevNext = 0;
                }
                String lastStockDate = "";
                ScreenNumber.getClass1Instance().DisconnectRealData( e.sScrNo);
                ScreenNumber.getClass1Instance().SetRealRemove("ALL", "ALL");
                putReceivedQueueAndsetNextSpell(key,sbAll.ToString(), prevNext, lastStockDate);
            }
            catch(Exception ex)
            {
                FileLog.PrintF("[ALERT-ReceivedData-OPT10001]Exception ex=" + ex.Message);
            }
        }
Exemple #7
0
        public override void ReceivedData(AxKHOpenAPILib.AxKHOpenAPI axKHOpenAPI, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e)
        {
            FileLog.PrintF("ReceivedData OPT10085");
            //try { 
                /*
                sScrNo – 화면번호
                sRQName – 사용자구분 명
                sTrCode – Tran 명
                sRecordName – Record 명
                sPreNext – 연속조회 유무
                */
                String 계좌번호 = "XXXXXXXXXX";
                int nCnt = axKHOpenAPI.GetRepeatCnt(e.sTrCode, e.sRQName);
                String keyStockCodeLayout = "sRQName:{0}|sTrCode:{1}|sScreenNo:{2}";
                String keyStockCode = String.Format(keyStockCodeLayout
                    , e.sRQName
                    , e.sTrCode
                    , e.sScrNo
                );
                계좌번호 = AppLib.getClass1Instance().getStockCode(keyStockCode);

                String keyLayout = "sRQName:{0}|sTrCode:{1}|sScreenNo:{2}|accountNum:{3}";
                String key = String.Format(keyLayout
                    , e.sRQName
                    , e.sTrCode
                    , e.sScrNo
                    , 계좌번호
                );

            List < OPT10085_Data >  opt10085_DataList = new List<OPT10085_Data>();


                if (nCnt > 0) {
                    for (int i = 0; i < nCnt; i++) {

                    FileLog.PrintF("OPT10085 ReceivedData 구매일자 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "일자").Trim());//[0]
                    FileLog.PrintF("OPT10085 ReceivedData 종목코드 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "종목코드").Trim());//[1]
                    FileLog.PrintF("OPT10085 ReceivedData 종목명 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "종목명").Trim());//[2]
                    FileLog.PrintF("OPT10085 ReceivedData 현재가 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "현재가").Trim());//[3]
                    FileLog.PrintF("OPT10085 ReceivedData 매입가 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "매입가").Trim());//[4]
                    FileLog.PrintF("OPT10085 ReceivedData 매입금액 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "매입금액").Trim());//[5]
                    FileLog.PrintF("OPT10085 ReceivedData 보유수량 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "보유수량").Trim());//[6]
                    FileLog.PrintF("OPT10085 ReceivedData 당일매도손익 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "당일매도손익").Trim());//[7]
                    FileLog.PrintF("OPT10085 ReceivedData 당일매매수수료 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "당일매매수수료").Trim());//[8]
                    FileLog.PrintF("OPT10085 ReceivedData 당일매매세금 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "당일매매세금").Trim());//[9]
                    FileLog.PrintF("OPT10085 ReceivedData 신용구분 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "신용구분").Trim());//[10]
                    FileLog.PrintF("OPT10085 ReceivedData 대출일 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "대출일").Trim());//[11]
                    FileLog.PrintF("OPT10085 ReceivedData 결제잔고 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "결제잔고").Trim());//[12]
                    FileLog.PrintF("OPT10085 ReceivedData 청산가능수량 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "청산가능수량").Trim());//[13]
                    FileLog.PrintF("OPT10085 ReceivedData 신용금액 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "신용금액").Trim());//[14]
                    FileLog.PrintF("OPT10085 ReceivedData 신용이자 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "신용이자").Trim());//[15]
                    FileLog.PrintF("OPT10085 ReceivedData 만기일 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "만기일").Trim());//[16]



                    OPT10085_Data opt10085_Data = new OPT10085_Data();
                    opt10085_Data.구매일자 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "일자").Trim();//[0]
                    opt10085_Data.종목코드 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "종목코드").Trim();//[1]
                    opt10085_Data.종목명 =axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "종목명").Trim(); //[2]
                    int 현재가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "현재가").Trim()); //[3]
                    opt10085_Data.현재가 = 현재가;
                    opt10085_Data.매입가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "매입가").Trim()); //[4]
                    int 매입금액 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "매입금액").Trim()); //[5]
                    opt10085_Data.매입금액 = 매입금액;
                    int 보유수량= Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "보유수량").Trim()); //[6]
                    opt10085_Data.보유수량 = 보유수량;
                    opt10085_Data.당일매도손익 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "당일매도손익").Trim());  //[7]
                        String str당일매매수수료 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "당일매매수수료");
                    opt10085_Data.당일매매수수료 = 0; 
                        if (isNotNull(str당일매매수수료) == true)
                        {
                        opt10085_Data.당일매매수수료 = Int32.Parse(str당일매매수수료.Trim());//[8]
                        }
                    opt10085_Data.당일매매세금 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "당일매매세금").Trim()); //[9]
                    opt10085_Data.신용구분 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "신용구분").Trim();//[10]
                    opt10085_Data.대출일 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "대출일").Trim();//[11]
                    opt10085_Data.결제잔고 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "결제잔고").Trim()); //[12]
                    opt10085_Data.청산가능수량 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "청산가능수량").Trim()); //[13]
                    opt10085_Data.신용금액 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "신용금액").Trim()); //[14]
                    opt10085_Data.신용이자 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "신용이자").Trim()); //[15]
                    opt10085_Data.만기일 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "만기일").Trim();//[16]

                        /*내가 만들 데이터*/
                        /*매입가에는 수수료가 포함안되어있다. 매입당시 수수료가 통장에서 빠져나가지만 내가 얼마나 수익이 났는지 확인하기 위해 
                        매입수수료와 매도 수수료를 합쳐서 수수료로 표시해준다.
                        수수료는 10원 미만 절삭 86원이면 80원임
                        */
                        //System.Math.Truncate()
                        int 평가금액 = Math.Abs(현재가) * 보유수량;
                        int 매입수수료 = Commission.GetKiwoomCommissionBuy(매입금액);
                        int 매도수수료 = Commission.GetKiwoomCommissionSell(평가금액);
                        int 수수료 = 매입수수료 + 매도수수료;
                        int 매도세금 =Commission.GetTaxSell(평가금액);
                    int 손익분기매입가 = 0;
                    if (보유수량 != 0)//이게 0일경우가 있다 매도를 한상태일경우 보유수량이 0으로 리스트에 계속 존재한다.
                    {
                        손익분기매입가 = (매입수수료 + 매도수수료 + 매도세금 + 매입금액) / 보유수량;  // 무조건오림
                    }
                    int 평가손익 = 평가금액 - (매입금액+수수료+매도세금);
                    // float 수익률 = (평가손익 / 매입금액) * 100;   //int끼리 나눠서... 소수점을 버리는구나.. 이런..
                    float 수익률 = 0;
                    if (매입금액 != 0)
                    {
                        수익률 = ((float)평가손익 / (float)매입금액) * 100;
                    }
                    int 손익금액 = (평가금액-매입금액);

                    float 손익율 = 0;
                    if (매입금액 != 0)
                    {
                        손익율 = ((float)손익금액 / (float)매입금액) * 100;
                    }

                    

                    opt10085_Data.평가금액=평가금액;
                    opt10085_Data.매입수수료 = 매입수수료;
                    opt10085_Data.매도수수료 = 매도수수료;
                    opt10085_Data.수수료 = 수수료;
                    opt10085_Data.매도세금 = 매도세금;
                    opt10085_Data.손익분기매입가 = 손익분기매입가;
                    opt10085_Data.평가손익 = 평가손익;
                    opt10085_Data.수익률 = 수익률;
                    opt10085_Data.손익금액 = 손익금액;
                    opt10085_Data.손익율 = 손익율;
                    opt10085_Data.계좌번호 = 계좌번호;
                    

                    FileLog.PrintF("OPT10085 ReceivedData 평가손익=>" + 평가손익);
                    FileLog.PrintF("OPT10085 ReceivedData 손익금액=>" + 손익금액);
                    FileLog.PrintF("OPT10085 ReceivedData 매입금액=>" + 매입금액);
                    FileLog.PrintF("OPT10085 ReceivedData 평가손익=>" + 평가손익);
                    FileLog.PrintF("OPT10085 ReceivedData 수익률=>" + 수익률);
                    FileLog.PrintF("OPT10085 ReceivedData 손익율=>" + 손익율);


                    //(8025-8089)/8089*100
                    //24005=23775+160+70
                    //24005-24575=-570
                    //24805
                    opt10085_DataList.Add(opt10085_Data);
                    }
                }
            //axKHOpenAPI.DisconnectRealData(e.sScrNo); 계좌 수익률 정보는  실시간 데이터간 데이터로 들어온다면... 실시간으로 처리하는것이 이익이다..
            //화면번호도 고정이면 좋을것 같다...
            FileLog.PrintF("ReceivedData OPT10085 opt10085_DataList.Count()=>" + opt10085_DataList.Count());
            AppLib.getClass1Instance().removeStockCodeDictionary(keyStockCode);
            AppLib.getClass1Instance().removeSpellDictionary(key);
            MyStock.getClass1Instance().reLoad(opt10085_DataList); //보내는처리 무엇이든.
                                                                    //}
                                                                    //catch(Exception ex)
                                                                    //{
                                                                    //    FileLog.PrintF("[ALERT-ReceivedData-OPT10085]Exception ex=" + ex.Message);
                                                                    //}
        }
Exemple #8
0
        public override void ReceivedData(AxKHOpenAPILib.AxKHOpenAPI axKHOpenAPI, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e)
        {
            FileLog.PrintF("ReceivedData OPT10014");
            try
            {
                /*
                sScrNo – 화면번호
                sRQName – 사용자구분 명
                sTrCode – Tran 명
                sRecordName – Record 명
                sPreNext – 연속조회 유무
                */
                StringBuilder sbAll = new StringBuilder();
                StringBuilder sb = new StringBuilder();

                /*일자,종목코드 ,종가,전일대비기호,전일대비,등락율,거래량,공매도량,매매비중,공매도거래대금,공매도평균가*/
                sb.Append("{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}|{8}|{9}|{10}");
                String tmp = sb.ToString();
                String 종목코드 = "XXXX";
                int nCnt = axKHOpenAPI.GetRepeatCnt(e.sTrCode, e.sRQName);
                String keyStockCodeLayout = "sRQName:{0}|sTrCode:{1}|sScreenNo:{2}";
                String keyStockCode = String.Format(keyStockCodeLayout
                    , e.sRQName
                    , e.sTrCode
                    , e.sScrNo
                );
                종목코드 = AppLib.getClass1Instance().getStockCode(keyStockCode);

                String keyLayout = "sRQName:{0}|sTrCode:{1}|sScreenNo:{2}|stockCode:{3}";
                String key = String.Format(keyLayout
                    , e.sRQName
                    , e.sTrCode
                    , e.sScrNo
                    , 종목코드
                );

                spell = AppLib.getClass1Instance().getSpell(key).ShallowCopy();
                String startDate = spell.startDate;
                String lastStockDate = "";
                int startDate일자 = 0;
                if (!int.TryParse(startDate, out startDate일자))
                {
                    startDate일자 = 0;
                }

                if (nCnt > 0) {
                    for (int i = 0; i < nCnt; i++) {
                        int 일자 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "일자").Trim());//[0]
                        int 종가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "종가").Trim());//[1]
                        int 전일대비기호 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "전일대비기호").Trim());//[2]
                        int 전일대비 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "전일대비").Trim());//[3]
                        float 등락율 = float.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "등락율").Trim());//[4]
                        int 거래량 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "거래량").Trim());//[5]
                        int 공매도량 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "공매도량").Trim());//[6]
                        float 매매비중 = float.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "매매비중").Trim());//[7]
                        int 공매도거래대금 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "공매도거래대금").Trim());//[8]
                        int 공매도평균가 = Int32.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "공매도평균가").Trim());//[9]

                        String tmp1 = String.Format(tmp,
                            일자,
                            종목코드,
                            종가,
                            전일대비기호,
                            전일대비,
                            등락율,
                            거래량,
                            공매도량,
                            매매비중,
                            공매도거래대금,
                            공매도평균가
                        );
                        lastStockDate = 일자.ToString();
                        if (startDate != null)
                        {
                            if (startDate.Equals("ZERO") || startDate.Equals("TWO"))
                            {
                                sbAll.AppendLine(tmp1);
                            }
                            else
                            {
                                if (일자 >= startDate일자)
                                {
                                    sbAll.AppendLine(tmp1);
                                }
                                else
                                {
                                    break;
                                }
                            }
                        }
                        else
                        {
                            sbAll.AppendLine(tmp1);
                        }

                    }
                } else {
                    종목코드 = "00000";
                }

                int prevNext = 0;
                if (!int.TryParse(e.sPrevNext, out prevNext)) {
                    prevNext = 0;
                }
                ScreenNumber.getClass1Instance().DisconnectRealData(e.sScrNo);
                ScreenNumber.getClass1Instance().SetRealRemove("ALL", "ALL");
                putReceivedQueueAndsetNextSpell(key,sbAll.ToString(), prevNext, lastStockDate);
            }
            catch (Exception ex)
            {
                FileLog.PrintF("[ALERT-ReceivedData-OPT10014]Exception ex=" + ex.Message);
            }
        }
Exemple #9
0
        public override void ReceivedData(AxKHOpenAPILib.AxKHOpenAPI axKHOpenAPI, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e)
        {
            FileLog.PrintF("ReceivedData OPT10075");
            //try { 
                /*
                sScrNo – 화면번호
                sRQName – 사용자구분 명
                sTrCode – Tran 명
                sRecordName – Record 명
                sPreNext – 연속조회 유무
                */
                String 계좌번호 = "XXXXXXXXXX";
                int nCnt = axKHOpenAPI.GetRepeatCnt(e.sTrCode, e.sRQName);
                String keyStockCodeLayout = "sRQName:{0}|sTrCode:{1}|sScreenNo:{2}";
                String keyStockCode = String.Format(keyStockCodeLayout
                    , e.sRQName
                    , e.sTrCode
                    , e.sScrNo
                );
                계좌번호 = AppLib.getClass1Instance().getStockCode(keyStockCode);

                String keyLayout = "sRQName:{0}|sTrCode:{1}|sScreenNo:{2}|accountNum:{3}";
                String key = String.Format(keyLayout
                    , e.sRQName
                    , e.sTrCode
                    , e.sScrNo
                    , 계좌번호
                );

            List < OPT10075_Data >  OPT10075_DataList = new List<OPT10075_Data>();


                if (nCnt > 0) {
                    for (int i = 0; i < nCnt; i++) {

                    FileLog.PrintF("OPT10075 ReceivedData 계좌번호 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "계좌번호").ToString().Trim());//[0]
                    FileLog.PrintF("OPT10075 ReceivedData 주문번호 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "주문번호").ToString().Trim());//[1]
                    FileLog.PrintF("OPT10075 ReceivedData 관리사번 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "관리사번").ToString().Trim());//[2]
                    FileLog.PrintF("OPT10075 ReceivedData 종목코드 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "종목코드").ToString().Trim());//[3]
                    FileLog.PrintF("OPT10075 ReceivedData 업무구분 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "업무구분").ToString().Trim());//[4]
                    FileLog.PrintF("OPT10075 ReceivedData 주문상태 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "주문상태").ToString().Trim());//[5]
                    FileLog.PrintF("OPT10075 ReceivedData 종목명 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "종목명").ToString().Trim());//[6]
                    FileLog.PrintF("OPT10075 ReceivedData 주문수량 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "주문수량").ToString().Trim());//[7]
                    FileLog.PrintF("OPT10075 ReceivedData 주문가격 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "주문가격").ToString().Trim());//[8]
                    FileLog.PrintF("OPT10075 ReceivedData 미체결수량 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "미체결수량").ToString().Trim());//[9]
                    FileLog.PrintF("OPT10075 ReceivedData 체결누적금액 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "체결누적금액").ToString().Trim());//[10]
                    FileLog.PrintF("OPT10075 ReceivedData 원주문번호 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "원주문번호").ToString().Trim());//[11]
                    FileLog.PrintF("OPT10075 ReceivedData 주문구분 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "주문구분").ToString().Trim());//[12]
                    FileLog.PrintF("OPT10075 ReceivedData 매매구분 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "매매구분").ToString().Trim());//[13]
                    FileLog.PrintF("OPT10075 ReceivedData 시간 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "시간").ToString().Trim());//[14]
                    FileLog.PrintF("OPT10075 ReceivedData 체결번호 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "체결번호").ToString().Trim());//[15]
                    FileLog.PrintF("OPT10075 ReceivedData 체결가 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "체결가").ToString().Trim());//[16]
                    FileLog.PrintF("OPT10075 ReceivedData 체결량 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "체결량").ToString().Trim());//[17]
                    FileLog.PrintF("OPT10075 ReceivedData 현재가 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "현재가").ToString().Trim());//[18]
                    FileLog.PrintF("OPT10075 ReceivedData 매도호가 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "매도호가").ToString().Trim());//[19]
                    FileLog.PrintF("OPT10075 ReceivedData 매수호가 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "매수호가").ToString().Trim());//[20]
                    FileLog.PrintF("OPT10075 ReceivedData 단위체결가 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "단위체결가").ToString().Trim());//[21]
                    FileLog.PrintF("OPT10075 ReceivedData 단위체결량 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "단위체결량").ToString().Trim());//[22]
                    FileLog.PrintF("OPT10075 ReceivedData 당일매매수수료 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "당일매매수수료").ToString().Trim());//[23]
                    FileLog.PrintF("OPT10075 ReceivedData 단일매매세금 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "단일매매세금").ToString().Trim());//[24]
                    FileLog.PrintF("OPT10075 ReceivedData 개인투자자 =>" + axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "개인투자자").ToString().Trim());//[25]

                    OPT10075_Data opt10075_Data = new OPT10075_Data();

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



                    opt10075_Data.계좌번호 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "계좌번호").ToString().Trim();//[0]
                    opt10075_Data.주문번호 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "주문번호").ToString().Trim();//[1]
                    opt10075_Data.관리사번 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "관리사번").ToString().Trim(); //[2]
                    opt10075_Data.종목코드 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "종목코드").ToString().Trim(); //[3]
                    opt10075_Data.업무구분 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "업무구분").ToString().Trim(); //[4]
                    opt10075_Data.주문상태 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "주문상태").ToString().Trim(); //[5]
                    opt10075_Data.종목명 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "종목명").ToString().Trim(); //[6]
                    opt10075_Data.주문수량 = int.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "주문수량").ToString().Trim()); //[7]
                    opt10075_Data.주문가격 = int.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "주문가격").ToString().Trim()); //[8]
                    opt10075_Data.미체결수량 = int.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "미체결수량").ToString().Trim()); //[9]
                    opt10075_Data.체결누계금액 = int.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "체결누계금액").ToString().Trim()); //[10]
                    opt10075_Data.원주문번호 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "원주문번호").ToString().Trim(); //[11]
                    opt10075_Data.주문구분 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "주문구분").ToString().Trim(); //[12]
                    opt10075_Data.매매구분 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "매매구분").ToString().Trim(); //[13]
                    opt10075_Data.체결번호 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "체결번호").ToString().Trim(); //[15]
                    opt10075_Data.체결가 = int.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "체결가").ToString().Trim()); //[16]
                    opt10075_Data.체결량 = int.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "체결량").ToString().Trim()); //[17]
                    opt10075_Data.현재가 = int.Parse(axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "현재가").ToString().Trim()); //[18]
                    String str매도호가= axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "매도호가").ToString().Trim(); //[19]
                    opt10075_Data.매도호가 = 0;
                    if (!str매도호가.Equals(""))
                    {
                        opt10075_Data.매도호가 = int.Parse(str매도호가);
                    }
                    String str매수호가 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "매수호가").ToString().Trim(); //[20]
                    opt10075_Data.매수호가 = 0;
                    if (!str매수호가.Equals(""))
                    {
                        opt10075_Data.매수호가 = int.Parse(str매수호가);
                    }
                    String str단위체결가 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "단위체결가").ToString().Trim(); //[21]
                    opt10075_Data.단위체결가 = 0;
                    if (!str단위체결가.Equals(""))
                    {
                        opt10075_Data.단위체결가 = int.Parse(str단위체결가);
                    }
                    String str단위체결량 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "단위체결량").ToString().Trim(); //[22]
                    opt10075_Data.단위체결량 = 0;
                    if (!str단위체결량.Equals(""))
                    {
                        opt10075_Data.단위체결량 = int.Parse(str단위체결량);
                    }
                    String str당일매매수수료 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "당일매매수수료").ToString().Trim(); //[23]
                    opt10075_Data.당일매매수수료 = 0;
                    if (!str당일매매수수료.Equals(""))
                    {
                        opt10075_Data.당일매매수수료 = int.Parse(str당일매매수수료);
                    }
                    String str당일매매세금 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "당일매매세금").ToString().Trim(); //[24]
                    opt10075_Data.당일매매세금 = 0;
                    if (!str당일매매세금.Equals(""))
                    {
                        opt10075_Data.당일매매세금 = int.Parse(str당일매매세금);
                    }
                    opt10075_Data.개인투자자 = axKHOpenAPI.CommGetData(e.sTrCode, "", e.sRQName, i, "개인투자자").ToString().Trim(); //[25]
                    

                    //(8025-8089)/8089*100
                    //24005=23775+160+70
                    //24005-24575=-570
                    //24805
                    OPT10075_DataList.Add(opt10075_Data);
                    }
                }
            //axKHOpenAPI.DisconnectRealData(e.sScrNo); 계좌 수익률 정보는  실시간 데이터간 데이터로 들어온다면... 실시간으로 처리하는것이 이익이다..
            //화면번호도 고정이면 좋을것 같다...
            FileLog.PrintF("ReceivedData OPT10075 OPT10075_DataList.Count()=>" + OPT10075_DataList.Count());
            axKHOpenAPI.DisconnectRealData(e.sScrNo);
            AppLib.getClass1Instance().removeStockCodeDictionary(keyStockCode);
            AppLib.getClass1Instance().removeSpellDictionary(key);
            MyOrder.getClass1Instance().reLoad(OPT10075_DataList);
        }