Exemple #1
0
        public void 거래량순리스트조회처리(object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e)
        {
            int rowCount = OpenAPI.GetRepeatCnt(e.sTrCode, e.sRQName);

            for (int i = 0; i < rowCount; i++)
            {
                StockDaily stockInfo = new StockDaily();
                stockInfo.inqDate   = inqDate;
                stockInfo.stockCode = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "종목코드").Trim();
                stockInfo.stockName = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "종목명").Trim();

                stockInfo.currentPrice = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "현재가").Trim();
                if (!string.IsNullOrWhiteSpace(stockInfo.currentPrice))
                {
                    stockInfo.currentPrice = Math.Abs(decimal.Parse(stockInfo.currentPrice)).ToString();
                }

                stockInfo.traffic    = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "현재거래량").Trim();
                stockInfo.이전거래량      = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "이전거래량").Trim();
                stockInfo.diffBefore = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "전일대비").Trim();
                stockInfo.upDownRate = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "등락률").Trim();
                stockInfo.매도호가       = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "매도호가").Trim();
                stockInfo.매수호가       = OpenAPI.GetCommData(e.sTrCode, e.sRQName, i, "매수호가").Trim();

                if (dacStock.GetStockDailyInfo(inqDate, stockInfo.stockCode) == null)
                {
                    dacStock.insertStockDaily(stockInfo);
                }
                else
                {
                    dacStock.현재가갱신(inqDate, stockInfo.stockCode, stockInfo.currentPrice);
                }
            }

            // 매수대상리스트에 현재가 갱신
            dacStock.거래량정보에서현재가갱신(inqDate);
        }