본문 바로가기
키움자동매매

🥰 tr-opt10013(신용매매동향요청)

by Knowledge Store In Hyunsoft 2022. 10. 8.

tr-opt10013(신용매매동향요청)

  • REQUEST Code
string trStockCd = tbTrStockCd.Text;
string trCd = "opt10013";
string endDate ="20220930";

axKHOpenAPI.SetInputValue("종목코드", trStockCd);
//일자 = YYYYMMDD (20160101 연도4자리, 월 2자리, 일 2자리 형식)
axKHOpenAPI.SetInputValue("일자", endDate);
//조회구분 = 1:융자, 2:대주
axKHOpenAPI.SetInputValue("조회구분", "2");

axKHOpenAPI.CommRqData("RQName", trCd, 0, GetScrNum());

 

  • RESPONSE Code
//TR 조회 요구에 대한 데이터 수신 이벤트
private void axKHOpenAPI_OnReceiveTrData(object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e) {
    switch (e.sTrCode.ToLower()) {
        case "opt10013": // 신용매매동향요청 
            funcOpt10013(sender, e);
            break;
    }
}

// 신용매매동향요청 
private void funcOpt10013(object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e) {
    try {
		string[] columns = new string[] { "일자", "현재가", "전일대비기호", "전일대비", "거래량", "신규", "상환", "잔고", "금액", "대비", "공여율", "잔고율" };
        

        List<string[]> list = new List<string[]>();
        list.Add(columns);
        Console.WriteLine("<!-- Start funcOpt10013 (신용매매동향요청) -->");
        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 funcOpt10013 (신용매매동향요청) -->");
    }
    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
일자 현재가 전일대비기호 전일대비 거래량 신규 상환 잔고 금액 대비 공여율 잔고율
20220930 +53100 2 +500 22503249 181 8968 3787 209 -8787 0.00 0.00
20220929 -52600 5 -300 13882080 1614 1114 12574 688 500 0.00 0.00
20220928 -52900 5 -1300 19991129 1854 1039 12074 661 815 0.01 0.00
20220927 +54200 2 +300 16631289 9703 5495 11259 618 4208 0.09 0.00
20220926 -53900 5 -600 15008449 1504 816 7051 400 688 0.01 0.00
20220923 +54500 2 +100 10555964 304 1996 6363 364 -1692 0.00 0.00
20220922 -54400 5 -900 12786510 747 1153 8055 461 -406 0.00 0.00
20220921 -55300 5 -500 11863700 1242 670 8461 485 572 0.00 0.00
20220920 -55800 5 -600 14041465 669 1693 7889 454 -1024 0.00 0.00
20220919 +56400 2 +200 12278653 1661 2287 8913 512 -626 0.01 0.00
20220916 +56200 2 +200 13456503 1361 3815 9539 549 -2454 0.01 0.00
20220915 -56000 5 -800 11664819 8937 1076 11993 691 7861 0.05 0.00
20220914 -56800 5 -1300 12524961 305 534 4132 238 -229 0.00 0.00
20220913 +58100 2 +2500 17166581 923 3042 4361 253 -2119 0.00 0.00
20220908 -55600 5 -400 18000016 674 2231 6480 375 -1557 0.00 0.00
20220907 -56000 5 -1100 17384854 1307 1770 8037 466 -463 0.01 0.00
20220906 57100 3 0 7503086 580 391 8500 494 189 0.00 0.00
20220905 -57100 5 -400 11425977 786 852 8311 483 -66 0.00 0.00
20220902 -57500 5 -900 15040310 817 549 8377 488 268 0.00 0.00
20220901 -58400 5 -1300 14905777 818 296 8109 471 522 0.00 0.00
20220831 +59700 2 +900 14203512 423 667 7587 441 -244 0.00 0.00
20220830 +58800 2 +200 9690044 473 1731 7831 455 -1258 0.00 0.00
20220829 -58600 5 -1400 9841329 2581 1728 9089 530 853 0.04 0.00
20220826 +60000 2 +300 9499995 153 1167 8236 480 -1014 0.00 0.00
20220825 +59700 2 +700 5767902 1014 3326 9250 540 -2312 0.00 0.00
20220824 -59000 5 -100 8888486 399 604 11562 681 -205 0.00 0.00
20220823 -59100 5 -900 9041629 152 1496 11767 693 -1344 0.00 0.00
20220822 -60000 5 -900 8259865 4397 715 13111 775 3682 0.02 0.00
20220819 -60900 5 -600 6923679 73 537 9429 552 -464 0.00 0.00
20220818 +61500 2 +1100 16372754 159 212 9893 579 -53 0.00 0.00
20220817 -60400 5 -600 9061518 788 444 9946 582 344 0.00 0.00
20220816 +61000 2 +800 15036727 559 1564 9602 561 -1005 0.00 0.00
20220812 +60200 2 +300 10786658 884 2475 10607 621 -1591 0.00 0.00
20220811 +59900 2 +800 15141941 1279 6995 12198 717 -5716 0.00 0.00
20220810 -59100 5 -900 18084349 66 1343 17914 1069 -1277 0.00 0.00
20220809 -60000 5 -800 18251170 22 933 19191 1145 -911 0.00 0.00
20220808 -60800 5 -700 11313150 62 121 19011 1132 -59 0.00 0.00
20220805 61500 3 0 9567620 421 1897 19861 1184 -1476 0.00 0.00
20220804 +61500 2 +200 9125439 2177 16 21337 1274 2161 0.01 0.00
20220803 -61300 5 -400 10053861 500 958 19176 1141 -458 0.00 0.00
20220802 +61700 2 +400 13614895 517 1298 19634 1169 -781 0.00 0.00
20220801 -61300 5 -100 13154816 1912 842 20415 1215 1070 0.01 0.00
20220729 -61400 5 -500 15093120 714 1471 19345 1148 -757 0.00 0.00
20220728 +61900 2 +100 10745302 828 714 20102 1193 114 0.01 0.00
20220727 +61800 2 +100 7320997 1621 1378 19988 1186 243 0.01 0.00
20220726 +61700 2 +600 6597211 2173 2074 19745 1171 99 0.02 0.00
20220725 -61100 5 -200 9193681 2620 1677 19646 1163 943 0.01 0.00
20220722 -61300 5 -500 10261310 2861 1912 18703 1106 949 0.01 0.00
20220721 +61800 2 +1300 12291374 1582 6780 17754 1046 -5198 0.01 0.00
20220720 -60500 5 -400 16782238 7282 4942 22952 1363 2340 0.03 0.00
20220719 -60900 5 -1000 15248261 12109 1839 20612 1206 10270 0.06 0.00
20220718 +61900 2 +1900 20832517 1589 3209 10342 596 -1620 0.01 0.00
20220715 +60000 2 +2500 18685583 466 1547 11962 690 -1081 0.00 0.00
20220714 -57500 5 -500 15067012 317 3486 13043 754 -3169 0.00 0.00
20220713 -58000 5 -100 10841315 3961 1653 16212 940 2308 0.02 0.00
20220712 -58100 5 -700 9336061 2240 797 13904 804 1443 0.01 0.00
20220711 +58800 2 +100 13042624 9192 2376 12461 717 6816 0.04 0.00
20220708 +58700 2 +500 15339271 485 1988 5645 325 -1503 0.00 0.00
20220707 +58200 2 +1800 21322833 759 1191 7148 411 -432 0.00 0.00
20220706 -56400 5 -800 16820461 4881 631 7580 435 4250 0.02 0.00
20220705 +57200 2 +100 14216539 1478 1556 3330 193 -78 0.00 0.00
20220704 +57100 2 +900 17807126 1649 4038 3408 199 -2389 0.00 0.00
20220701 -56200 5 -800 24982097 1049 2709 5797 340 -1660 0.00 0.00
20220630 -57000 5 -1000 18915142 1556 1074 7457 438 482 0.01 0.00
20220629 -58000 5 -1400 14677138 2483 704 6975 410 1779 0.01 0.00
20220628 +59400 2 +600 13540538 2706 2465 5196 304 241 0.01 0.00
20220627 +58800 2 +400 18122236 4356 4057 4955 288 299 0.01 0.00
20220624 +58400 2 +1000 23256103 2565 2041 4656 274 524 0.01 0.00
20220623 -57400 5 -200 28338608 1214 4424 4132 245 -3210 0.00 0.00
20220622 -57600 5 -900 23334687 3320 2445 7342 438 875 0.00 0.00
20220621 -58500 5 -200 25148109 4900 4809 6467 401 91 0.01 0.00
20220620 -58700 5 -1100 34111306 2302 507 6376 400 1795 0.00 0.00
20220617 -59800 5 -1100 29053450 3057 1353 4581 291 1704 0.01 0.00
20220616 +60900 2 +200 23394895 1553 1864 2877 189 -311 0.00 0.00
20220615 -60700 5 -1200 26811224 1255 645 3188 211 610 0.00 0.00
20220614 -61900 5 -200 24606419 159 6265 2578 174 -6106 0.00 0.00
20220613 -62100 5 -1700 22157816 894 1347 8684 576 -453 0.00 0.00
20220610 -63800 5 -1400 22193552 177 414 9137 607 -237 0.00 0.00
20220609 -65200 5 -100 25790725 1030 2291 9374 623 -1261 0.00 0.00
20220608 -65300 5 -200 12483180 173 44 10635 707 129 0.00 0.00
20220607 -65500 5 -1300 19355755 705 270 10506 698 435 0.00 0.00
20220603 +66800 2 +100 8222883 338 685 10071 670 -347 0.00 0.00
20220602 -66700 5 -700 14959443 21 199 10418 693 -178 0.00 0.00
20220531 -67400 5 -300 24365002 1066 121 10596 705 945 0.00 0.00
20220530 +67700 2 +1200 14255484 67 307 9651 642 -240 0.00 0.00
20220527 +66500 2 +600 11405555 206 970 9891 658 -764 0.00 0.00
20220526 -65900 5 -500 15970890 1122 1741 10655 709 -619 0.00 0.00
20220525 -66400 5 -100 15150490 203 49 11274 752 154 0.00 0.00
20220524 -66500 5 -1400 15482576 255 465 11120 742 -210 0.00 0.00
20220523 -67900 5 -100 13684088 748 1606 11330 756 -858 0.00 0.00
20220520 +68000 2 +500 12109671 1144 152 12188 815 992 0.00 0.00
20220519 -67500 5 -600 17073727 2746 155 11196 747 2591 0.01 0.00
20220518 +68100 2 +500 16486319 391 333 8605 572 58 0.00 0.00
20220517 +67600 2 +1300 15680447 613 253 8547 568 360 0.00 0.00
20220516 -66300 5 -200 11937555 1507 2299 8187 544 -792 0.00 0.00
20220513 +66500 2 +1600 14551536 5621 167 8979 597 5454 0.04 0.00
20220512 -64900 5 -800 16414188 627 8316 3525 238 -7689 0.00 0.00
20220511 65700 3 0 12330920 1425 438 11214 755 987 0.01 0.00
20220510 -65700 5 -400 17235605 216 3743 10227 691 -3527 0.00 0.00
20220509 -66100 5 -400 11858736 1315 509 13754 928 806 0.01 0.00

 

키움 open-api TR 목록

728x90

댓글