Skip to content

Commit

Permalink
๐Ÿ’ก comment: service ๋กœ์ง ํ•จ์ˆ˜๋ณ„ ์ฃผ์„ ์ถ”๊ฐ€
Browse files Browse the repository at this point in the history
  • Loading branch information
uuuo3o committed Nov 7, 2024
1 parent edcb779 commit 379ffe6
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions BE/src/stock/topfive/stock.topfive.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ export class StockTopfiveService {
private readonly koreaInvestmentService: KoreaInvestmentService,
) {}

/**
* @private ํ•œ๊ตญํˆฌ์ž Open API - [๊ตญ๋‚ด์ฃผ์‹] ์ˆœ์œ„ ๋ถ„์„ - ๊ตญ๋‚ด์ฃผ์‹ ๋“ฑ๋ฝ๋ฅ  ์ˆœ์œ„ ํ˜ธ์ถœ ํ•จ์ˆ˜
* @param {StockRankingQueryParameterDto} queryParams - API ์š”์ฒญ ์‹œ ํ•„์š”ํ•œ ์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ DTO
* @returns - ๊ตญ๋‚ด์ฃผ์‹ ๋“ฑ๋ฝ๋ฅ  ๋ฐ์ดํ„ฐ
*
* @author uuuo3o
*/
private async requestApi(queryParams: StockRankingQueryParameterDto) {
try {
const accessToken = await this.koreaInvestmentService.getAccessToken();
Expand All @@ -45,6 +52,13 @@ export class StockTopfiveService {
}
}

/**
* ๊ตญ๋‚ด์ฃผ์‹ ๋“ฑ๋ฝ๋ฅ  ๋ฐ์ดํ„ฐ ์ค‘ ํ•„์š”ํ•œ ์‹œ์žฅ ์ข…๋ฅ˜ ๋ฐ์ดํ„ฐ๋ฅผ ๋ฐ˜ํ™˜ํ•˜๋Š” ํ•จ์ˆ˜
* @param {MarketType} marketType - ์‹œ์žฅ ์ข…๋ฅ˜(ALL, KOSPI, KOSDAQ, KOSPI200)
* @returns - ์ƒ์Šน์œจ์ˆœ, ํ•˜๋ฝ์œจ์ˆœ ๋ฐฐ์—ด ๋ฐ์ดํ„ฐ๊ฐ€ ํฌํ•จ๋œ ๊ฐ์ฒด
*
* @author uuuo3o
*/
async getMarketRanking(marketType: MarketType) {
try {
const queryParams = new StockRankingQueryParameterDto();
Expand Down Expand Up @@ -94,6 +108,13 @@ export class StockTopfiveService {
}
}

/**
* @private API์—์„œ ๋ฐ›์€ ๊ตญ๋‚ด์ฃผ์‹ ๋“ฑ๋ฝ๋ฅ  ๋ฐ์ดํ„ฐ๋ฅผ ํ•„์š”ํ•œ ์ •๋ณด๋กœ ์ •์ œํ•˜๋Š” ํ•จ์ˆ˜
* @param {StockApiOutputData[]} stocks - API ์‘๋‹ต์—์„œ ๋ฐ›์€ ์›์‹œ ๋ฐ์ดํ„ฐ ๋ฐฐ์—ด
* @returns - ํ•„์š”ํ•œ ์ •๋ณด๋งŒ ์ถ”์ถœํ•œ ๋ฐ์ดํ„ฐ ๋ฐฐ์—ด
*
* @author uuuo3o
*/
private formatStockData(stocks: StockApiOutputData[]) {
return stocks.slice(0, 5).map((stock) => {
const stockData = new StockRankingDataDto();
Expand All @@ -107,6 +128,13 @@ export class StockTopfiveService {
});
}

/**
* @private ์ฃผ์‹ ์ˆœ์œ„ API ์š”์ฒญ์„ ์œ„ํ•œ ์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ ๊ฐ์ฒด ์ƒ์„ฑ ํ•จ์ˆ˜
* @param {StockRankingQueryParameterDto} params - API ์š”์ฒญ์— ํ•„์š”ํ•œ ์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ DTO
* @returns - API ์š”์ฒญ์— ํ•„์š”ํ•œ ์ฟผ๋ฆฌ ํŒŒ๋ผ๋ฏธํ„ฐ ๊ฐ์ฒด
*
* @author uuuo3o
*/
private getStockRankingParams(params: StockRankingQueryParameterDto) {
return {
fid_rsfl_rate2: '',
Expand Down

0 comments on commit 379ffe6

Please sign in to comment.