tr-opt20068(대차거래추이요청)
- REQUEST Code
string trCd = "opt20068";
string trStockCd = "005930"; //삼성전자
string startDate = "20221004";
string endDate = "20221007";
// 시작일자 = YYYYMMDD (20160101 연도4자리, 월 2자리, 일 2자리 형식)
axKHOpenAPI.SetInputValue("시작일자", "startDate");
// 종료일자 = YYYYMMDD (20160101 연도4자리, 월 2자리, 일 2자리 형식)
axKHOpenAPI.SetInputValue("종료일자", endDate);
// 전체구분 = 0:종목코드 입력종목만 표시, 1: 전체표시(지원안함. OPT10068사용).
axKHOpenAPI.SetInputValue("전체구분", "0");
axKHOpenAPI.SetInputValue("종목코드", trStockCd);
axKHOpenAPI.CommRqData("RQName", trCd, 0, GetScrNum());
- RESPONSE Code
//TR 조회 요구에 대한 데이터 수신 이벤트
private void axKHOpenAPI_OnReceiveTrData(object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e) {
switch (e.sTrCode.ToLower()) {
case "opt20068": // 대차거래추이요청
funcOpt20068(sender, e);
break;
}
}
// 대차거래추이요청
private void funcOpt20068(object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e) {
try {
string[] columns = new string[] { "일자", "대차거래체결주수", "대차거래상환주수", "대차거래증감", "잔고주수", "잔고금액" };
List<string[]> list = new List<string[]>();
list.Add(columns);
Console.WriteLine("<!-- Start funcOpt20068 (대차거래추이요청) -->");
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 funcOpt20068 (대차거래추이요청) -->");
}
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
일자 | 대차거래체결주수 | 대차거래상환주수 | 대차거래증감 | 잔고주수 | 잔고금액 |
20221007 | 4690830 | 1696256 | 2994574 | 112650730 | 6330971 |
20221006 | 5530508 | 6369157 | -838649 | 109656156 | 6173642 |
20221005 | 1480780 | 2844401 | -1363621 | 110494805 | 6187709 |
20221004 | 1785001 | 1148453 | 636548 | 111858426 | 6174585 |
20220930 | 1980531 | 1542159 | 438372 | 111221878 | 5905882 |
20220929 | 2708594 | 7432828 | -4724234 | 110783506 | 5827212 |
20220928 | 3899715 | 4185088 | -285373 | 115507740 | 6110359 |
20220927 | 12263431 | 1301713 | 10961718 | 115793113 | 6275987 |
20220926 | 1676753 | 5399698 | -3722945 | 104831395 | 5650412 |
20220923 | 1335066 | 1474831 | -139765 | 108554340 | 5916212 |
20220922 | 3171196 | 3057265 | 113931 | 108694105 | 5912959 |
20220921 | 1890221 | 4135234 | -2245013 | 108580174 | 6004484 |
20220920 | 2377988 | 1687769 | 690219 | 110825187 | 6184045 |
20220919 | 5044116 | 2784929 | 2259187 | 110134968 | 6211612 |
20220916 | 1739807 | 1514841 | 224966 | 107875781 | 6062619 |
20220915 | 2422457 | 2023161 | 399296 | 107650815 | 6028446 |
20220914 | 2474427 | 2851956 | -377529 | 107251519 | 6091886 |
20220913 | 5045813 | 2378228 | 2667585 | 107629048 | 6253248 |
20220908 | 2343174 | 4148694 | -1805520 | 104961463 | 5835857 |
20220907 | 1821879 | 1194286 | 627593 | 106766983 | 5978951 |
20220906 | 1191574 | 2885745 | -1694171 | 106139390 | 6060559 |
20220905 | 2988008 | 1408439 | 1579569 | 107833561 | 6157296 |
20220902 | 2920826 | 358434 | 2562392 | 106253992 | 6109605 |
20220901 | 1534687 | 1450335 | 84352 | 103691600 | 6055589 |
20220831 | 1944569 | 542522 | 1402047 | 103607248 | 6185353 |
20220830 | 1064464 | 919564 | 144900 | 102205201 | 6009666 |
20220829 | 1166099 | 3389035 | -2222936 | 102060301 | 5980734 |
20220826 | 3085557 | 1046253 | 2039304 | 104283237 | 6256994 |
20220825 | 2645772 | 2139700 | 506072 | 102243933 | 6103963 |
20220824 | 768627 | 630277 | 138350 | 101737861 | 6002534 |
20220823 | 1603850 | 699511 | 904339 | 101599511 | 6004531 |
20220822 | 1811218 | 204347 | 1606871 | 100695172 | 6041710 |
20220819 | 2158924 | 2091949 | 66975 | 99088301 | 6034478 |
20220818 | 1320470 | 2122802 | -802332 | 99021326 | 6089812 |
20220817 | 872974 | 1625985 | -753011 | 99823658 | 6029349 |
20220816 | 2342972 | 2139043 | 203929 | 100576669 | 6135177 |
20220812 | 669157 | 827651 | -158494 | 100372740 | 6042439 |
20220811 | 767454 | 545384 | 222070 | 100531234 | 6021821 |
20220810 | 1900622 | 8470385 | -6569763 | 100309164 | 5928272 |
20220809 | 1180228 | 4207341 | -3027113 | 106878927 | 6412736 |
20220808 | 3060501 | 777029 | 2283472 | 109906040 | 6682287 |
20220805 | 644740 | 668109 | -23369 | 107622568 | 6618788 |
20220804 | 2031732 | 677749 | 1353983 | 107645937 | 6620225 |
20220803 | 719002 | 644679 | 74323 | 106291954 | 6515697 |
20220802 | 2615959 | 1254695 | 1361264 | 106217631 | 6553628 |
20220801 | 2572652 | 2601387 | -28735 | 104856367 | 6427695 |
20220729 | 1892759 | 1592355 | 300404 | 104885102 | 6439945 |
20220728 | 7703528 | 276808 | 7426720 | 104584698 | 6473793 |
20220727 | 5431995 | 2178882 | 3253113 | 97157978 | 6004363 |
20220726 | 1011678 | 325809 | 685869 | 93904865 | 5793930 |
20220725 | 1080090 | 1422347 | -342257 | 93218996 | 5695681 |
20220722 | 378765 | 1461102 | -1082337 | 93561253 | 5735305 |
20220721 | 670721 | 3811210 | -3140489 | 94643590 | 5848974 |
20220720 | 1001169 | 2355673 | -1354504 | 97784079 | 5915937 |
20220719 | 2739984 | 1796308 | 943676 | 99138583 | 6037540 |
20220718 | 3510661 | 2520493 | 990168 | 98194907 | 6078265 |
20220715 | 1626149 | 525001 | 1101148 | 97204739 | 5832284 |
20220714 | 692478 | 2617120 | -1924642 | 96103591 | 5525956 |
20220713 | 1299352 | 1758845 | -459493 | 98028233 | 5685638 |
20220712 | 1261861 | 434376 | 827485 | 98487726 | 5722137 |
20220711 | 2617935 | 994268 | 1623667 | 97660241 | 5742422 |
20220708 | 1890443 | 2032318 | -141875 | 96036574 | 5637347 |
20220707 | 2769148 | 2497663 | 271485 | 96178449 | 5597586 |
20220706 | 1538465 | 1621856 | -83391 | 95906964 | 5409153 |
20220705 | 2284975 | 1059649 | 1225326 | 95990355 | 5490648 |
20220704 | 12136913 | 1946169 | 10190744 | 94765029 | 5411083 |
20220701 | 2990409 | 532740 | 2457669 | 84574285 | 4753075 |
20220630 | 839010 | 1683687 | -844677 | 82116616 | 4680647 |
20220629 | 883385 | 5670061 | -4786676 | 82961293 | 4811755 |
20220628 | 6509794 | 16753346 | -10243552 | 87747969 | 5212229 |
20220627 | 1139024 | 7306889 | -6167865 | 97991521 | 5761901 |
20220624 | 3078183 | 4494449 | -1416266 | 104159386 | 6082908 |
20220623 | 2271962 | 3682653 | -1410691 | 105575652 | 6060042 |
20220622 | 559475 | 1187138 | -627663 | 106986343 | 6162413 |
20220621 | 3073443 | 4209918 | -1136475 | 107614006 | 6295419 |
20220620 | 4080227 | 2098095 | 1982132 | 108750481 | 6383653 |
20220617 | 2800397 | 2083825 | 716572 | 106768349 | 6384747 |
20220616 | 1850325 | 1829969 | 20356 | 106051777 | 6458553 |
20220615 | 1742393 | 1367469 | 374924 | 106031421 | 6436107 |
20220614 | 6478424 | 3297128 | 3181296 | 105656497 | 6540137 |
20220613 | 4816410 | 2046677 | 2769733 | 102475201 | 6363710 |
20220610 | 3363152 | 1361797 | 2001355 | 99705468 | 6361209 |
20220609 | 1053457 | 1868440 | -814983 | 97816277 | 6377621 |
20220608 | 1754285 | 4101667 | -2347382 | 98631260 | 6440621 |
20220607 | 1895881 | 4659298 | -2763417 | 100978642 | 6614101 |
20220603 | 1480397 | 1189549 | 290848 | 103742059 | 6929970 |
20220602 | 1737575 | 2003432 | -265857 | 103451211 | 6900196 |
20220531 | 1955437 | 2138229 | -182792 | 103717068 | 6990530 |
20220530 | 1627371 | 2348085 | -720714 | 103899860 | 7034021 |
20220527 | 817057 | 675762 | 141295 | 104620574 | 6957268 |
20220526 | 1735971 | 1289765 | 446206 | 104479279 | 6885184 |
20220525 | 1623478 | 549624 | 1073854 | 104033073 | 6907796 |
20220524 | 918908 | 2538339 | -1619431 | 102959219 | 6846788 |
20220523 | 620287 | 2354020 | -1733733 | 104578650 | 7100890 |
20220520 | 795696 | 1587070 | -791374 | 106312383 | 7229242 |
20220519 | 826964 | 605373 | 221591 | 107103757 | 7229504 |
20220518 | 841528 | 713623 | 127905 | 106882166 | 7278676 |
20220517 | 1020792 | 474821 | 545971 | 106754261 | 7216588 |
20220516 | 2044373 | 917652 | 1126721 | 106208290 | 7041610 |
20220513 | 4267988 | 1253211 | 3014777 | 105081569 | 6987924 |
키움 open-api TR 목록
728x90
댓글