Skip to content

Commit

Permalink
chore: Price domain에 ticker 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
megymj committed Nov 15, 2023
1 parent 3745ad9 commit 8f4c4dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public class Price {
@Field("nickname")
private String nickname;

@Field("ticker")
private String ticker;

@Field("average_prediction")
private Double average_prediction;

Expand All @@ -45,9 +48,10 @@ public class Price {
private Double WR;

@Builder
private Price(String nickname, Double average_prediction, Double Bollinger, Double MACD,
private Price(String nickname, String ticker, Double average_prediction, Double Bollinger, Double MACD,
Double MOK, Double RSI, Double STCK, Double VR, Double WR) {
this.nickname = nickname;
this.ticker = ticker;
this.average_prediction = average_prediction;
this.Bollinger = Bollinger;
this.MACD = MACD;
Expand All @@ -58,9 +62,10 @@ private Price(String nickname, Double average_prediction, Double Bollinger, Doub
this.WR = WR;
}

public static Price of(String nickname, PriceResponse response) {
public static Price of(String nickname, String ticker, PriceResponse response) {
return Price.builder()
.nickname(nickname)
.ticker(ticker)
.average_prediction(response.getAverage_prediction())
.Bollinger(response.getBollinger())
.MACD(response.getMACD())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public PriceResponse predictPrice(@RequestBody PriceRequest priceRequest) {
throw new CustomException(ErrorCode.INTERNAL_SERVER_ERROR);
}

Price userPrice = Price.of(priceRequest.getNickname(), response);
Price userPrice = Price.of(priceRequest.getNickname(), priceRequest.getTicker(), response);
try {
priceRepository.save(userPrice);
} catch (Exception e) {
Expand Down

0 comments on commit 8f4c4dc

Please sign in to comment.