stock.ts 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // 종목 도메인 타입 — Backend Application/Features/Api/Stocks/*/Response.cs 대응 (camelCase 직렬화)
  2. export type StockMarketName = 'KOSPI'|'KOSDAQ'|'KONEX';
  3. export type TradingStatusName = 'Normal'|'Halted'|'Watch';
  4. // GET /api/stocks — 목록 행
  5. export interface StockListRow {
  6. code: string;
  7. name: string;
  8. market: StockMarketName;
  9. tradingStatus: TradingStatusName;
  10. lastTradingDate: string|null;
  11. closePrice: number|null;
  12. changeRate: number|null;
  13. marketCap: number|null;
  14. volume: number|null;
  15. tradingValue: number|null;
  16. }
  17. // 목록 정렬 키 (백엔드 GetList.Query.Sort 와 동일) + 방향
  18. export type StockSortKey = 'name'|'price'|'change'|'cap'|'value';
  19. export type StockSortOrder = 'asc'|'desc';
  20. export interface StockListResponse {
  21. total: number;
  22. list: StockListRow[];
  23. }
  24. // 일별 시세 행 (GetDetail.RecentPrices / GetHistory 공용 필드)
  25. export interface StockPriceRow {
  26. tradingDate: string;
  27. open: number;
  28. high: number;
  29. low: number;
  30. close: number;
  31. volume: number;
  32. tradingValue: number;
  33. changeAmount: number;
  34. changeRate: number;
  35. }
  36. // GET /api/stocks/{code}
  37. export interface StockDetailResponse {
  38. code: string;
  39. isin: string|null;
  40. name: string;
  41. englishName: string|null;
  42. market: StockMarketName;
  43. tradingStatus: TradingStatusName;
  44. sectorName: string|null;
  45. isActive: boolean;
  46. listedDate: string;
  47. delistedDate: string|null;
  48. lastTradingDate: string|null;
  49. closePrice: number|null;
  50. changeRate: number|null;
  51. marketCap: number|null;
  52. recentPrices: StockPriceRow[];
  53. }
  54. // GET /api/stocks/{code}/history
  55. export interface StockHistoryRow extends StockPriceRow {
  56. marketCap: number|null;
  57. }
  58. export interface StockHistoryResponse {
  59. total: number;
  60. list: StockHistoryRow[];
  61. }
  62. // GET /api/stocks/suggest
  63. export interface StockSuggestItem {
  64. code: string;
  65. name: string;
  66. market: StockMarketName;
  67. }
  68. export interface StockSuggestResponse {
  69. list: StockSuggestItem[];
  70. }
  71. // 관심종목 (Watch) — Backend Features/Api/Stocks/Watch/*
  72. // POST /api/stocks/{code}/watch
  73. export interface StockWatchToggleResponse {
  74. isWatched: boolean;
  75. }
  76. // GET /api/stocks/watchlist/status?codes=CSV
  77. export interface StockWatchStatusResponse {
  78. map: Record<string, boolean>;
  79. }
  80. // GET /api/stocks/watchlist — 행
  81. export interface StockWatchRow {
  82. code: string;
  83. name: string;
  84. market: StockMarketName;
  85. closePrice: number|null;
  86. changeRate: number|null;
  87. }
  88. export interface StockWatchListResponse {
  89. list: StockWatchRow[];
  90. }