From 574c01a590eb340d51acaaf3cc7ca6791b5fa2ab Mon Sep 17 00:00:00 2001 From: bbbang105 <2018111366@dgu.ac.kr> Date: Mon, 17 Jun 2024 16:15:32 +0900 Subject: [PATCH 1/4] =?UTF-8?q?#33=20[feat]=20:=20=EB=8C=80=ED=91=9C=20?= =?UTF-8?q?=EC=BD=94=EC=9D=B8=20=EC=A2=85=EB=A5=98=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/java/org/dgu/backend/constant/Coin.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backend/src/main/java/org/dgu/backend/constant/Coin.java b/backend/src/main/java/org/dgu/backend/constant/Coin.java index 5388b5a..b5a3764 100644 --- a/backend/src/main/java/org/dgu/backend/constant/Coin.java +++ b/backend/src/main/java/org/dgu/backend/constant/Coin.java @@ -3,6 +3,13 @@ public enum Coin { BITCOIN("KRW-BTC", "비트코인", "Bitcoin"), ETHEREUM("KRW-ETH", "이더리움", "Ethereum"), + BITCOIN_CASH("KRW-BCH", "비트코인캐시", "Bitcoin Cash"), + SOLANA("KRW-SOL", "솔라나", "Solana"), + AAVE("KRW-AAVE", "에이브", "Aave"), + AVALANCHE("KRW-AVAX", "아발란체", "Avalanche"), + NEO("KRW-NEO", "네오", "NEO"), + TAIKO("KRW-TAIKO", "타이코", "Taiko"), + STACKS("KRW-STX", "스택스", "Stacks"), RIPPLE("KRW-XRP", "리플", "Ripple"), DOGECOIN("KRW-DOGE", "도지코인", "Dogecoin"), WAVE("KRW-WAVES", "웨이브", "Waves"); From d4d54c2056b25fce424df345448ab5afe9b1d9e1 Mon Sep 17 00:00:00 2001 From: bbbang105 <2018111366@dgu.ac.kr> Date: Mon, 17 Jun 2024 16:15:54 +0900 Subject: [PATCH 2/4] =?UTF-8?q?#33=20[style]=20:=20=EC=A3=BC=EC=84=9D=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/dgu/backend/controller/DashBoardController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/main/java/org/dgu/backend/controller/DashBoardController.java b/backend/src/main/java/org/dgu/backend/controller/DashBoardController.java index d836905..90d629b 100644 --- a/backend/src/main/java/org/dgu/backend/controller/DashBoardController.java +++ b/backend/src/main/java/org/dgu/backend/controller/DashBoardController.java @@ -37,7 +37,7 @@ public ResponseEntity>> getUserC return ApiResponse.onSuccess(SuccessStatus.SUCCESS_GET_USER_COINS, userCoins); } - // 대표 코인 5개 조회 API + // 대표 코인 12개 조회 API @GetMapping("/coins/representative") public ResponseEntity>> getRepresentativeCoins() { From a273aa2b24b729680e1bf99507483b3bee6bd181 Mon Sep 17 00:00:00 2001 From: bbbang105 <2018111366@dgu.ac.kr> Date: Mon, 17 Jun 2024 16:16:27 +0900 Subject: [PATCH 3/4] =?UTF-8?q?#33=20[refactor]=20:=20=EC=83=81=EC=8A=B9?= =?UTF-8?q?=EB=A5=A0=20=EB=B0=98=EC=98=AC=EB=A6=BC=20=EC=9E=90=EB=A6=BF?= =?UTF-8?q?=EC=88=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/java/org/dgu/backend/dto/DashBoardDto.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/org/dgu/backend/dto/DashBoardDto.java b/backend/src/main/java/org/dgu/backend/dto/DashBoardDto.java index b61536b..6d54276 100644 --- a/backend/src/main/java/org/dgu/backend/dto/DashBoardDto.java +++ b/backend/src/main/java/org/dgu/backend/dto/DashBoardDto.java @@ -78,8 +78,8 @@ public static DashBoardDto.RepresentativeCoinResponse of(UpbitDto.Ticker ticker, .marketName(ticker.getMarket()) .koreanName(koreanName) .englishName(englishName) - .changePrice(ticker.getPrice()) - .changeRate(BigDecimal.valueOf(ticker.getChangeRate()).setScale(5, RoundingMode.HALF_UP)) + .changePrice(ticker.getPrice().setScale(0, RoundingMode.UP)) + .changeRate(BigDecimal.valueOf(ticker.getChangeRate()).multiply(BigDecimal.valueOf(100)).setScale(3, RoundingMode.HALF_UP)) .isIncrease(ticker.getChange().equals("RISE")) .build(); } From c1fc136207744b6918b5d08086b46ee0a6447f5e Mon Sep 17 00:00:00 2001 From: bbbang105 <2018111366@dgu.ac.kr> Date: Mon, 17 Jun 2024 16:16:55 +0900 Subject: [PATCH 4/4] =?UTF-8?q?#33=20[refactor]=20:=20=EC=9A=94=EC=B2=AD?= =?UTF-8?q?=20=ED=9A=9F=EC=88=98=20=EC=A0=9C=ED=95=9C=20=EA=B3=A0=EB=A0=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dgu/backend/service/DashBoardServiceImpl.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/backend/src/main/java/org/dgu/backend/service/DashBoardServiceImpl.java b/backend/src/main/java/org/dgu/backend/service/DashBoardServiceImpl.java index ebb00c4..8d6722e 100644 --- a/backend/src/main/java/org/dgu/backend/service/DashBoardServiceImpl.java +++ b/backend/src/main/java/org/dgu/backend/service/DashBoardServiceImpl.java @@ -112,9 +112,21 @@ private DashBoardDto.UserCoinResponse processSingleCoin(UpbitDto.Account account @Override public List getRepresentativeCoins() { List representativeCoinResponses = new ArrayList<>(); + int requestCount = 0; + for (Coin coin : Coin.values()) { UpbitDto.Ticker[] ticker = upbitApiClient.getTickerPriceAtUpbit(UPBIT_URL_TICKER + coin.getMarketName()); representativeCoinResponses.add(DashBoardDto.RepresentativeCoinResponse.of(ticker[0], coin.getKoreanName(), coin.getEnglishName())); + + requestCount++; + if (requestCount % 10 == 0) { + try { + Thread.sleep(1000); // 1초 대기 + } catch (InterruptedException e) { + Thread.currentThread().interrupt(); + throw new RuntimeException(e); + } + } } return representativeCoinResponses;