조건명과 조건 번호 요청
아래의 코드로 등록되어 있는 조건명,조건번호를 요청합니다.
this.api.GetConditionLoad();
응답은 이벤트로 수신되며 이벤트는 미리 등록해야 합니다.
api.OnReceiveConditionVer += AxKHOpenAPI_OnReceiveConditionVer;
public void AxKHOpenAPI_OnReceiveConditionVer(object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveConditionVerEvent e)
{
// 검색 조건명, 조건번호를 수신되면 실행됨
}
private void Form1_Load(object sender, EventArgs e)
{
this.api.OnReceiveConditionVer += AxKHOpenAPI_OnReceiveConditionVer;
this.api.OnEventConnect += AxKHOpenAPI1_OnEventConnect;
}
private void AxKHOpenAPI1_OnEventConnect(object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnEventConnectEvent e)
{
if(e.nErrCode ==0)
{
// label1.Text = "로그인 성공";
// 조건 검색 번호와 이름 가져오기
this.api.GetConditionLoad();
}
else
{
// label1.Text = "로그인 실패";
}
}
public void AxKHOpenAPI_OnReceiveConditionVer(object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveConditionVerEvent e)
{
string[] conditionStocks = this.api.GetConditionNameList().Split(';');
foreach (string con in conditionStocks)
{
string[] condition = con.Split('^');
if (condition.Length == 2)
{
Console.WriteLine(string.Format("조건번호:{0}, 조건명:{1}", condition[0], condition[1]));
}
}
}
키움API 조건검색 사용 하위 항목