get_trade_history
Retrieve daily or specific date trade records including buy/sell transactions and profit/loss details for Kiwoom Securities accounts, covering up to the past two months.
Instructions
당일 또는 특정 날짜의 매매일지(매수/매도 내역, 손익)를 조회합니다 (최근 2개월까지)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| base_date | No | 조회일자 (미입력시 오늘) (YYYYMMDD 형식) | |
| account_no | No | 계좌번호 (미입력시 기본 계좌 사용) |
Implementation Reference
- src/index.ts:224-231 (handler)The underlying implementation of the trade history request logic.
async getTradeHistory(accountNo: string, baseDate?: string) { return this.request("/api/dostk/acnt", "ka10170", { acc_no: accountNo, base_dt: baseDate ?? today(), ottks_tp: "2", ch_crd_tp: "0", }); } - src/index.ts:640-657 (registration)MCP tool registration for 'get_trade_history', which calls the handler.
server.tool( "get_trade_history", "당일 또는 특정 날짜의 매매일지(매수/매도 내역, 손익)를 조회합니다 (최근 2개월까지)", { base_date: dateSchema("조회일자 (미입력시 오늘)").optional(), account_no: accountNoSchema, }, { readOnlyHint: true }, async ({ base_date, account_no }) => { try { const acct = resolveAccountNo(account_no); const data = await client.getTradeHistory(acct, base_date); return textContent(formatTradeHistory(data)); } catch (error) { return errorContent(formatError(error)); } } );