public void RegistAuto() { // UnRegistAuto(); m_iYuantaAPI.YOA_SetTRFieldString("11", "InBlock1", "jongcode", m_strJongCode, 0); //m_mainForm.txtBTJongCode.Text를 i로 바꿈 int nReqID = m_iYuantaAPI.YOA_RegistAuto("11"); if (CommDef.ERROR_MAX_CODE < nReqID) { m_mapAutoTR[nReqID] = "11"; m_mainForm.btnBTAutoUnRegist.Enabled = true; m_mainForm.lbLog.Items.Insert(0, "[11]주식 실시간체결 Auto가 등록 되었습니다."); List <string> value = new List <string>(); MainForm.Master종합정보.Add(m_strJongCode, value); MainForm.regist_count++; // MainForm.Master종합정보[m_iYuantaAPI.YOA_GetTRFieldString("11", "OutBlock1", "jongcode", 0)]= "null"; //Console.WriteLine("3"); } else { string strMsg = m_iYuantaAPI.YOA_GetErrorMessage(nReqID); // 실시간 등록 실패에 대한 메시지를 얻을 수 있습니다. m_mainForm.lbLog.Items.Add(strMsg); } }
void IYuantaAPIEvents.Login(int nResult, string strMsg) { if (CommDef.RESPONSE_LOGIN_SUCCESS == nResult) { btnLogout.Enabled = true; btnGetAccount.Enabled = true; LogMessage("로그인이 완료되었습니다."); } else { btnLogin.Enabled = true; btnLogout.Enabled = false; btnGetAccount.Enabled = false; LogMessage("로그인이 실패하였습니다.", CommDef.YOALOG_ERROR); if (CommDef.ERROR_TIMEOUT_DATA == nResult) { LogMessage("서버로부터 로그인 응답이 없습니다. 다시 시도하여 주십시오.", CommDef.YOALOG_ERROR, false); } else { LogMessage(m_iYuantaAPI.YOA_GetErrorMessage(nResult), CommDef.YOALOG_ERROR, false); } } throw new NotImplementedException(); }
public void Search() { string strAcctPwd = m_mainForm.txtOrdAcctPwd.Text; strAcctPwd.Trim(); if (0 == strAcctPwd.Length) { MessageBox.Show("계좌비밀번호를 입력해주세요."); m_mainForm.txtOrdAcctPwd.Focus(); return; } string strAccount = m_mainForm.cbOrdAccount.SelectedItem.ToString(); strAccount = strAccount.Replace("-", ""); m_iYuantaAPI.YOA_SetTRFieldString("204006", "InBlock1", "kyejwa", strAccount, 0); m_iYuantaAPI.YOA_SetTRFieldString("204006", "InBlock1", "passwd", strAcctPwd, 0); int nReqID = m_iYuantaAPI.YOA_Request("204006", true, -1); if (CommDef.ERROR_MAX_CODE < nReqID) { m_mapRequestTR[nReqID] = "204006"; m_mainForm.LogMessage("[ReqID:" + nReqID + "] [204006]가정산예수현황 조회를 요청하였습니다."); } else { m_mainForm.LogMessage("[204006]가정산예수현황 조회중 오류가 발생하였습니다.", CommDef.YOALOG_ERROR); int nErrorCode = m_iYuantaAPI.YOA_GetLastError(); m_mainForm.LogMessage("[" + nErrorCode + " ]" + m_iYuantaAPI.YOA_GetErrorMessage(nErrorCode), CommDef.YOALOG_ERROR, false); return; } m_iYuantaAPI.YOA_SetTRFieldString("211010", "InBlock1", "acnt_aid", strAccount, 0); m_iYuantaAPI.YOA_SetTRFieldString("211010", "InBlock1", "passwd", strAcctPwd, 0); nReqID = m_iYuantaAPI.YOA_Request("211010", true, -1); if (CommDef.ERROR_MAX_CODE < nReqID) { m_mapRequestTR[nReqID] = "211010"; m_mainForm.LogMessage("[ReqID:" + nReqID + "] [211010]ELW매매기본예탁금 조회를 요청하였습니다."); } else { m_mainForm.LogMessage("[211010]ELW매매기본예탁금 조회중 오류가 발생하였습니다.", CommDef.YOALOG_ERROR); int nErrorCode = m_iYuantaAPI.YOA_GetLastError(); m_mainForm.LogMessage("[" + nErrorCode + " ]" + m_iYuantaAPI.YOA_GetErrorMessage(nErrorCode), CommDef.YOALOG_ERROR, false); } }
public void Search() { UnRegistAuto(); 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 nReqID = m_iYuantaAPI.YOA_Request("300001", true, -1); if (CommDef.ERROR_MAX_CODE < nReqID) { m_mapRequestTR[nReqID] = "300001"; string strMsg = "[ReqID:" + nReqID + "] [300001]주식현재가 조회를 요청하였습니다."; m_mainForm.LogMessage(strMsg); } else { string strMsg = "[300001]주식현재가 조회 요청중 오류가 발생하였습니다."; m_mainForm.LogMessage(strMsg, CommDef.YOALOG_ERROR); strMsg = "[" + nReqID + "]" + m_iYuantaAPI.YOA_GetErrorMessage(nReqID); m_mainForm.LogMessage(strMsg, CommDef.YOALOG_ERROR, false); } }
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); } }