Skip to content

Commit

Permalink
Merge pull request #71 from onesimus-wiafe/SCRUM-62-portfolio-control…
Browse files Browse the repository at this point in the history
…-and-access

update ordervalidation
  • Loading branch information
onesimus-wiafe authored Aug 8, 2024
2 parents 7180fe8 + a3da697 commit a87c208
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,20 @@ private List<MarketData> getMarketDataFromExchange(String ticker, String exchang

private List<MarketData> getMarketDataFromCache(String ticker, String exchanges) {
return switch (AvailableExchanges.valueOf(exchanges.toUpperCase())) {
case EXCHANGE1 -> List.of(this.marketDataRepo.getMarketData(ticker + "_EX1").orElse(null));
case EXCHANGE2 -> List.of(this.marketDataRepo.getMarketData(ticker + "_EX2").orElse(null));
case EXCHANGE1 -> {
MarketData data = this.marketDataRepo.getMarketData(ticker + "_EX1").orElse(null);
if (data == null){
yield List.of();
}
else yield List.of(data);
}
case EXCHANGE2 -> {
MarketData data = this.marketDataRepo.getMarketData(ticker + "_EX2").orElse(null);
if (data == null){
yield List.of();
}
else yield List.of(data);
}
case NONE -> List.of();
case ALL -> {
List<MarketData> data = getMarketDataFromCache(ticker, "EXCHANGE1");
Expand Down

0 comments on commit a87c208

Please sign in to comment.