Files
auto-trade/features/kis-realtime/utils/websocketUtils.ts

30 lines
603 B
TypeScript

/**
* @file features/kis-realtime/utils/websocketUtils.ts
* @description KIS 웹소켓 메시지 생성 및 파싱 관련 유틸리티 함수 모음
*/
/**
* @description KIS 실시간 구독/해제 소켓 메시지를 생성합니다.
*/
export function buildKisRealtimeMessage(
approvalKey: string,
symbol: string,
trId: string,
trType: "1" | "2",
) {
return {
header: {
approval_key: approvalKey,
custtype: "P",
tr_type: trType,
"content-type": "utf-8",
},
body: {
input: {
tr_id: trId,
tr_key: symbol,
},
},
};
}