임시커밋

This commit is contained in:
2026-02-11 16:31:28 +09:00
parent f650d51f68
commit 3cea3e66d0
45 changed files with 289 additions and 236 deletions

View File

@@ -1,221 +0,0 @@
/**
* @file features/dashboard/types/dashboard.types.ts
* @description 대시보드(검색/시세/차트)에서 공통으로 쓰는 타입 모음
*/
export type KisTradingEnv = "real" | "mock";
export type DashboardPriceSource =
| "inquire-price"
| "inquire-ccnl"
| "inquire-overtime-price";
export type DashboardMarketPhase = "regular" | "afterHours";
/**
* KOSPI/KOSDAQ 종목 인덱스 항목
*/
export interface KoreanStockIndexItem {
symbol: string;
name: string;
market: "KOSPI" | "KOSDAQ";
standardCode: string;
}
/**
* 차트 1개 점(시점 + 가격)
*/
export interface StockCandlePoint {
time: string;
price: number;
open?: number;
high?: number;
low?: number;
close?: number;
volume?: number;
timestamp?: number;
}
export type DashboardChartTimeframe = "1m" | "30m" | "1h" | "1d" | "1w";
/**
* 호가창 1레벨(가격 + 잔량)
*/
export interface DashboardOrderBookLevel {
askPrice: number;
bidPrice: number;
askSize: number;
bidSize: number;
}
/**
* 대시보드 종목 상세 모델
*/
export interface DashboardStockItem {
symbol: string;
name: string;
market: "KOSPI" | "KOSDAQ";
currentPrice: number;
change: number;
changeRate: number;
open: number;
high: number;
low: number;
prevClose: number;
volume: number;
candles: StockCandlePoint[];
}
/**
* 검색 결과 1개 항목
*/
export interface DashboardStockSearchItem {
symbol: string;
name: string;
market: "KOSPI" | "KOSDAQ";
}
/**
* 검색 히스토리 1개 항목
* @see features/dashboard/hooks/useStockSearch.ts localStorage에 저장/복원할 때 사용합니다.
*/
export interface DashboardStockSearchHistoryItem
extends DashboardStockSearchItem {
savedAt: number;
}
/**
* 종목 검색 API 응답
*/
export interface DashboardStockSearchResponse {
query: string;
items: DashboardStockSearchItem[];
total: number;
}
/**
* 종목 개요 API 응답
*/
export interface DashboardStockOverviewResponse {
stock: DashboardStockItem;
source: "kis";
priceSource: DashboardPriceSource;
marketPhase: DashboardMarketPhase;
tradingEnv: KisTradingEnv;
fetchedAt: string;
}
export interface DashboardStockChartResponse {
symbol: string;
timeframe: DashboardChartTimeframe;
candles: StockCandlePoint[];
nextCursor: string | null;
hasMore: boolean;
fetchedAt: string;
}
/**
* 종목 호가 API 응답
*/
export interface DashboardStockOrderBookResponse {
symbol: string;
source: "kis" | "REALTIME";
levels: DashboardOrderBookLevel[];
totalAskSize: number;
totalBidSize: number;
businessHour?: string;
hourClassCode?: string;
accumulatedVolume?: number;
anticipatedPrice?: number;
anticipatedVolume?: number;
anticipatedTotalVolume?: number;
anticipatedChange?: number;
anticipatedChangeSign?: string;
anticipatedChangeRate?: number;
totalAskSizeDelta?: number;
totalBidSizeDelta?: number;
tradingEnv: KisTradingEnv | string;
fetchedAt: string;
}
/**
* 실시간 체결(틱) 1건 모델
*/
export interface DashboardRealtimeTradeTick {
symbol: string;
tickTime: string;
price: number;
change: number;
changeRate: number;
tradeVolume: number;
accumulatedVolume: number;
tradeStrength: number;
askPrice1: number;
bidPrice1: number;
sellExecutionCount: number;
buyExecutionCount: number;
netBuyExecutionCount: number;
open: number;
high: number;
low: number;
}
export type DashboardOrderSide = "buy" | "sell";
export type DashboardOrderType = "limit" | "market";
/**
* 국내주식 현금 주문 요청 모델
*/
export interface DashboardStockCashOrderRequest {
symbol: string;
side: DashboardOrderSide;
orderType: DashboardOrderType;
quantity: number;
price: number;
accountNo: string;
accountProductCode: string;
}
/**
* 국내주식 현금 주문 응답 모델
*/
export interface DashboardStockCashOrderResponse {
ok: boolean;
tradingEnv: KisTradingEnv;
message: string;
orderNo?: string;
orderTime?: string;
orderOrgNo?: string;
}
/**
* KIS 키 검증 API 응답
*/
export interface DashboardKisValidateResponse {
ok: boolean;
tradingEnv: KisTradingEnv;
message: string;
sample?: {
symbol: string;
name: string;
currentPrice: number;
};
}
/**
* KIS 키 접근 폐기 API 응답
*/
export interface DashboardKisRevokeResponse {
ok: boolean;
tradingEnv: KisTradingEnv;
message: string;
}
/**
* KIS 웹소켓 승인키 발급 API 응답
*/
export interface DashboardKisWsApprovalResponse {
ok: boolean;
tradingEnv: KisTradingEnv;
message: string;
approvalKey?: string;
wsUrl?: string;
}