Skip to content

Commit 430b46b

Browse files
authored
๐Ÿ› [Bug] ์ตœ๋Œ€ ์ฃผ๋ฌธ ์ •๋ณด ์กฐํšŒ API ๋ฒ„๊ทธ ์ˆ˜์ • - side ํŒŒ๋ผ๋ฏธํ„ฐ ์ถ”๊ฐ€ ๋ฐ ์‹œ์žฅ๊ฐ€(๋งค๋„/๋งค์ˆ˜) ์ˆ˜๋Ÿ‰ ๊ณ„์‚ฐ ์˜ค๋ฅ˜ ํ•ด๊ฒฐ
2 parents b2a45df + 646a96b commit 430b46b

10 files changed

Lines changed: 456 additions & 319 deletions

File tree

โ€Žsrc/main/java/com/example/scoi/domain/invest/client/ExchangeApiClient.javaโ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
//์—ฌ๋Ÿฌ ๊ฑฐ๋ž˜์†Œ ์–ด๋Œ‘ํ„ฐ๋“ค์„ ํ•œ ํƒ€์ž…์œผ๋กœ ๋ฌถ๊ธฐ ์œ„ํ•œ ์ธํ„ฐํŽ˜์ด์Šค
88
public interface ExchangeApiClient {
9-
MaxOrderInfoDTO getMaxOrderInfo(String phoneNumber, ExchangeType exchangeType, String coinType, String unitPrice);
9+
MaxOrderInfoDTO getMaxOrderInfo(String phoneNumber, ExchangeType exchangeType, String coinType, String unitPrice, String orderType, String side);
1010

1111
// ์ฃผ๋ฌธ ๊ฐ€๋Šฅ ์—ฌ๋ถ€ ํ™•์ธ (์ฃผ๋ฌธ ๊ฐ€๋Šฅํ•˜๋ฉด ์ •์ƒ ๋ฐ˜ํ™˜, ๋ถˆ๊ฐ€๋Šฅํ•˜๋ฉด ์˜ˆ์™ธ)
1212
void checkOrderAvailability(

โ€Žsrc/main/java/com/example/scoi/domain/invest/client/adapter/BithumbApiClient.javaโ€Ž

Lines changed: 268 additions & 286 deletions
Large diffs are not rendered by default.

โ€Žsrc/main/java/com/example/scoi/domain/invest/client/adapter/UpbitApiClient.javaโ€Ž

Lines changed: 109 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ public class UpbitApiClient implements ExchangeApiClient {
3535
private final JwtApiUtil jwtApiUtil;
3636

3737
@Override
38-
public MaxOrderInfoDTO getMaxOrderInfo(String phoneNumber, ExchangeType exchangeType, String coinType, String unitPrice) {
38+
public MaxOrderInfoDTO getMaxOrderInfo(String phoneNumber, ExchangeType exchangeType, String coinType, String unitPrice, String orderType, String side) {
3939
try {
4040
// coinType์„ ์—…๋น„ํŠธ ํ˜•์‹์œผ๋กœ ์ •๊ทœํ™” (KRW-BTC ํ˜•์‹์œผ๋กœ ํ†ต์ผ)
4141
String normalizedCoinType = normalizeCoinType(coinType);
4242

4343
String authorization = jwtApiUtil.createUpBitJwt(phoneNumber, null, null);
44-
log.info("์—…๋น„ํŠธ ์ตœ๋Œ€ ์ฃผ๋ฌธ ์ •๋ณด ์กฐํšŒ API ํ˜ธ์ถœ ์‹œ์ž‘ - phoneNumber: {}, coinType: {} (์ •๊ทœํ™”: {}), unitPrice: {}",
45-
phoneNumber, coinType, normalizedCoinType, unitPrice);
44+
log.info("์—…๋น„ํŠธ ์ตœ๋Œ€ ์ฃผ๋ฌธ ์ •๋ณด ์กฐํšŒ API ํ˜ธ์ถœ ์‹œ์ž‘ - phoneNumber: {}, coinType: {} (์ •๊ทœํ™”: {}), unitPrice: {}, orderType: {}, side: {}",
45+
phoneNumber, coinType, normalizedCoinType, unitPrice, orderType, side);
4646

4747
// Feign Client๊ฐ€ ์ž๋™์œผ๋กœ List<Account>๋กœ ๋ณ€ํ™˜ํ•ด์คŒ (ObjectMapper ๋ถˆํ•„์š”!)
4848
List<UpbitResDTO.Account> accounts = upbitFeignClient.getAccounts(authorization);
@@ -54,7 +54,7 @@ public MaxOrderInfoDTO getMaxOrderInfo(String phoneNumber, ExchangeType exchange
5454
account.currency(), account.balance(), account.locked(), account.available());
5555
}
5656

57-
return parseMaxOrderInfoResponse(accounts, normalizedCoinType, unitPrice);
57+
return parseMaxOrderInfoResponse(accounts, normalizedCoinType, unitPrice, orderType, side);
5858

5959
} catch (MemberException e) {
6060
log.error("์—…๋น„ํŠธ API ํ‚ค๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค - phoneNumber: {}", phoneNumber, e);
@@ -148,21 +148,53 @@ public MaxOrderInfoDTO getMaxOrderInfo(String phoneNumber, ExchangeType exchange
148148
}
149149
}
150150

151-
private MaxOrderInfoDTO parseMaxOrderInfoResponse(List<UpbitResDTO.Account> accounts, String coinType, String unitPrice) {
151+
private MaxOrderInfoDTO parseMaxOrderInfoResponse(List<UpbitResDTO.Account> accounts, String coinType, String unitPrice, String orderType, String side) {
152152
try {
153-
// coinType์ด KRW-BTC ํ˜•์‹์ด๋ฉด, ๋งค์ˆ˜ ์‹œ KRW ์ž”์•ก์„ ์กฐํšŒํ•ด์•ผ ํ•จ
154153
String currency;
155-
if (coinType.contains("-")) {
156-
String[] parts = coinType.split("-");
157-
// KRW-BTC ํ˜•์‹์ด๋ฉด KRW ์ž”์•ก ์กฐํšŒ (๋งค์ˆ˜ ๊ฐ€๋Šฅ ๊ธˆ์•ก)
158-
currency = parts[0]; // KRW
154+
String targetCurrency; // ์กฐํšŒํ•  ํ™”ํ (KRW ๋˜๋Š” ์ฝ”์ธ)
155+
156+
// ์‹œ์žฅ๊ฐ€ ์ฃผ๋ฌธ์ธ ๊ฒฝ์šฐ
157+
boolean isMarketOrder = "price".equals(orderType) || "market".equals(orderType);
158+
159+
if (isMarketOrder) {
160+
// side ํŒŒ๋ผ๋ฏธํ„ฐ๋ฅผ ๊ธฐ์ค€์œผ๋กœ ๋งค์ˆ˜/๋งค๋„ ํŒ๋‹จ
161+
if ("bid".equals(side)) {
162+
// ๋งค์ˆ˜: KRW ์ž”์•ก ์กฐํšŒ
163+
targetCurrency = "KRW";
164+
currency = "KRW";
165+
log.info("์—…๋น„ํŠธ ์‹œ์žฅ๊ฐ€ ๋งค์ˆ˜ - {}๋ฅผ ๋งค์ˆ˜ํ•˜๊ธฐ ์œ„ํ•ด KRW ์ž”์•ก ์กฐํšŒ", coinType);
166+
} else if ("ask".equals(side)) {
167+
// ๋งค๋„: ์ฝ”์ธ ์ž”์•ก ์กฐํšŒ
168+
if (coinType.contains("-")) {
169+
String[] parts = coinType.split("-");
170+
targetCurrency = parts[1]; // KRW-BTC -> BTC
171+
currency = parts[1];
172+
} else {
173+
targetCurrency = coinType;
174+
currency = coinType;
175+
}
176+
log.info("์—…๋น„ํŠธ ์‹œ์žฅ๊ฐ€ ๋งค๋„ - {} ์ž”์•ก ์กฐํšŒ", targetCurrency);
177+
} else {
178+
// side๊ฐ€ ์—†๊ฑฐ๋‚˜ ์ž˜๋ชป๋œ ๊ฒฝ์šฐ ๊ธฐ๋ณธ๊ฐ’ (๋งค์ˆ˜)
179+
targetCurrency = "KRW";
180+
currency = "KRW";
181+
log.warn("์—…๋น„ํŠธ ์‹œ์žฅ๊ฐ€ ์ฃผ๋ฌธ - side ํŒŒ๋ผ๋ฏธํ„ฐ๊ฐ€ ์—†๊ฑฐ๋‚˜ ์ž˜๋ชป๋จ ({}), ๊ธฐ๋ณธ๊ฐ’์œผ๋กœ ๋งค์ˆ˜ ์ฒ˜๋ฆฌ", side);
182+
}
159183
} else {
160-
currency = coinType; // BTC ๋“ฑ ๋‹จ์ผ ์ฝ”์ธ
184+
// ์ง€์ •๊ฐ€ ์ฃผ๋ฌธ
185+
if (coinType.contains("-")) {
186+
String[] parts = coinType.split("-");
187+
currency = parts[0]; // KRW
188+
targetCurrency = parts[0];
189+
} else {
190+
currency = coinType;
191+
targetCurrency = coinType;
192+
}
161193
}
162194

163195
String balance = "0";
164196

165-
// ๋จผ์ € ํ•ด๋‹น currency๋กœ ๊ณ„์ขŒ ์ฐพ๊ธฐ
197+
// ํ•ด๋‹น currency๋กœ ๊ณ„์ขŒ ์ฐพ๊ธฐ
166198
for (UpbitResDTO.Account account : accounts) {
167199
if (currency.equals(account.currency())) {
168200
// available์ด ์žˆ์œผ๋ฉด available ์‚ฌ์šฉ (๋งค์ˆ˜ ๊ฐ€๋Šฅ ๊ธˆ์•ก)
@@ -189,28 +221,76 @@ private MaxOrderInfoDTO parseMaxOrderInfoResponse(List<UpbitResDTO.Account> acco
189221
}
190222
}
191223

192-
// unitPrice๊ฐ€ ์žˆ์œผ๋ฉด ์ตœ๋Œ€ ์ฃผ๋ฌธ ์ˆ˜๋Ÿ‰ ๊ณ„์‚ฐ (balance / unitPrice)
193-
// ์†Œ์ˆ˜์  ์ ˆ์‚ฌํ•˜์—ฌ ์ •์ˆ˜๋กœ ๋ฐ˜ํ™˜ (0.8๊ฐœ โ†’ 0๊ฐœ, 1.2๊ฐœ โ†’ 1๊ฐœ)
194224
String maxQuantity = null;
195-
if (unitPrice != null && !unitPrice.isEmpty()) {
196-
try {
197-
BigDecimal balanceDecimal = new BigDecimal(balance);
198-
BigDecimal unitPriceDecimal = new BigDecimal(unitPrice);
199-
200-
if (unitPriceDecimal.compareTo(BigDecimal.ZERO) > 0) {
201-
BigDecimal quantity = balanceDecimal.divide(unitPriceDecimal, 8, RoundingMode.DOWN);
202-
// ์†Œ์ˆ˜์  ์ ˆ์‚ฌํ•˜์—ฌ ์ •์ˆ˜๋กœ ๋ณ€ํ™˜
203-
maxQuantity = quantity.setScale(0, RoundingMode.DOWN).toPlainString();
204-
log.info("์—…๋น„ํŠธ ์ตœ๋Œ€ ์ฃผ๋ฌธ ์ˆ˜๋Ÿ‰ ๊ณ„์‚ฐ - balance: {}, unitPrice: {}, maxQuantity: {} (์ •์ˆ˜)", balance, unitPrice, maxQuantity);
205-
} else {
206-
log.warn("๋‹จ์œ„ ๊ฐ€๊ฒฉ์ด 0 ์ดํ•˜์ž…๋‹ˆ๋‹ค. ์ตœ๋Œ€ ์ฃผ๋ฌธ ์ˆ˜๋Ÿ‰์„ ๊ณ„์‚ฐํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.");
225+
226+
// ์‹œ์žฅ๊ฐ€ ์ฃผ๋ฌธ ์ฒ˜๋ฆฌ
227+
if (isMarketOrder) {
228+
if ("bid".equals(side)) {
229+
// ์‹œ์žฅ๊ฐ€ ๋งค์ˆ˜: ํ˜„์žฌ๊ฐ€ ์กฐํšŒํ•˜์—ฌ ๋Œ€๋žต์ ์ธ ์ˆ˜๋Ÿ‰ ๊ณ„์‚ฐ
230+
try {
231+
List<UpbitResDTO.Ticker> tickers = upbitFeignClient.getTicker(coinType);
232+
233+
if (tickers != null && !tickers.isEmpty()) {
234+
UpbitResDTO.Ticker ticker = tickers.get(0);
235+
if (ticker.trade_price() != null && ticker.trade_price() > 0) {
236+
BigDecimal balanceDecimal = new BigDecimal(balance);
237+
BigDecimal currentPrice = BigDecimal.valueOf(ticker.trade_price());
238+
BigDecimal quantity = balanceDecimal.divide(currentPrice, 8, RoundingMode.DOWN);
239+
// ์†Œ์ˆ˜์  ์ ˆ์‚ฌํ•˜์—ฌ ์ •์ˆ˜๋กœ ๋ณ€ํ™˜
240+
maxQuantity = quantity.setScale(0, RoundingMode.DOWN).toPlainString();
241+
log.info("์—…๋น„ํŠธ ์‹œ์žฅ๊ฐ€ ๋งค์ˆ˜ - KRW ์ž”์•ก: {}, ํ˜„์žฌ๊ฐ€: {}, ์ตœ๋Œ€ ๋งค์ˆ˜ ๊ฐ€๋Šฅ ์ˆ˜๋Ÿ‰: {} (์ •์ˆ˜)",
242+
balance, currentPrice, maxQuantity);
243+
} else {
244+
log.warn("์—…๋น„ํŠธ ํ˜„์žฌ๊ฐ€ ์กฐํšŒ ์‹คํŒจ ๋˜๋Š” ๊ฐ€๊ฒฉ์ด 0 ์ดํ•˜ - market: {}", coinType);
245+
maxQuantity = null;
246+
}
247+
} else {
248+
log.warn("์—…๋น„ํŠธ ํ˜„์žฌ๊ฐ€ ์กฐํšŒ ์‹คํŒจ - ์‘๋‹ต์ด ๋น„์–ด์žˆ์Œ: {}", coinType);
249+
maxQuantity = null;
250+
}
251+
} catch (Exception e) {
252+
log.warn("์—…๋น„ํŠธ ํ˜„์žฌ๊ฐ€ ์กฐํšŒ ์‹คํŒจ - ์‹œ์žฅ๊ฐ€ ๋งค์ˆ˜ ์ˆ˜๋Ÿ‰ ๊ณ„์‚ฐ ๋ถˆ๊ฐ€: {}", e.getMessage());
253+
maxQuantity = null;
254+
}
255+
} else if ("ask".equals(side)) {
256+
// ์‹œ์žฅ๊ฐ€ ๋งค๋„: ์ฝ”์ธ ์ž”์•ก์„ maxQuantity๋กœ ๋ฐ˜ํ™˜ (์ตœ๋Œ€ ๋งค๋„ ๊ฐ€๋Šฅ ์ˆ˜๋Ÿ‰)
257+
// ์†Œ์ˆ˜์  ์ ˆ์‚ฌํ•˜์—ฌ ์ •์ˆ˜๋กœ ๋ณ€ํ™˜
258+
try {
259+
BigDecimal balanceDecimal = new BigDecimal(balance);
260+
maxQuantity = balanceDecimal.setScale(0, RoundingMode.DOWN).toPlainString();
261+
log.info("์—…๋น„ํŠธ ์‹œ์žฅ๊ฐ€ ๋งค๋„ - ์ฝ”์ธ ์ž”์•ก: {}, ์ตœ๋Œ€ ๋งค๋„ ๊ฐ€๋Šฅ ์ˆ˜๋Ÿ‰: {} (์ •์ˆ˜)", balance, maxQuantity);
262+
} catch (NumberFormatException e) {
263+
log.warn("์—…๋น„ํŠธ ์‹œ์žฅ๊ฐ€ ๋งค๋„ - ์ž”์•ก ํŒŒ์‹ฑ ์‹คํŒจ, ์›๋ณธ ๊ฐ’ ์‚ฌ์šฉ: {}", balance);
264+
maxQuantity = balance;
265+
}
266+
} else {
267+
log.warn("์—…๋น„ํŠธ ์‹œ์žฅ๊ฐ€ ์ฃผ๋ฌธ - side ํŒŒ๋ผ๋ฏธํ„ฐ๊ฐ€ ์—†๊ฑฐ๋‚˜ ์ž˜๋ชป๋จ ({}), maxQuantity: null", side);
268+
maxQuantity = null;
269+
}
270+
} else {
271+
// ์ง€์ •๊ฐ€ ์ฃผ๋ฌธ
272+
if (unitPrice != null && !unitPrice.isEmpty()) {
273+
try {
274+
BigDecimal balanceDecimal = new BigDecimal(balance);
275+
BigDecimal unitPriceDecimal = new BigDecimal(unitPrice);
276+
277+
if (unitPriceDecimal.compareTo(BigDecimal.ZERO) > 0) {
278+
BigDecimal quantity = balanceDecimal.divide(unitPriceDecimal, 8, RoundingMode.DOWN);
279+
// ์†Œ์ˆ˜์  ์ ˆ์‚ฌํ•˜์—ฌ ์ •์ˆ˜๋กœ ๋ณ€ํ™˜
280+
maxQuantity = quantity.setScale(0, RoundingMode.DOWN).toPlainString();
281+
log.info("์—…๋น„ํŠธ ์ตœ๋Œ€ ์ฃผ๋ฌธ ์ˆ˜๋Ÿ‰ ๊ณ„์‚ฐ - balance: {}, unitPrice: {}, maxQuantity: {} (์ •์ˆ˜)",
282+
balance, unitPrice, maxQuantity);
283+
} else {
284+
log.warn("๋‹จ์œ„ ๊ฐ€๊ฒฉ์ด 0 ์ดํ•˜์ž…๋‹ˆ๋‹ค. ์ตœ๋Œ€ ์ฃผ๋ฌธ ์ˆ˜๋Ÿ‰์„ ๊ณ„์‚ฐํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.");
285+
}
286+
} catch (NumberFormatException e) {
287+
log.warn("๋‹จ์œ„ ๊ฐ€๊ฒฉ ํ˜•์‹์ด ์˜ฌ๋ฐ”๋ฅด์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ตœ๋Œ€ ์ฃผ๋ฌธ ์ˆ˜๋Ÿ‰์„ ๊ณ„์‚ฐํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. unitPrice: {}", unitPrice);
207288
}
208-
} catch (NumberFormatException e) {
209-
log.warn("๋‹จ์œ„ ๊ฐ€๊ฒฉ ํ˜•์‹์ด ์˜ฌ๋ฐ”๋ฅด์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์ตœ๋Œ€ ์ฃผ๋ฌธ ์ˆ˜๋Ÿ‰์„ ๊ณ„์‚ฐํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. unitPrice: {}", unitPrice);
210289
}
211290
}
212291

213-
log.info("์—…๋น„ํŠธ ์ตœ๋Œ€ ์ฃผ๋ฌธ ์ •๋ณด ์กฐํšŒ ์™„๋ฃŒ - coinType: {}, balance: {}, maxQuantity: {}", coinType, balance, maxQuantity);
292+
log.info("์—…๋น„ํŠธ ์ตœ๋Œ€ ์ฃผ๋ฌธ ์ •๋ณด ์กฐํšŒ ์™„๋ฃŒ - coinType: {}, balance: {}, maxQuantity: {}, orderType: {}",
293+
coinType, balance, maxQuantity, orderType);
214294

215295
return new MaxOrderInfoDTO(balance, maxQuantity);
216296

โ€Žsrc/main/java/com/example/scoi/domain/invest/client/feign/BithumbFeignClient.javaโ€Ž

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,9 @@ BithumbResDTO.CancelOrder cancelOrder(
4646
//๋งˆ์ผ“ ์ฝ”๋“œ ์กฐํšŒ (PUBLIC API - ์ธ์ฆ ๋ถˆํ•„์š”)
4747
@GetMapping("/v1/market/all")
4848
String getMarketAll(@RequestParam(value = "isDetails", required = false) Boolean isDetails);
49+
50+
//ํ˜„์žฌ๊ฐ€ ์กฐํšŒ (PUBLIC API - ์ธ์ฆ ๋ถˆํ•„์š”)
51+
// ๋น—์ธ API๋Š” ๋ฐฐ์—ด์„ ๋ฐ˜ํ™˜ํ•˜๊ฑฐ๋‚˜ ๋‹ค๋ฅธ ํ˜•์‹์„ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์œผ๋ฏ€๋กœ String์œผ๋กœ ๋ฐ›์•„์„œ ํŒŒ์‹ฑ
52+
@GetMapping("/v1/ticker")
53+
String getTicker(@RequestParam("markets") String markets);
4954
}

โ€Žsrc/main/java/com/example/scoi/domain/invest/client/feign/UpbitFeignClient.javaโ€Ž

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,8 @@ UpbitResDTO.CancelOrder cancelOrder(
5050
@RequestHeader("Authorization") String authorization,
5151
@RequestParam("uuid") String uuid
5252
);
53+
54+
//ํ˜„์žฌ๊ฐ€ ์กฐํšŒ (PUBLIC API - ์ธ์ฆ ๋ถˆํ•„์š”)
55+
@GetMapping("/v1/ticker")
56+
List<UpbitResDTO.Ticker> getTicker(@RequestParam("markets") String markets);
5357
}

โ€Žsrc/main/java/com/example/scoi/domain/invest/controller/InvestController.javaโ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@ public ApiResponse<MaxOrderInfoDTO> getMaxOrderInfo(
3434
@RequestParam ExchangeType exchangeType,
3535
@RequestParam String coinType,
3636
@RequestParam(required = false) String unitPrice, // ๋‹จ์œ„ ๊ฐ€๊ฒฉ (์„ ํƒ์ )
37+
@RequestParam(required = false) String orderType, // ์ฃผ๋ฌธ ํƒ€์ž… (limit, price, market)
38+
@RequestParam(required = false) String side, // ์ฃผ๋ฌธ ๋ฐฉํ–ฅ (bid, ask)
3739
@AuthenticationPrincipal CustomUserDetails user
3840
) {
3941
// JWT์—์„œ ์ถ”์ถœํ•œ phoneNumber๋กœ ์กฐํšŒ
40-
MaxOrderInfoDTO result = investService.getMaxOrderInfo(user.getUsername(), exchangeType, coinType, unitPrice);
42+
MaxOrderInfoDTO result = investService.getMaxOrderInfo(user.getUsername(), exchangeType, coinType, unitPrice, orderType, side);
4143

4244
return ApiResponse.onSuccess(InvestSuccessCode.MAX_ORDER_INFO_SUCCESS, result);
4345
}

โ€Žsrc/main/java/com/example/scoi/domain/invest/controller/InvestControllerDocs.javaโ€Ž

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ ApiResponse<MaxOrderInfoDTO> getMaxOrderInfo(
2323
@RequestParam ExchangeType exchangeType,
2424
@RequestParam String coinType,
2525
@RequestParam(required = false) String unitPrice,
26+
@RequestParam(required = false) String orderType,
27+
@RequestParam(required = false) String side,
2628
@AuthenticationPrincipal CustomUserDetails user
2729
);
2830

โ€Žsrc/main/java/com/example/scoi/domain/invest/service/InvestService.javaโ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public class InvestService {
2626
private final BithumbApiClient bithumbApiClient;
2727
private final UpbitApiClient upbitApiClient;
2828

29-
public MaxOrderInfoDTO getMaxOrderInfo(String phoneNumber, ExchangeType exchangeType, String coinType, String unitPrice) {
29+
public MaxOrderInfoDTO getMaxOrderInfo(String phoneNumber, ExchangeType exchangeType, String coinType, String unitPrice, String orderType, String side) {
3030
// ์‚ฌ์šฉ์ž ์กด์žฌ ์—ฌ๋ถ€ ํ™•์ธ
3131
Member member = memberRepository.findByPhoneNumber(phoneNumber)
3232
.orElseThrow(() -> new InvestException(InvestErrorCode.API_KEY_NOT_FOUND));
@@ -37,7 +37,7 @@ public MaxOrderInfoDTO getMaxOrderInfo(String phoneNumber, ExchangeType exchange
3737

3838
try {
3939
// ๊ฑฐ๋ž˜์†Œ ์„œ๋ฒ„ ์‘๋‹ต ์ •์ œํ•ด ๋ณด๋‚ด๊ธฐ
40-
return apiClient.getMaxOrderInfo(phoneNumber, exchangeType, coinType, unitPrice);
40+
return apiClient.getMaxOrderInfo(phoneNumber, exchangeType, coinType, unitPrice, orderType, side);
4141
} catch (InvestException e) {
4242
throw e;
4343
} catch (FeignException e) {

โ€Žsrc/main/java/com/example/scoi/global/client/dto/BithumbResDTO.javaโ€Ž

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,4 +313,35 @@ public record WithdrawalAddressResponse(
313313
String owner_corp_ko_name,
314314
String owner_corp_en_name
315315
) {}
316+
317+
// ํ˜„์žฌ๊ฐ€ ์กฐํšŒ (Ticker)
318+
@JsonIgnoreProperties(ignoreUnknown = true)
319+
public record Ticker(
320+
String market,
321+
String trade_date,
322+
String trade_time,
323+
String trade_date_kst,
324+
String trade_time_kst,
325+
Long trade_timestamp,
326+
Double opening_price,
327+
Double high_price,
328+
Double low_price,
329+
Double trade_price, // ํ˜„์žฌ๊ฐ€
330+
Double prev_closing_price,
331+
String change,
332+
Double change_price,
333+
Double change_rate,
334+
Double signed_change_price,
335+
Double signed_change_rate,
336+
Double trade_volume,
337+
Double acc_trade_volume,
338+
Double acc_trade_volume_24h,
339+
Double acc_trade_price,
340+
Double acc_trade_price_24h,
341+
Long highest_52_week_price,
342+
String highest_52_week_date,
343+
Long lowest_52_week_price,
344+
String lowest_52_week_date,
345+
Long timestamp
346+
) {}
316347
}

โ€Žsrc/main/java/com/example/scoi/global/client/dto/UpbitResDTO.javaโ€Ž

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,4 +335,35 @@ public record WithdrawalAddressResponse(
335335
String exchange_name,
336336
String wallet_type
337337
) {}
338+
339+
// ํ˜„์žฌ๊ฐ€ ์กฐํšŒ (Ticker)
340+
@JsonIgnoreProperties(ignoreUnknown = true)
341+
public record Ticker(
342+
String market,
343+
String trade_date,
344+
String trade_time,
345+
String trade_date_kst,
346+
String trade_time_kst,
347+
Long trade_timestamp,
348+
Double opening_price,
349+
Double high_price,
350+
Double low_price,
351+
Double trade_price, // ํ˜„์žฌ๊ฐ€
352+
Double prev_closing_price,
353+
String change,
354+
Double change_price,
355+
Double change_rate,
356+
Double signed_change_price,
357+
Double signed_change_rate,
358+
Double trade_volume,
359+
Double acc_trade_volume,
360+
Double acc_trade_volume_24h,
361+
Double acc_trade_price,
362+
Double acc_trade_price_24h,
363+
Long highest_52_week_price,
364+
String highest_52_week_date,
365+
Long lowest_52_week_price,
366+
String lowest_52_week_date,
367+
Long timestamp
368+
) {}
338369
}

0 commit comments

Comments
ย (0)