From 414b03cfbfe3cff00a7bf6031d7709addb18fe33 Mon Sep 17 00:00:00 2001 From: JIN Date: Wed, 6 Nov 2024 17:07:40 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20=EC=98=A4=EB=8A=98=EC=9D=98?= =?UTF-8?q?=20=EC=83=81/=ED=95=98=EC=9C=84=20=EC=A2=85=EB=AA=A9=20?= =?UTF-8?q?=EC=A1=B0=ED=9A=8C=EC=97=90=20=EC=82=AC=EC=9A=A9=ED=95=A0=20DTO?= =?UTF-8?q?=20=EA=B5=AC=ED=98=84#12?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 오늘의 상/하위 종목 조회를 위해 필요한 DTO 구현 --- .../topfive/dto/stock-ranking-data.dto.ts | 21 +++++++++++++++++ .../topfive/dto/stock-ranking-request.dto.ts | 23 +++++++++++++++++++ .../topfive/dto/stock-ranking-response.dto.ts | 13 +++++++++++ 3 files changed, 57 insertions(+) create mode 100644 BE/src/stocks/topfive/dto/stock-ranking-data.dto.ts create mode 100644 BE/src/stocks/topfive/dto/stock-ranking-request.dto.ts create mode 100644 BE/src/stocks/topfive/dto/stock-ranking-response.dto.ts diff --git a/BE/src/stocks/topfive/dto/stock-ranking-data.dto.ts b/BE/src/stocks/topfive/dto/stock-ranking-data.dto.ts new file mode 100644 index 00000000..5f1a3026 --- /dev/null +++ b/BE/src/stocks/topfive/dto/stock-ranking-data.dto.ts @@ -0,0 +1,21 @@ +import { ApiProperty } from '@nestjs/swagger'; + +/** + * 등락률 API 요청 후 받은 응답값 정제용 DTO + */ +export class StockRankingDataDto { + @ApiProperty({ description: 'HTS 한글 종목명' }) + hts_kor_isnm: string; + + @ApiProperty({ description: '주식 현재가' }) + stck_prpr: string; + + @ApiProperty({ description: '전일 대비' }) + prdy_vrss: string; + + @ApiProperty({ description: '전일 대비 부호' }) + prdy_vrss_sign: string; + + @ApiProperty({ description: '전일 대비율' }) + prdy_ctrt: string; +} diff --git a/BE/src/stocks/topfive/dto/stock-ranking-request.dto.ts b/BE/src/stocks/topfive/dto/stock-ranking-request.dto.ts new file mode 100644 index 00000000..200c244d --- /dev/null +++ b/BE/src/stocks/topfive/dto/stock-ranking-request.dto.ts @@ -0,0 +1,23 @@ +/** + * 등락률 API를 사용할 때 쿼리 파라미터로 사용할 요청값 DTO + */ +export class StockRankigRequestDto { + /** + * 조건 시장 분류 코드 + * 'J' 주식 + */ + fid_cond_mrkt_div_code: string; + + /** + * 입력 종목 코드 + * '0000' 전체 / '0001' 코스피 + * '1001' 코스닥 / '2001' 코스피200 + */ + fid_input_iscd: string; + + /** + * 순위 정렬 구분 코드 + * '0' 상승률 / '1' 하락률 + */ + fid_rank_sort_cls_code: string; +} diff --git a/BE/src/stocks/topfive/dto/stock-ranking-response.dto.ts b/BE/src/stocks/topfive/dto/stock-ranking-response.dto.ts new file mode 100644 index 00000000..79a4954b --- /dev/null +++ b/BE/src/stocks/topfive/dto/stock-ranking-response.dto.ts @@ -0,0 +1,13 @@ +import { ApiProperty } from '@nestjs/swagger'; +import { StockRankingDataDto } from './stock-ranking-data.dto'; + +/** + * 순위 정렬 후 FE에 보낼 DTO + */ +export class StockRankingResponseDto { + @ApiProperty({ type: [StockRankingDataDto], description: '상승률 순위' }) + high: StockRankingDataDto[]; + + @ApiProperty({ type: [StockRankingDataDto], description: '하락률 순위' }) + low: StockRankingDataDto[]; +}