import './domestic-summary.scss'; import { moveDir, formatFlucRate, formatIndexClose } from '@/types/worldIndex'; import { type DomesticIndexRow, formatIndexChange, formatNet, formatCount, netDir } from '@/types/domesticSummary'; // 국내 증시 요약 — 코스피/코스닥/KOSPI200 카드. 지수·등락 + 투자자별 순매수(Phase 2 "–") + 등락종목수(코스피/코스닥) / 베이시스(KOSPI200). type Props = { rows: DomesticIndexRow[]; }; const ARROW = { up: '▲', down: '▼', flat: '–' } as const; export default function DomesticSummary({ rows }: Props) { if (rows.length === 0) { return null; } return (
{rows.map((row) => { const dir = moveDir(row.flucRateBp); const isKospi200 = row.key === 'kospi200'; return (
{row.name}
{formatIndexClose(row.close)} {formatIndexChange(row.changeVal)} {formatFlucRate(row.flucRateBp)}
개인 {formatNet(row.individualNet)}
외국인 {formatNet(row.foreignNet)}
기관 {formatNet(row.institutionNet)}
프로그램 {formatNet(row.programNet)}
{isKospi200 ? (
베이시스 {row.basis !== null && row.basis !== undefined ? row.basis.toFixed(2) : '–'}
) : (
상한 {formatCount(row.limitUp)} 상승 {formatCount(row.advances)} 보합 {formatCount(row.unchanged)} 하락 {formatCount(row.declines)} 하한 {formatCount(row.limitDown)}
)}
); })}
); }