market.ts 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  1. // 시장 데이터 도메인 타입 — Backend Application/Features/Api/Stocks/{GetIndices,GetEtp,...}/Response.cs 대응
  2. // 직렬화 주의: 필드명은 camelCase. enum 은 Web.Api Program.cs 에 JsonStringEnumConverter 미등록 →
  3. // Response DTO 에서 enum 은 숫자(정수)로 직렬화됨 (Paper 의 문자열 enum 과 다름).
  4. // 쿼리스트링으로 보낼 때는 ASP.NET model binding 이 enum 멤버명 문자열도 허용하므로 이름으로 전송한다.
  5. // ── enum (응답 = 숫자, 요청 = 멤버명 문자열) ──
  6. // 지수 계열 (MarketIndexSeries)
  7. export const MarketIndexSeries = {
  8. KOSPI: 1,
  9. KOSDAQ: 2,
  10. KRX: 3,
  11. Bond: 4,
  12. Derivative: 5
  13. } as const;
  14. export type MarketIndexSeriesValue = (typeof MarketIndexSeries)[keyof typeof MarketIndexSeries];
  15. export const MARKET_INDEX_SERIES_LABEL: Record<MarketIndexSeriesValue, string> = {
  16. [MarketIndexSeries.KOSPI]: 'KOSPI',
  17. [MarketIndexSeries.KOSDAQ]: 'KOSDAQ',
  18. [MarketIndexSeries.KRX]: 'KRX',
  19. [MarketIndexSeries.Bond]: '채권',
  20. [MarketIndexSeries.Derivative]: '파생'
  21. };
  22. // ETP 종류 (EtpType) — 요청 파라미터명 'type'
  23. export const EtpType = {
  24. ETF: 1,
  25. ETN: 2,
  26. ELW: 3
  27. } as const;
  28. export type EtpTypeValue = (typeof EtpType)[keyof typeof EtpType];
  29. export type EtpTypeName = keyof typeof EtpType;
  30. export const ETP_TYPE_LABEL: Record<EtpTypeValue, string> = {
  31. [EtpType.ETF]: 'ETF',
  32. [EtpType.ETN]: 'ETN',
  33. [EtpType.ELW]: 'ELW'
  34. };
  35. // 채권 시장 (BondMarket) — 요청 파라미터명 'market'
  36. export const BondMarket = {
  37. KtsGovt: 1,
  38. General: 2,
  39. Small: 3
  40. } as const;
  41. export type BondMarketValue = (typeof BondMarket)[keyof typeof BondMarket];
  42. export type BondMarketName = keyof typeof BondMarket;
  43. export const BOND_MARKET_LABEL: Record<BondMarketValue, string> = {
  44. [BondMarket.KtsGovt]: '국채전문',
  45. [BondMarket.General]: '일반채권',
  46. [BondMarket.Small]: '소액채권'
  47. };
  48. // 선물 종류 (FuturesKind) — 요청 파라미터명 'kind'
  49. export const FuturesKind = {
  50. General: 1,
  51. StockKospi: 2,
  52. StockKosdaq: 3
  53. } as const;
  54. export type FuturesKindValue = (typeof FuturesKind)[keyof typeof FuturesKind];
  55. export type FuturesKindName = keyof typeof FuturesKind;
  56. export const FUTURES_KIND_LABEL: Record<FuturesKindValue, string> = {
  57. [FuturesKind.General]: '일반선물',
  58. [FuturesKind.StockKospi]: '주식선물(코스피)',
  59. [FuturesKind.StockKosdaq]: '주식선물(코스닥)'
  60. };
  61. // 옵션 종류 (OptionsKind) — 요청 파라미터명 'kind'
  62. export const OptionsKind = {
  63. General: 1,
  64. StockKospi: 2,
  65. StockKosdaq: 3
  66. } as const;
  67. export type OptionsKindValue = (typeof OptionsKind)[keyof typeof OptionsKind];
  68. export type OptionsKindName = keyof typeof OptionsKind;
  69. export const OPTIONS_KIND_LABEL: Record<OptionsKindValue, string> = {
  70. [OptionsKind.General]: '일반옵션',
  71. [OptionsKind.StockKospi]: '주식옵션(코스피)',
  72. [OptionsKind.StockKosdaq]: '주식옵션(코스닥)'
  73. };
  74. // 옵션 권리유형 (OptionRightType)
  75. export const OptionRightType = {
  76. Call: 1,
  77. Put: 2
  78. } as const;
  79. export type OptionRightTypeValue = (typeof OptionRightType)[keyof typeof OptionRightType];
  80. export const OPTION_RIGHT_TYPE_LABEL: Record<OptionRightTypeValue, string> = {
  81. [OptionRightType.Call]: '콜',
  82. [OptionRightType.Put]: '풋'
  83. };
  84. // 상품(파생상품시장) 시장 (CommodityMarket) — 요청 파라미터명 'market'
  85. export const CommodityMarket = {
  86. Oil: 1,
  87. Gold: 2,
  88. Emission: 3
  89. } as const;
  90. export type CommodityMarketValue = (typeof CommodityMarket)[keyof typeof CommodityMarket];
  91. export type CommodityMarketName = keyof typeof CommodityMarket;
  92. export const COMMODITY_MARKET_LABEL: Record<CommodityMarketValue, string> = {
  93. [CommodityMarket.Oil]: '석유',
  94. [CommodityMarket.Gold]: '금',
  95. [CommodityMarket.Emission]: '배출권'
  96. };
  97. // 금리 유형 (RateType) — 요청 파라미터명 'type'
  98. export const RateType = {
  99. Loan: 1,
  100. International: 2
  101. } as const;
  102. export type RateTypeValue = (typeof RateType)[keyof typeof RateType];
  103. export type RateTypeName = keyof typeof RateType;
  104. export const RATE_TYPE_LABEL: Record<RateTypeValue, string> = {
  105. [RateType.Loan]: '대출금리',
  106. [RateType.International]: '국제금리'
  107. };
  108. // 공시 법인구분 (corpCls — 문자열 Y/K/N/E)
  109. export type CorpClsCode = 'Y'|'K'|'N'|'E';
  110. export const CORP_CLS_LABEL: Record<CorpClsCode, string> = {
  111. Y: '유가',
  112. K: '코스닥',
  113. N: '코넥스',
  114. E: '기타'
  115. };
  116. // ── GET /api/market/indices ──
  117. export interface MarketIndexRow {
  118. series: MarketIndexSeriesValue;
  119. name: string;
  120. close: number;
  121. changeVal: number;
  122. // 등락률 basis point (%×100)
  123. flucRateBp: number;
  124. tradeDate: string;
  125. }
  126. export interface MarketIndicesResponse {
  127. list: MarketIndexRow[];
  128. }
  129. // ── GET /api/market/etp ──
  130. export interface EtpRow {
  131. type: EtpTypeValue;
  132. code: string;
  133. name: string;
  134. close: number;
  135. changeAmount: number;
  136. changeRate: number;
  137. volume: number;
  138. tradeValue: number;
  139. marketCap: number|null;
  140. nav: number|null;
  141. baseIndexName: string|null;
  142. underlying: string|null;
  143. }
  144. export interface EtpResponse {
  145. total: number;
  146. tradeDate: string|null;
  147. list: EtpRow[];
  148. }
  149. // ── GET /api/market/bonds ──
  150. export interface BondRow {
  151. market: BondMarketValue;
  152. code: string;
  153. name: string;
  154. close: number;
  155. changeAmount: number;
  156. yieldToMaturity: number|null;
  157. volume: number;
  158. tradeValue: number;
  159. maturityYears: string|null;
  160. issueType: string|null;
  161. }
  162. export interface BondsResponse {
  163. total: number;
  164. tradeDate: string|null;
  165. list: BondRow[];
  166. }
  167. // ── GET /api/market/futures ──
  168. export interface FuturesRow {
  169. kind: FuturesKindValue;
  170. isuCode: string;
  171. isuName: string;
  172. close: number;
  173. changeAmount: number;
  174. settlePrice: number|null;
  175. volume: number;
  176. tradeValue: number;
  177. openInterest: number|null;
  178. productName: string|null;
  179. }
  180. export interface FuturesResponse {
  181. total: number;
  182. tradeDate: string|null;
  183. list: FuturesRow[];
  184. }
  185. // ── GET /api/market/options ──
  186. export interface OptionsRow {
  187. kind: OptionsKindValue;
  188. isuCode: string;
  189. isuName: string;
  190. rightType: OptionRightTypeValue;
  191. strikePrice: number|null;
  192. close: number;
  193. changeAmount: number;
  194. impliedVolatility: number|null;
  195. volume: number;
  196. tradeValue: number;
  197. openInterest: number|null;
  198. productName: string|null;
  199. }
  200. export interface OptionsResponse {
  201. total: number;
  202. tradeDate: string|null;
  203. list: OptionsRow[];
  204. }
  205. // ── GET /api/market/commodities ──
  206. export interface CommodityRow {
  207. market: CommodityMarketValue;
  208. code: string;
  209. name: string;
  210. close: number;
  211. changeAmount: number|null;
  212. changeRate: number|null;
  213. weightedDiscussionPrice: number|null;
  214. volume: number;
  215. tradeValue: number;
  216. }
  217. export interface CommoditiesResponse {
  218. total: number;
  219. tradeDate: string|null;
  220. list: CommodityRow[];
  221. }
  222. // ── GET /api/market/esg/securities ──
  223. export interface EsgSecurityRow {
  224. name: string;
  225. close: number;
  226. changeAmount: number;
  227. changeRate: number;
  228. listedShares: number;
  229. volume: number;
  230. tradeValue: number;
  231. }
  232. export interface EsgSecuritiesResponse {
  233. total: number;
  234. tradeDate: string|null;
  235. list: EsgSecurityRow[];
  236. }
  237. // ── GET /api/market/esg/indices ──
  238. export interface EsgIndexRow {
  239. name: string;
  240. close: number;
  241. changeVal: number;
  242. // 등락률 basis point (%×100)
  243. flucRateBp: number;
  244. constituentCount: number;
  245. volume: number;
  246. value: number;
  247. }
  248. export interface EsgIndicesResponse {
  249. total: number;
  250. tradeDate: string|null;
  251. list: EsgIndexRow[];
  252. }
  253. // ── GET /api/market/esg/sri-bonds ──
  254. export interface SriBondRow {
  255. code: string;
  256. issuerName: string;
  257. sriBondType: string;
  258. name: string;
  259. listDate: string|null;
  260. issueDate: string|null;
  261. redemptionDate: string|null;
  262. couponRate: number|null;
  263. issueAmount: number;
  264. listAmount: number;
  265. bondType: string|null;
  266. }
  267. export interface SriBondsResponse {
  268. total: number;
  269. tradeDate: string|null;
  270. list: SriBondRow[];
  271. }
  272. // ── GET /api/market/exchange-rates ──
  273. export interface ExchangeRateRow {
  274. currencyUnit: string;
  275. currencyName: string;
  276. dealBasRate: number;
  277. // 전신환 받으실 때
  278. ttb: number|null;
  279. // 전신환 보내실 때
  280. tts: number|null;
  281. }
  282. export interface ExchangeRatesResponse {
  283. total: number;
  284. tradeDate: string|null;
  285. list: ExchangeRateRow[];
  286. }
  287. // ── GET /api/market/interest-rates ──
  288. export interface InterestRateRow {
  289. itemName: string;
  290. rate: number|null;
  291. }
  292. export interface InterestRatesResponse {
  293. type: RateTypeValue;
  294. total: number;
  295. tradeDate: string|null;
  296. list: InterestRateRow[];
  297. }
  298. // ── GET /api/disclosures · GET /api/stocks/{code}/disclosures ──
  299. export interface DisclosureRow {
  300. rceptNo: string;
  301. corpCode: string;
  302. corpName: string;
  303. stockCode?: string|null;
  304. corpCls: string;
  305. reportNm: string;
  306. flrNm: string;
  307. rceptDt: string;
  308. rm: string|null;
  309. }
  310. export interface DisclosuresResponse {
  311. total: number;
  312. list: DisclosureRow[];
  313. }