From 2e3f549be0c4be85335679dcc72ff3a2226eb1e6 Mon Sep 17 00:00:00 2001 From: yonghwankim-dev Date: Tue, 28 May 2024 15:57:18 +0900 Subject: [PATCH] =?UTF-8?q?#343=20fix:=20kis=20=ED=94=84=EB=A1=9C=ED=8D=BC?= =?UTF-8?q?=ED=8B=B0=EB=AA=85=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fineants/domain/kis/client/KisClient.java | 16 +++++++-------- .../kis/properties/OauthKisProperties.java | 20 +++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/java/codesquad/fineants/domain/kis/client/KisClient.java b/src/main/java/codesquad/fineants/domain/kis/client/KisClient.java index 558053e63..2bdfe3643 100644 --- a/src/main/java/codesquad/fineants/domain/kis/client/KisClient.java +++ b/src/main/java/codesquad/fineants/domain/kis/client/KisClient.java @@ -19,11 +19,11 @@ import org.springframework.web.reactive.function.client.ClientResponse; import org.springframework.web.reactive.function.client.WebClient; -import codesquad.fineants.global.errors.exception.KisException; -import codesquad.fineants.domain.kis.properties.OauthKisProperties; import codesquad.fineants.domain.kis.domain.dto.response.KisClosingPrice; import codesquad.fineants.domain.kis.domain.dto.response.KisDividend; import codesquad.fineants.domain.kis.domain.dto.response.KisDividendWrapper; +import codesquad.fineants.domain.kis.properties.OauthKisProperties; +import codesquad.fineants.global.errors.exception.KisException; import lombok.extern.slf4j.Slf4j; import reactor.core.publisher.Mono; import reactor.util.retry.Retry; @@ -52,12 +52,12 @@ public Mono fetchAccessToken() { requestBodyMap.put("appsecret", oauthKisProperties.getSecretkey()); return webClient .post() - .uri(oauthKisProperties.getTokenURI()) + .uri(oauthKisProperties.getTokenUrl()) .bodyValue(requestBodyMap) .retrieve() .onStatus(HttpStatus::isError, this::handleError) .bodyToMono(KisAccessToken.class) - .retryWhen(Retry.fixedDelay(Long.MAX_VALUE, Duration.ofMinutes(1))) + .retryWhen(Retry.fixedDelay(Long.MAX_VALUE, Duration.ofSeconds(5))) .log(); } @@ -74,7 +74,7 @@ public Mono fetchCurrentPrice(String tickerSymbol, String autho queryParamMap.add("fid_input_iscd", tickerSymbol); return performGet( - oauthKisProperties.getCurrentPriceURI(), + oauthKisProperties.getCurrentPriceUrl(), headerMap, queryParamMap, KisCurrentPrice.class @@ -98,7 +98,7 @@ public Mono fetchClosingPrice(String tickerSymbol, String autho queryParamMap.add("FID_ORG_ADJ_PRC", "0"); return performGet( - oauthKisProperties.getLastDayClosingPriceURI(), + oauthKisProperties.getClosingPriceUrl(), headerMap, queryParamMap, KisClosingPrice.class @@ -124,7 +124,7 @@ public String fetchDividend(String tickerSymbol, String authorization) { queryParamMap.add("SHT_CD", tickerSymbol); return performGet( - oauthKisProperties.getDividendURI(), + oauthKisProperties.getDividendUrl(), headerMap, queryParamMap, String.class, @@ -150,7 +150,7 @@ public List fetchDividendAll(LocalDate from, LocalDate to, String a queryParamMap.add("SHT_CD", Strings.EMPTY); KisDividendWrapper result = performGet( - oauthKisProperties.getDividendURI(), + oauthKisProperties.getDividendUrl(), headerMap, queryParamMap, KisDividendWrapper.class, diff --git a/src/main/java/codesquad/fineants/domain/kis/properties/OauthKisProperties.java b/src/main/java/codesquad/fineants/domain/kis/properties/OauthKisProperties.java index 8d0414fff..deba75f88 100644 --- a/src/main/java/codesquad/fineants/domain/kis/properties/OauthKisProperties.java +++ b/src/main/java/codesquad/fineants/domain/kis/properties/OauthKisProperties.java @@ -11,19 +11,19 @@ public class OauthKisProperties { private final String appkey; private final String secretkey; - private final String tokenURI; - private final String currentPriceURI; - private final String lastDayClosingPriceURI; - private final String dividendURI; + private final String tokenUrl; + private final String currentPriceUrl; + private final String closingPriceUrl; + private final String dividendUrl; @ConstructorBinding - public OauthKisProperties(String appkey, String secretkey, String tokenURI, String currentPriceURI, - String lastDayClosingPriceURI, String dividendURI) { + public OauthKisProperties(String appkey, String secretkey, String tokenUrl, String currentPriceUrl, + String closingPriceUrl, String dividendUrl) { this.appkey = appkey; this.secretkey = secretkey; - this.tokenURI = tokenURI; - this.currentPriceURI = currentPriceURI; - this.lastDayClosingPriceURI = lastDayClosingPriceURI; - this.dividendURI = dividendURI; + this.tokenUrl = tokenUrl; + this.currentPriceUrl = currentPriceUrl; + this.closingPriceUrl = closingPriceUrl; + this.dividendUrl = dividendUrl; } }