// 시장 데이터 도메인 타입 — Backend Application/Features/Api/Stocks/{GetIndices,GetEtp,...}/Response.cs 대응 // 직렬화 주의: 필드명은 camelCase. enum 은 Web.Api Program.cs 에 JsonStringEnumConverter 미등록 → // Response DTO 에서 enum 은 숫자(정수)로 직렬화됨 (Paper 의 문자열 enum 과 다름). // 쿼리스트링으로 보낼 때는 ASP.NET model binding 이 enum 멤버명 문자열도 허용하므로 이름으로 전송한다. // (예외: session 은 숫자 1/2 로 전송 — MarketSession) // ── enum (응답 = 숫자, 요청 = 멤버명 문자열) ── // 지수 계열 (MarketIndexSeries) export const MarketIndexSeries = { KOSPI: 1, KOSDAQ: 2, KRX: 3, Bond: 4, Derivative: 5 } as const; export type MarketIndexSeriesValue = (typeof MarketIndexSeries)[keyof typeof MarketIndexSeries]; export const MARKET_INDEX_SERIES_LABEL: Record = { [MarketIndexSeries.KOSPI]: 'KOSPI', [MarketIndexSeries.KOSDAQ]: 'KOSDAQ', [MarketIndexSeries.KRX]: 'KRX', [MarketIndexSeries.Bond]: '채권', [MarketIndexSeries.Derivative]: '파생' }; // ETP 종류 (EtpType) — 요청 파라미터명 'type' export const EtpType = { ETF: 1, ETN: 2, ELW: 3 } as const; export type EtpTypeValue = (typeof EtpType)[keyof typeof EtpType]; export type EtpTypeName = keyof typeof EtpType; export const ETP_TYPE_LABEL: Record = { [EtpType.ETF]: 'ETF', [EtpType.ETN]: 'ETN', [EtpType.ELW]: 'ELW' }; // 채권 시장 (BondMarket) — 요청 파라미터명 'market' export const BondMarket = { KtsGovt: 1, General: 2, Small: 3 } as const; export type BondMarketValue = (typeof BondMarket)[keyof typeof BondMarket]; export type BondMarketName = keyof typeof BondMarket; export const BOND_MARKET_LABEL: Record = { [BondMarket.KtsGovt]: '국채전문', [BondMarket.General]: '일반채권', [BondMarket.Small]: '소액채권' }; // 매매 세션 (MarketSession) — 선물/옵션 공용. 요청 파라미터명 'session' (숫자 1/2 로 전송 — model binding 은 숫자·이름 모두 허용) export const MarketSession = { Regular: 1, Night: 2 } as const; export type MarketSessionValue = (typeof MarketSession)[keyof typeof MarketSession]; export type MarketSessionName = keyof typeof MarketSession; export const MARKET_SESSION_LABEL: Record = { [MarketSession.Regular]: '정규', [MarketSession.Night]: '야간' }; // 선물 종류 (FuturesKind) — 요청 파라미터명 'kind' export const FuturesKind = { General: 1, StockKospi: 2, StockKosdaq: 3 } as const; export type FuturesKindValue = (typeof FuturesKind)[keyof typeof FuturesKind]; export type FuturesKindName = keyof typeof FuturesKind; export const FUTURES_KIND_LABEL: Record = { [FuturesKind.General]: '일반선물', [FuturesKind.StockKospi]: '주식선물(코스피)', [FuturesKind.StockKosdaq]: '주식선물(코스닥)' }; // 옵션 종류 (OptionsKind) — 요청 파라미터명 'kind' export const OptionsKind = { General: 1, StockKospi: 2, StockKosdaq: 3 } as const; export type OptionsKindValue = (typeof OptionsKind)[keyof typeof OptionsKind]; export type OptionsKindName = keyof typeof OptionsKind; export const OPTIONS_KIND_LABEL: Record = { [OptionsKind.General]: '일반옵션', [OptionsKind.StockKospi]: '주식옵션(코스피)', [OptionsKind.StockKosdaq]: '주식옵션(코스닥)' }; // 옵션 권리유형 (OptionRightType) export const OptionRightType = { Call: 1, Put: 2 } as const; export type OptionRightTypeValue = (typeof OptionRightType)[keyof typeof OptionRightType]; export const OPTION_RIGHT_TYPE_LABEL: Record = { [OptionRightType.Call]: '콜', [OptionRightType.Put]: '풋' }; // 상품(파생상품시장) 시장 (CommodityMarket) — 요청 파라미터명 'market' export const CommodityMarket = { Oil: 1, Gold: 2, Emission: 3 } as const; export type CommodityMarketValue = (typeof CommodityMarket)[keyof typeof CommodityMarket]; export type CommodityMarketName = keyof typeof CommodityMarket; export const COMMODITY_MARKET_LABEL: Record = { [CommodityMarket.Oil]: '석유', [CommodityMarket.Gold]: '금', [CommodityMarket.Emission]: '배출권' }; // 금리 유형 (RateType) — 요청 파라미터명 'type' export const RateType = { Loan: 1, International: 2 } as const; export type RateTypeValue = (typeof RateType)[keyof typeof RateType]; export type RateTypeName = keyof typeof RateType; export const RATE_TYPE_LABEL: Record = { [RateType.Loan]: '대출금리', [RateType.International]: '국제금리' }; // 공시 법인구분 (corpCls — 문자열 Y/K/N/E) export type CorpClsCode = 'Y'|'K'|'N'|'E'; export const CORP_CLS_LABEL: Record = { Y: '유가', K: '코스닥', N: '코넥스', E: '기타' }; // ── GET /api/market/indices ── export interface MarketIndexRow { series: MarketIndexSeriesValue; name: string; close: number; changeVal: number; // 등락률 basis point (%×100) flucRateBp: number; tradeDate: string; } export interface MarketIndicesResponse { list: MarketIndexRow[]; } // ── GET /api/market/etp ── export interface EtpRow { type: EtpTypeValue; code: string; name: string; close: number; changeAmount: number; changeRate: number; volume: number; tradeValue: number; marketCap: number|null; nav: number|null; baseIndexName: string|null; underlying: string|null; } export interface EtpResponse { total: number; tradeDate: string|null; list: EtpRow[]; } // ── GET /api/market/bonds ── export interface BondRow { market: BondMarketValue; code: string; name: string; close: number; changeAmount: number; yieldToMaturity: number|null; volume: number; tradeValue: number; maturityYears: string|null; issueType: string|null; } export interface BondsResponse { total: number; tradeDate: string|null; list: BondRow[]; } // ── GET /api/market/futures ── export interface FuturesRow { kind: FuturesKindValue; // 매매 세션 (1=정규, 2=야간) — 숫자 직렬화 session: MarketSessionValue; isuCode: string; isuName: string; close: number; changeAmount: number; settlePrice: number|null; volume: number; tradeValue: number; openInterest: number|null; productName: string|null; } export interface FuturesResponse { total: number; tradeDate: string|null; list: FuturesRow[]; } // ── GET /api/market/options ── export interface OptionsRow { kind: OptionsKindValue; // 매매 세션 (1=정규, 2=야간) — 숫자 직렬화 session: MarketSessionValue; isuCode: string; isuName: string; rightType: OptionRightTypeValue; strikePrice: number|null; close: number; changeAmount: number; impliedVolatility: number|null; volume: number; tradeValue: number; openInterest: number|null; productName: string|null; } export interface OptionsResponse { total: number; tradeDate: string|null; list: OptionsRow[]; } // ── GET /api/market/commodities ── export interface CommodityRow { market: CommodityMarketValue; code: string; name: string; close: number; changeAmount: number|null; changeRate: number|null; weightedDiscussionPrice: number|null; volume: number; tradeValue: number; } export interface CommoditiesResponse { total: number; tradeDate: string|null; list: CommodityRow[]; } // ── GET /api/market/esg/securities ── export interface EsgSecurityRow { name: string; close: number; changeAmount: number; changeRate: number; listedShares: number; volume: number; tradeValue: number; } export interface EsgSecuritiesResponse { total: number; tradeDate: string|null; list: EsgSecurityRow[]; } // ── GET /api/market/esg/indices ── export interface EsgIndexRow { name: string; close: number; changeVal: number; // 등락률 basis point (%×100) flucRateBp: number; constituentCount: number; volume: number; value: number; } export interface EsgIndicesResponse { total: number; tradeDate: string|null; list: EsgIndexRow[]; } // ── GET /api/market/esg/sri-bonds ── export interface SriBondRow { code: string; issuerName: string; sriBondType: string; name: string; listDate: string|null; issueDate: string|null; redemptionDate: string|null; couponRate: number|null; issueAmount: number; listAmount: number; bondType: string|null; } export interface SriBondsResponse { total: number; tradeDate: string|null; list: SriBondRow[]; } // ── GET /api/market/exchange-rates ── export interface ExchangeRateRow { currencyUnit: string; currencyName: string; dealBasRate: number; // 전신환 받으실 때 ttb: number|null; // 전신환 보내실 때 tts: number|null; } export interface ExchangeRatesResponse { total: number; tradeDate: string|null; list: ExchangeRateRow[]; } // ── GET /api/market/interest-rates ── export interface InterestRateRow { itemName: string; rate: number|null; } export interface InterestRatesResponse { type: RateTypeValue; total: number; tradeDate: string|null; list: InterestRateRow[]; } // ── GET /api/disclosures · GET /api/stocks/{code}/disclosures ── export interface DisclosureRow { rceptNo: string; corpCode: string; corpName: string; stockCode?: string|null; corpCls: string; reportNm: string; flrNm: string; rceptDt: string; rm: string|null; } export interface DisclosuresResponse { total: number; list: DisclosureRow[]; }