tr-opt20019(업종현재가일별요청)
- REQUEST Code
string trCd = "opt20019";
string endDate = "20221007";
//업종코드 = 001:종합(KOSPI), 002:대형주, 003:중형주, 004:소형주 101:종합(KOSDAQ), 201:KOSPI200, 302:KOSTAR, 701: KRX100 나머지 ※ 업종코드 참고
axKHOpenAPI.SetInputValue("업종코드", "001");
// 기준일자 = YYYYMMDD (20160101 연도4자리, 월 2자리, 일 2자리 형식)
axKHOpenAPI.SetInputValue("기준일자", endDate);
axKHOpenAPI.CommRqData("RQName", trCd, 0, GetScrNum());
- RESPONSE Code
//TR 조회 요구에 대한 데이터 수신 이벤트
private void axKHOpenAPI_OnReceiveTrData(object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e) {
switch (e.sTrCode.ToLower()) {
case "opt20019": // 업종현재가일별요청
funcOpt20019(sender, e);
break;
}
}
// 업종현재가일별요청
private void funcOpt20019(object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e) {
try {
string[] columns = new string[] { "현재가", "거래량", "일자", "시가", "고가", "저가", "거래대금", "대업종구분", "소업종구분", "종목정보", "전일종가" };
List<string[]> list = new List<string[]>();
list.Add(columns);
Console.WriteLine("<!-- Start funcOpt20019 (업종현재가일별요청) -->");
int nCnt = axKHOpenAPI.GetRepeatCnt(e.sTrCode, e.sRQName);
for (int ni = 0; ni < nCnt; ni++) {
string[] row = new string[columns.Length];
for (int i = 0; i < columns.Length; i++) {
row[i] = axKHOpenAPI.GetCommData(e.sTrCode, e.sRQName, ni, columns[i]).Trim();
}
list.Add(row);
}
PrintHtmlTable(list);
Console.WriteLine("<!-- End funcOpt20019 (업종현재가일별요청) -->");
}
catch (Exception e1) {
Console.WriteLine(e1.StackTrace);
}
}
public void PrintHtmlTable(List<string[]> list) {
string table = "<table>\r\n";
for (int i = 0; i < list.Count; i++) {
table +="<tr>";
for (int j = 0; j < list[i].Length; j++) {
table += string.Format("<td>{0}</td>", list[i][j]);
}
table +="</tr>\r\n";
}
table +="</table>";
Console.WriteLine(table);
tbLog.Text = table;
}
- RESPONSE Data Sample
현재가 | 거래량 | 일자 | 시가 | 고가 | 저가 | 거래대금 | 대업종구분 | 소업종구분 | 종목정보 | 전일종가 |
223284 | 115806970 | 20220103 | 299832 | 301077 | 213477 | 1771691365 | ||||
297765 | 257790741 | 20210104 | 287450 | 331608 | 282273 | 3825207459 | ||||
287347 | 222023455 | 20200102 | 220121 | 287821 | 143943 | 3025703299 | ||||
219767 | 115797676 | 20190102 | 205055 | 225205 | 189181 | 1227492386 | ||||
204104 | 97105066 | 20180102 | 247486 | 260710 | 198595 | 1597863767 | ||||
246749 | 82732473 | 20170102 | 202223 | 256163 | 201568 | 1296506681 | ||||
202646 | 92685924 | 20160104 | 195447 | 207389 | 181797 | 1112668612 | ||||
196131 | 112903282 | 20150102 | 191424 | 218954 | 180075 | 1327229809 | ||||
191559 | 68129969 | 20140102 | 201311 | 209308 | 188173 | 975977010 | ||||
201134 | 81096260 | 20130102 | 201374 | 206328 | 177053 | 986375146 | ||||
199705 | 120631542 | 20120102 | 183169 | 205728 | 175899 | 1196035760 | ||||
182574 | 87732288 | 20110103 | 206369 | 223147 | 164411 | 1702060206 | ||||
205100 | 95595585 | 20100104 | 168171 | 205297 | 153268 | 1410561676 | ||||
168277 | 122871160 | 20090102 | 113287 | 172317 | 99269 | 1466274639 | ||||
112447 | 88148940 | 20080102 | 189145 | 190113 | 89216 | 1287164637 | ||||
189713 | 89505957 | 20070102 | 143889 | 208545 | 134508 | 1362876963 | ||||
143446 | 68936660 | 20060102 | 138332 | 146470 | 119209 | 848489422 | ||||
137937 | 116439615 | 20050103 | 89600 | 138314 | 86617 | 786257741 | ||||
89592 | 92843448 | 20040102 | 81626 | 93952 | 71399 | 555751001 | ||||
81071 | 133876310 | 20030102 | 63303 | 82426 | 51230 | 547508966 | ||||
62755 | 209167671 | 20020102 | 69800 | 94354 | 57649 | 742149906 | ||||
69370 | 116414706 | 20010102 | 50331 | 71593 | 46354 | 491353140 | ||||
50462 | 73783338 | 20000104 | 102833 | 106618 | 48358 | 627122903 | ||||
102807 | 69359012 | 19990104 | 57541 | 105260 | 48975 | 866923342 | ||||
56246 | 28464166 | 19980103 | 37441 | 59932 | 27737 | 192486997 | ||||
37631 | 12125189 | 19970103 | 65122 | 79954 | 33894 | 162281279 | ||||
65122 | 7785271 | 19960103 | 88230 | 99122 | 64357 | 142642011 | ||||
88294 | 7655863 | 19950103 | 102745 | 103065 | 83981 | 142912833 | ||||
102736 | 10910002 | 19940103 | 86593 | 114566 | 85347 | 229728630 | ||||
86618 | 10398266 | 19930104 | 68551 | 88035 | 60229 | 169919430 | ||||
67844 | 7064053 | 19920103 | 61714 | 70494 | 45659 | 90624227 | ||||
61092 | 4094229 | 19910103 | 67883 | 77242 | 57911 | 62564683 | ||||
69611 | 3161908 | 19900103 | 90307 | 93324 | 55998 | 53453511 | ||||
90972 | 3397436 | 19890104 | 90720 | 101575 | 84295 | 81196417 | ||||
90720 | 3036793 | 19880104 | 53204 | 92256 | 52789 | 58092821 | ||||
52511 | 1660077 | 19870105 | 26482 | 52511 | 26482 | 20411898 | ||||
27261 | 8693038 | 19860104 | 16140 | 27947 | 15385 | 9426088 | ||||
16337 | 5569524 | 19850104 | 13953 | 16337 | 13140 | 3624908 |
키움 open-api TR 목록
728x90
댓글