tr-opw20017(신용융자가능문의)
- REQUEST Code
string trCd = "opw20017";
string trStockCd = "005930"; //삼성전자
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 "opw20017": // 신용융자가능문의
funcOpw20017(sender, e);
break;
}
}
// 신용융자가능문의
private void funcOpw20017(object sender, AxKHOpenAPILib._DKHOpenAPIEvents_OnReceiveTrDataEvent e) {
try {
string[] columns = new string[] { "신용가능여부" };
List<string[]> list = new List<string[]>();
list.Add(columns);
Console.WriteLine("<!-- Start funcOpw20017 (신용융자가능문의) -->");
int nCnt = 1;
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);
}
string table = PrintHtmlTable(list);
string output = string.Format("\"{0}\"", string.Join("\", \"", columns));
string blog = createContents2(table, e.sTrCode, output);
tbLog.Text = blog;
Console.WriteLine("<!-- End funcOpw20017 (신용융자가능문의) -->");
}
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
신용가능여부 |
< A군 신용융자 가능 > |
키움 open-api TR 목록
728x90
댓글