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

tr-opt50038(투자자별만기손익차트요청)

by Knowledge Store In Hyunsoft 2022. 10. 10.

tr-opt50038(투자자별만기손익차트요청)

  • REQUEST Code
string trCd = "opt50038";
string endDate = "20221007";

// 일자구분 = 일자:1(선택시 반드시 일자입력), 누적:2
axKHOpenAPI.SetInputValue("일자구분", "2");
// 일자 = YYYYMMDD
//axKHOpenAPI.SetInputValue("일자", "입력값 2");
// 투자자구분 = 개인:08, 외국인:09, 금융투자:01, 투신:03, 은행:04, 기타금융:05, 보험:02, 연기금등:06, 기타법인:07
axKHOpenAPI.SetInputValue("투자자구분", "09");
// 수량금액구분 = 수량:1, 금액(백만원):2
axKHOpenAPI.SetInputValue("수량금액구분", "1");

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

 

  • RESPONSE Code
//TR 조회 요구에 대한 데이터 수신 이벤트
private void axKHOpenAPI_OnReceiveTrData(object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e) {
    switch (e.sTrCode.ToLower()) {
        case "opt50038": // 투자자별만기손익차트요청 
            funcOpt50038(sender, e);
            break;
    }
}

// 투자자별만기손익차트요청 
private void funcOpt50038(object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e) {
    try {
        string[] columns = new string[] { "평가손익", "매입단가", "투자자별순매수수량", "미결재약정", "대비기호", "전일대비", "현재가", "종목코드", "행사가", "지수환산", "ATM구분", "대칭구분", "풋_종목코드", "풋_현재가", "풋_전일대비", "풋_대비기호", "풋_미결제약정", "풋_투자자별순매수수량", "풋_매입단가", "풋_평가손익" };

        List<string[]> list = new List<string[]>();
        list.Add(columns);
        Console.WriteLine("<!-- Start funcOpt50038 (투자자별만기손익차트요청) -->");
        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 funcOpt50038 (투자자별만기손익차트요청) -->");
    }
    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
평가손익 매입단가 투자자별순매수수량 미결재약정 대비기호 전일대비 현재가 종목코드 행사가 지수환산 ATM구분 대칭구분 풋_종목코드 풋_현재가 풋_전일대비 풋_대비기호 풋_미결제약정 풋_투자자별순매수수량 풋_매입단가 풋_평가손익
0 0.00 0   3 0.00 0.01 201SA480 480.00 3690.52 3   301SA480 +189.35 +2.20 2 858 -21 191.05 +8
0 0.00 0   3 0.00 0.01 201SA477 477.50 3671.30 3   301SA477 185.95 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA475 475.00 3652.07 3   301SA475 183.45 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA472 472.50 3632.85 3   301SA472 180.95 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA470 470.00 3613.63 3   301SA470 178.45 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA467 467.50 3594.41 3   301SA467 175.95 0.00 3 2 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA465 465.00 3575.19 3   301SA465 173.45 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA462 462.50 3555.97 3   301SA462 170.95 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA460 460.00 3536.75 3   301SA460 168.45 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA457 457.50 3517.52 3   301SA457 165.95 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA455 455.00 3498.30 3   301SA455 163.45 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA452 452.50 3479.08 3   301SA452 160.95 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA450 450.00 3459.86 3   301SA450 158.45 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA447 447.50 3440.64 3   301SA447 155.95 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA445 445.00 3421.42 3   301SA445 153.45 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA442 442.50 3402.20 3   301SA442 150.95 0.00 3 0 0 0.00 0
0 0.01 +1   3 0.00 0.01 201SA440 440.00 3382.97 3   301SA440 148.45 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA437 437.50 3363.75 3   301SA437 145.95 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA435 435.00 3344.53 3   301SA435 143.45 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA432 432.50 3325.31 3   301SA432 140.95 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA430 430.00 3306.09 3   301SA430 138.45 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA427 427.50 3286.87 3   301SA427 135.95 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA425 425.00 3267.65 3   301SA425 133.45 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA422 422.50 3248.42 3   301SA422 130.95 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA420 420.00 3229.20 3   301SA420 +129.70 +1.25 2 10 -1 111.00 --4
0 0.00 0   3 0.00 0.01 201SA417 417.50 3209.98 3   301SA417 125.95 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA415 415.00 3190.76 3   301SA415 123.50 0.00 3 13 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA412 412.50 3171.54 3   301SA412 121.00 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA410 410.00 3152.32 3   301SA410 118.50 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA407 407.50 3133.10 3   301SA407 +118.20 +2.20 2 1 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA405 405.00 3113.87 3   301SA405 113.50 0.00 3 1 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA402 402.50 3094.65 3   301SA402 111.00 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA400 400.00 3075.43 3   301SA400 108.50 0.00 3 1 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA397 397.50 3056.21 3   301SA397 106.00 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA395 395.00 3036.99 3   301SA395 103.50 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA392 392.50 3017.77 3   301SA392 101.00 0.00 3 0 0 0.00 0
0 0.01 +244   3 0.00 0.01 201SA390 390.00 2998.55 3   301SA390 98.50 0.00 3 1 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA387 387.50 2979.32 3   301SA387 96.00 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA385 385.00 2960.10 3   301SA385 93.50 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA382 382.50 2940.88 3   301SA382 91.00 0.00 3 0 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA380 380.00 2921.66 3   301SA380 88.50 0.00 3 1 0 0.00 0
0 0.00 0   3 0.00 0.01 201SA377 377.50 2902.44 3   301SA377 86.00 0.00 3 0 0 0.00 0
0 0.01 -2   3 0.00 0.01 201SA375 375.00 2883.22 3   301SA375 83.50 0.00 3 0 0 0.00 0
+0 2.10 -1   3 0.00 0.01 201SA372 372.50 2864.00 3   301SA372 81.00 0.00 3 0 0 0.00 0
0 0.01 +9   3 0.00 0.01 201SA370 370.00 2844.77 3   301SA370 78.50 0.00 3 15 0 0.00 0
0 0.01 +76   3 0.00 0.01 201SA367 367.50 2825.55 3   301SA367 76.00 0.00 3 0 0 0.00 0
0 0.01 -2   3 0.00 0.01 201SA365 365.00 2806.33 3   301SA365 73.50 0.00 3 0 0 0.00 0
0 0.01 +6   3 0.00 0.01 201SA362 362.50 2787.11 3   301SA362 71.00 0.00 3 0 0 0.00 0
0 0.01 +76   3 0.00 0.01 201SA360 360.00 2767.89 3   301SA360 68.50 0.00 3 5 0 0.00 0
0 0.01 -28   3 0.00 0.01 201SA357 357.50 2748.67 3   301SA357 66.00 0.00 3 1 0 0.00 0
0 0.01 +32   3 0.00 0.01 201SA355 355.00 2729.45 3   301SA355 +61.20 +0.20 2 80 +1 69.93 --2
0 0.01 -157   3 0.00 0.01 201SA352 352.50 2710.22 3   301SA352 61.00 0.00 3 13 0 0.00 0
+0 0.02 -285   3 0.00 0.01 201SA350 350.00 2691.00 3   301SA350 58.50 0.00 3 518 +2 59.80 -0
-0 0.02 +1   3 0.00 0.01 201SA347 347.50 2671.78 3   301SA347 56.05 0.00 3 1 0 0.00 0
+1 0.03 -303   3 0.00 0.01 201SA345 345.00 2652.56 3   301SA345 54.30 0.00 3 103 0 0.00 0
+8 0.07 -580   3 0.00 0.01 201SA342 342.50 2633.34 3   301SA342 51.20 0.00 3 3 0 0.00 0
+2 0.08 -132   3 0.00 0.01 201SA340 340.00 2614.12 3   301SA340 47.00 0.00 3 364 0 0.00 0
+30 0.16 -817   3 0.00 0.01 201SA337 337.50 2594.90 3   301SA337 44.80 0.00 3 11 0 0.00 0
+47 0.26 -767   3 0.00 0.01 201SA335 335.00 2575.67 3   301SA335 +44.10 +2.10 2 157 -3 43.18 -0
+274 0.47 -2391   3 0.00 0.01 201SA332 332.50 2556.45 3   301SA332 +42.70 +1.65 2 211 +7 32.50 +17
--2978 0.73 +16546   3 0.00 0.01 201SA330 330.00 2537.23 3   301SA330 +39.15 +0.65 2 2499 -4 23.14 --16
--2117 0.96 +8917   3 0.00 0.01 201SA327 327.50 2518.01 3   301SA327 +38.25 +2.20 2 351 -3 12.72 --19
+1665 1.06 -6343   3 0.00 0.01 201SA325 325.00 2498.79 3   301SA325 +34.00 +0.65 2 2870 -4 13.25 --20
+599 1.07 -2262   3 0.00 0.01 201SA322 322.50 2479.57 3   301SA322 +33.50 +4.10 2 1033 -15 10.89 --84
+163 1.21 -544   3 0.00 0.01 201SA320 320.00 2460.35 3   301SA320 +29.70 +0.90 2 5818 -109 9.24 --557
+1520 1.27 -4827   3 0.00 0.01 201SA317 317.50 2441.12 3   301SA317 25.60 0.00 3 3793 -109 9.40 --441
+1510 1.12 -5443   4 -0.01 -0.01 201SA315 315.00 2421.90 3   301SA315 +24.45 +1.15 2 6901 -209 7.08 --907
--496 1.06 +1891   4 -0.02 -0.01 201SA312 312.50 2402.68 3   301SA312 +22.30 +1.30 2 5278 -353 6.08 --1431
+1883 0.99 -7765   5 -0.02 -0.02 201SA310 310.00 2383.46 3   301SA310 +19.70 +0.95 2 19511 -384 5.26 --1386
+937 0.85 -4575   5 -0.05 -0.03 201SA307 307.50 2364.24 3   301SA307 +17.25 +1.40 2 14377 +113 4.28 +366
--4174 0.67 +27832   5 -0.09 -0.07 201SA305 305.00 2345.02 3   301SA305 +14.95 +1.40 2 18784 -6135 3.26 --17929
+749 0.74 -5081   5 -0.16 -0.15 201SA302 302.50 2325.79 3   301SA302 +12.40 +0.95 2 15947 +2101 2.56 +5168
+1166 0.80 -9525   5 -0.27 -0.31 201SA300 300.00 2306.57 3   301SA300 +10.25 +1.00 2 17145 -7850 2.30 --15601
--1950 0.95 +24378   5 -0.39 -0.63 201SA297 297.50 2287.35 3   301SA297 +8.06 +0.86 2 16111 -11989 1.95 --18313
+57 1.37 -1205   5 -0.55 -1.18 201SA295 295.00 2268.13 3   301SA295 +6.10 +0.69 2 26209 +18528 1.86 +19639
+834 1.82 +20870   5 -0.76 -1.98 201SA292 292.50 2248.91 1   301SA292 +4.41 +0.51 2 20015 +6752 1.67 +4625
--406 2.38 -2166   5 -0.93 -3.13 201SA290 290.00 2229.69 2   301SA290 +3.05 +0.33 2 32171 +24537 1.62 +8771
--442 3.68 -1904   5 -1.07 -4.61 201SA287 287.50 2210.47 2   301SA287 +2.03 +0.19 2 22428 +15548 1.58 +1749
--25 4.95 -71   5 -1.11 -6.38 201SA285 285.00 2191.24 2   301SA285 +1.31 +0.11 2 34521 +34873 1.38 --610
--80 5.86 -129   5 -1.21 -8.35 201SA282 282.50 2172.02 2   301SA282 +0.81 +0.05 2 50419 -2895 1.14 +238
--76 7.57 -98   5 -1.35 -10.70 201SA280 280.00 2152.80 2   301SA280 +0.50 +0.04 2 46999 +19076 1.11 --2909
--4 8.86 -4   5 -2.40 -13.00 201SA277 277.50 2133.58 2   301SA277 0.30 0.00 3 39047 -10655 1.18 +2344
--7 11.35 -7   5 -0.70 -15.80 201SA275 275.00 2114.36 2   301SA275 0.19 0.00 3 38602 +17289 1.13 --4062
+9 12.71 +7   5 -2.00 -18.00 201SA272 272.50 2095.14 2   301SA272 -0.12 -0.01 5 30262 -8094 1.12 +2023
+4 15.25 +4   5 -1.25 -20.10 201SA270 270.00 2075.92 2   301SA270 -0.08 -0.02 5 41166 -9287 1.05 +2252
--1 15.70 -1   5 -0.95 -23.00 201SA267 267.50 2056.69 2   301SA267 -0.05 -0.01 5 38025 +28359 1.03 --6947
+6 19.70 +4   3 0.00 26.40 201SA265 265.00 2037.47 2   301SA265 -0.05 -0.01 5 29920 +37581 0.85 --7516
0 0.00 0   3 0.00 28.95 201SA262 262.50 2018.25 2   301SA262 -0.03 -0.01 5 21583 +11684 0.67 --1869
0 0.00 0   3 0.00 31.45 201SA260 260.00 1999.03 2   301SA260 -0.02 -0.01 5 37437 +5614 0.44 --589
0 0.00 0   3 0.00 33.90 201SA257 257.50 1979.81 2   301SA257 0.02 0.00 3 31848 +5433 0.32 --407
0 0.00 0   3 0.00 36.40 201SA255 255.00 1960.59 2   301SA255 -0.01 -0.01 4 13065 -1696 0.25 +101
0 0.00 0   3 0.00 38.90 201SA252 252.50 1941.37 2   301SA252 0.01 0.00 3 25056 -1513 0.20 +71
0 0.00 0   3 0.00 41.40 201SA250 250.00 1922.14 2   301SA250 0.01 0.00 3 56445 +375 0.13 --11
0 0.00 0   3 0.00 43.90 201SA247 247.50 1902.92 2   301SA247 0.01 0.00 3 46290 -2976 0.12 +81
0 0.00 0   3 0.00 46.40 201SA245 245.00 1883.70 2   301SA245 0.01 0.00 3 27712 -926 0.10 +20
0 0.00 0   3 0.00 48.90 201SA242 242.50 1864.48 2   301SA242 0.01 0.00 3 42910 -1437 0.06 +17
0 0.00 0   3 0.00 51.40 201SA240 240.00 1845.26 2   301SA240 0.01 0.00 3 23995 -1077 0.06 +13
0 0.00 0   3 0.00 53.90 201SA237 237.50 1826.04 2   301SA237 0.01 0.00 3 21181 -965 0.06 +12
0 0.00 0   3 0.00 56.40 201SA235 235.00 1806.82 2   301SA235 0.01 0.00 3 24052 -582 0.04 +4
0 0.00 0   3 0.00 58.90 201SA232 232.50 1787.59 2   301SA232 0.01 0.00 3 45959 -1517 0.03 +7
0 0.00 0   3 0.00 61.40 201SA230 230.00 1768.37 2   301SA230 0.01 0.00 3 22400 -404 0.04 +3
0 0.00 0   3 0.00 63.90 201SA227 227.50 1749.15 2   301SA227 0.01 0.00 3 18068 -542 0.03 +2
0 0.00 0   3 0.00 66.40 201SA225 225.00 1729.93 2   301SA225 0.01 0.00 3 14471 -734 0.02 +1
0 0.00 0   3 0.00 68.90 201SA222 222.50 1710.71 2   301SA222 0.01 0.00 3 11263 -425 0.02 +1
0 0.00 0   3 0.00 71.40 201SA220 220.00 1691.49 2   301SA220 0.01 0.00 3 14353 -638 0.01 0
0 0.00 0   3 0.00 73.90 201SA217 217.50 1672.27 2   301SA217 0.01 0.00 3 13583 -762 0.01 0
0 0.00 0   5 -1.30 -74.15 201SA215 215.00 1653.04 2   301SA215 0.01 0.00 3 10226 +14 0.01 0
0 0.00 0   3 0.00 78.90 201SA212 212.50 1633.82 2   301SA212 0.01 0.00 3 7152 -252 0.01 0
0 0.00 0   3 0.00 81.40 201SA210 210.00 1614.60 2   301SA210 0.01 0.00 3 5121 -83 0.01 0
0 0.00 0   3 0.00 83.90 201SA207 207.50 1595.38 2   301SA207 0.01 0.00 3 6229 -31 0.01 0
0 0.00 0   3 0.00 86.40 201SA205 205.00 1576.16 2   301SA205 0.01 0.00 3 12514 +160 0.01 0
0 0.00 0   3 0.00 88.90 201SA202 202.50 1556.94 2   301SA202 0.01 0.00 3 3364 -91 0.01 0
0 0.00 0   3 0.00 91.40 201SA200 200.00 1537.72 2   301SA200 0.01 0.00 3 2614 -26 0.01 0
0 0.00 0   3 0.00 93.90 201SA197 197.50 1518.49 2   301SA197 0.01 0.00 3 3237 -3 0.01 0
0 0.00 0   3 0.00 96.40 201SA195 195.00 1499.27 2   301SA195 0.01 0.00 3 10306 -19 0.01 0
0 0.00 0   3 0.00 98.90 201SA192 192.50 1480.05 2   301SA192 0.01 0.00 3 6626 +8 0.01 0
0 0.00 0   3 0.00 101.40 201SA190 190.00 1460.83 2   301SA190 0.01 0.00 3 6623 +6 0.01 0
0 0.00 0   3 0.00 103.90 201SA187 187.50 1441.61 2   301SA187 0.01 0.00 3 5918 +3 0.01 0
--1 101.76 -1   3 0.00 106.40 201SA185 185.00 1422.39 2   301SA185 0.01 0.00 3 4641 +5 0.01 0
0 0.00 0   3 0.00 108.90 201SA182 182.50 1403.17 2   301SA182 0.01 0.00 3 4644 -11 0.01 0
+0 112.22 -2   3 0.00 111.35 201SA180 180.00 1383.94 2   301SA180 0.01 0.00 3 13185 +3 0.01 0

 

키움 open-api TR 목록

728x90

댓글