Skip to content

Commit

Permalink
#53 [feat] : 차트 선택 지표 목록 조회 API 구현 (GET)
Browse files Browse the repository at this point in the history
  • Loading branch information
bbbang105 committed Jun 9, 2024
1 parent 3657f1a commit 24a4a59
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,12 @@ public ResponseEntity<ApiResponse<List<ChartDto.OHLCVResponse>>> getOHLCVCharts(
List<ChartDto.OHLCVResponse> ohlcvResponses = chartService.getOHLCVCharts(koreanName, candleName);
return ApiResponse.onSuccess(SuccessStatus.SUCCESS_GET_OHLCV_CHART, ohlcvResponses);
}

// 차트 선택 지표 목록을 조회하는 API
@GetMapping("/options")
public ResponseEntity<ApiResponse<List<ChartDto.ChartOptionResponse>>> getAllChartOptions() {

List<ChartDto.ChartOptionResponse> chartOptionResponses = chartService.getAllChartOptions();
return ApiResponse.onSuccess(SuccessStatus.SUCCESS_GET_ALL_CHART_OPTIONS, chartOptionResponses);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@

public interface ChartService {
List<ChartDto.OHLCVResponse> getOHLCVCharts(String koreanName, String candleType);
List<ChartDto.ChartOptionResponse> getAllChartOptions();
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ public List<ChartDto.OHLCVResponse> getOHLCVCharts(String koreanName, String can
return fetchUpdatedCandleInfo(koreanName, candleName);
}

// 차트 선택 지표 목록을 반환하는 메서드
@Override
public List<ChartDto.ChartOptionResponse> getAllChartOptions() {
List<Market> markets = marketRepository.findAll();
List<Candle> candles = candleRepository.findAll();

return markets.stream()
.flatMap(market -> candles.stream()
.map(candle -> ChartDto.ChartOptionResponse.of(market, candle)))
.collect(Collectors.toList());
}

// 캔들 정보 최신화 메서드
@Transactional
protected void updateCandleInfo(String koreanName, String candleName) {
Expand Down

0 comments on commit 24a4a59

Please sign in to comment.