public void Search() { if (0 != m_nReqID_301004) { m_iYuantaAPI.YOA_ReleaseData(m_nReqID_301004); } m_mainForm.lvConTick.Items.Clear(); m_mainForm.lvDaily.Items.Clear(); ListViewItem item = new ListViewItem(); item.UseItemStyleForSubItems = false; item.SubItems.Add("현 재"); item.SubItems.Add(""); item.SubItems.Add(""); item.SubItems.Add(""); item.SubItems.Add(""); item.SubItems.Add(""); item.SubItems.Add(""); item.SubItems.Add(""); item.SubItems.Add(""); m_mainForm.lvDaily.Items.Add(item); m_nReqID_301004 = 0; UnRegistAuto(); // 종목코드란에 text를 가져와서 search함 m_strJongCode = m_mainForm.txtJongCode.Text; m_strJongCode.Trim(); m_iYuantaAPI.YOA_SetTRFieldString("300001", "InBlock1", "jang", "1", 0); m_iYuantaAPI.YOA_SetTRFieldString("300001", "InBlock1", "jongcode", m_strJongCode, 0); m_iYuantaAPI.YOA_SetTRFieldString("300001", "InBlock1", "outflag", "N", 0); m_iYuantaAPI.YOA_SetTRFieldString("300001", "InBlock1", "tsflag", "0", 0); int nResult = m_iYuantaAPI.YOA_Request("300001", true, -1); if (CommDef.ERROR_MAX_CODE < nResult) { m_mapRequestTR[nResult] = "300001"; string strMsg = "[ReqID:" + nResult + "] [300001]주식현재가 조회를 요청하였습니다."; m_mainForm.LogMessage(strMsg); } else { string strMsg = "[300001]주식현재가 조회 요청중 오류가 발생하였습니다."; m_mainForm.LogMessage(strMsg, CommDef.YOALOG_ERROR); strMsg = "[" + nResult + "]" + m_iYuantaAPI.YOA_GetErrorMessage(nResult); m_mainForm.LogMessage(strMsg, CommDef.YOALOG_ERROR, false); } string strJang = m_iYuantaAPI.YOA_GetCodeInfo(CommDef.MARKET_TYPE_INTERNAL, CommDef.CODE_INFO_JANG_GUBUN, m_mainForm.txtJongCode.Text); m_iYuantaAPI.YOA_SetTRInfo("300002", "InBlock1"); m_iYuantaAPI.YOA_SetFieldString("jang", strJang, 0); m_iYuantaAPI.YOA_SetFieldString("jongcode", m_strJongCode, 0); m_iYuantaAPI.YOA_SetFieldString("outflag", "N", 0); nResult = m_iYuantaAPI.YOA_Request("300002", true, -1); if (CommDef.ERROR_MAX_CODE < nResult) { m_mapRequestTR[nResult] = "300002"; string strMsg = "[ReqID:" + nResult + "] [300002]주식현재가_호가체결 조회를 요청하였습니다."; m_mainForm.LogMessage(strMsg); } else { string strMsg = "[300002]주식현재가_호가체결 조회 요청중 오류가 발생하였습니다."; m_mainForm.LogMessage(strMsg, CommDef.YOALOG_ERROR); strMsg = "[" + nResult + "]" + m_iYuantaAPI.YOA_GetErrorMessage(nResult); m_mainForm.LogMessage(strMsg, CommDef.YOALOG_ERROR, false); } DateTime dt = DateTime.Now; string strDate = dt.ToString("yyyyMMdd"); m_iYuantaAPI.YOA_SetTRInfo("301004", "InBlock1"); m_iYuantaAPI.YOA_SetFieldString("jongcode", m_strJongCode, 0); m_iYuantaAPI.YOA_SetFieldString("janggubun", strJang, 0); m_iYuantaAPI.YOA_SetFieldString("searchdate", strDate, 0); m_iYuantaAPI.YOA_SetFieldString("daygubun", "1", 0); m_iYuantaAPI.YOA_SetFieldString("querygubun", "0", 0); m_iYuantaAPI.YOA_SetFieldString("bpquery", "0", 0); nResult = m_iYuantaAPI.YOA_Request("301004", false, -1); if (CommDef.ERROR_MAX_CODE < nResult) { m_nReqID_301004 = nResult; m_mapRequestTR[nResult] = "301004"; string strMsg = "[ReqID:" + nResult + "] [301004]수정일자별주가 조회를 요청하였습니다."; m_mainForm.LogMessage(strMsg); } else { string strMsg = "[301004]수정일자별주가 조회 요청중 오류가 발생하였습니다."; m_mainForm.LogMessage(strMsg, CommDef.YOALOG_ERROR); strMsg = "[" + nResult + "]" + m_iYuantaAPI.YOA_GetErrorMessage(nResult); m_mainForm.LogMessage(strMsg, CommDef.YOALOG_ERROR, false); } }