package models import "time" // StockPrice 주식 현재가 정보 type StockPrice struct { Code string `json:"code"` // 종목코드 (예: 005930) Name string `json:"name"` // 종목명 (예: 삼성전자) CurrentPrice int64 `json:"currentPrice"` // 현재가 ChangePrice int64 `json:"changePrice"` // 전일 대비 등락 금액 ChangeRate float64 `json:"changeRate"` // 등락률 (%) Volume int64 `json:"volume"` // 누적 거래량 (13) TradeMoney int64 `json:"tradeMoney"` // 누적 거래대금 (14) High int64 `json:"high"` // 고가 Low int64 `json:"low"` // 저가 Open int64 `json:"open"` // 시가 TradeTime string `json:"tradeTime"` // 체결시각 (20, HHMMSS) TradeVolume int64 `json:"tradeVolume"` // 체결량 (15) AskPrice1 int64 `json:"askPrice1"` // 최우선매도호가 (27) BidPrice1 int64 `json:"bidPrice1"` // 최우선매수호가 (28) MarketStatus string `json:"marketStatus"` // 장구분 (290) CntrStr float64 `json:"cntrStr"` // 체결강도 Market string `json:"market"` // 시장구분 (KOSPI / KOSDAQ) UpdatedAt time.Time `json:"updatedAt"` // 마지막 업데이트 시각 } // CandleData 캔들(봉) 데이터 (일봉/분봉 공통) type CandleData struct { Time int64 `json:"time"` // Unix 타임스탬프 (Lightweight Charts 형식) Open int64 `json:"open"` High int64 `json:"high"` Low int64 `json:"low"` Close int64 `json:"close"` Volume int64 `json:"volume"` } // StockInfo 종목 기본 정보 (검색용) type StockInfo struct { Code string `json:"code"` Name string `json:"name"` Market string `json:"market"` // KOSPI / KOSDAQ } // AskingPrice 호가 정보 type AskingPrice struct { SellPrices []int64 `json:"sellPrices"` // 매도 호가 (낮은→높은 순) SellVolumes []int64 `json:"sellVolumes"` BuyPrices []int64 `json:"buyPrices"` // 매수 호가 (높은→낮은 순) BuyVolumes []int64 `json:"buyVolumes"` } // OrderBookEntry 개별 호가 항목 type OrderBookEntry struct { Price int64 `json:"price"` // 호가 Volume int64 `json:"volume"` // 잔량 } // OrderBook 실시간 호가창 (0D) // Asks[0]=매도1호가(최우선), Asks[9]=매도10호가 // Bids[0]=매수1호가(최우선), Bids[9]=매수10호가 type OrderBook struct { Code string `json:"code"` AskTime string `json:"askTime"` // 21: 호가시간 (HHMMSS) Asks []OrderBookEntry `json:"asks"` // 매도호가 1~10 Bids []OrderBookEntry `json:"bids"` // 매수호가 1~10 TotalAskVol int64 `json:"totalAskVol"` // 121: 매도호가총잔량 TotalBidVol int64 `json:"totalBidVol"` // 125: 매수호가총잔량 ExpectedPrc int64 `json:"expectedPrc"` // 23: 예상체결가 ExpectedVol int64 `json:"expectedVol"` // 24: 예상체결수량 } // ProgramTrading 종목프로그램매매 실시간 데이터 (0w) type ProgramTrading struct { Code string `json:"code"` SellVolume int64 `json:"sellVolume"` // 202: 매도수량 SellAmount int64 `json:"sellAmount"` // 204: 매도금액 BuyVolume int64 `json:"buyVolume"` // 206: 매수수량 BuyAmount int64 `json:"buyAmount"` // 208: 매수금액 NetBuyVolume int64 `json:"netBuyVolume"` // 210: 순매수수량 NetBuyAmount int64 `json:"netBuyAmount"` // 212: 순매수금액 } // MarketStatus 장운영 상태 (0s) type MarketStatus struct { StatusCode string `json:"statusCode"` // 215: 장운영구분 코드 StatusName string `json:"statusName"` // 해석된 이름 (예: 장 중, 장 마감) Time string `json:"time"` // 20: 체결시간 } // StockMeta 종목 메타데이터 (0g) type StockMeta struct { Code string `json:"code"` UpperLimit int64 `json:"upperLimit"` // 305: 상한가 LowerLimit int64 `json:"lowerLimit"` // 306: 하한가 BasePrice int64 `json:"basePrice"` // 307: 기준가 }