Skip to content

Commit ee1a5a1

Browse files
committed
feat: improve streams
1 parent bb3b4f4 commit ee1a5a1

File tree

6 files changed

+62
-58
lines changed

6 files changed

+62
-58
lines changed

backend/src/main/java/ch/xxx/trader/adapter/config/ForwardServletFilter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
6161
} else {
6262
Iterable<Locale> iterable = () -> myRequest.getLocales().asIterator();
6363
Locale userLocale = StreamSupport.stream(iterable.spliterator(), false)
64-
.filter(myLocale -> SUPPORTED_LOCALES.contains(myLocale)).findFirst().orElse(Locale.ENGLISH);
64+
.filter(SUPPORTED_LOCALES::contains).findFirst().orElse(Locale.ENGLISH);
6565
String forwardPath = String.format("/%s/index.html", userLocale.getLanguage());
6666
// LOG.info(String.format("Forward to: %s", forwardPath));
6767
RequestDispatcher dispatcher = myRequest.getServletContext().getRequestDispatcher(forwardPath);

backend/src/main/java/ch/xxx/trader/usecase/services/BitfinexService.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.util.Optional;
3131
import java.util.concurrent.CompletableFuture;
3232
import java.util.concurrent.TimeUnit;
33+
import java.util.function.Predicate;
3334
import java.util.stream.Collectors;
3435
import java.util.stream.Stream;
3536

@@ -153,7 +154,7 @@ private void createBfHourlyAvg() {
153154
.collect(Collectors.toList()))
154155
.flatMap(myList -> Mono
155156
.just(myList.stream().flatMap(Collection::stream).collect(Collectors.toList())));
156-
collectBf.filter(myColl -> !myColl.isEmpty())
157+
collectBf.filter(Predicate.not(Collection::isEmpty))
157158
.flatMap(myColl -> this.myMongoRepository.insertAll(Mono.just(myColl), BF_HOUR_COL)
158159
.timeout(Duration.ofSeconds(5L))
159160
.doOnError(ex -> LOG.warn("Bitfinex prepare hour data failed", ex))
@@ -189,7 +190,7 @@ private void createBfDailyAvg() {
189190
.collect(Collectors.toList()))
190191
.flatMap(myList -> Mono
191192
.just(myList.stream().flatMap(Collection::stream).collect(Collectors.toList())));
192-
collectBf.filter(myColl -> !myColl.isEmpty())
193+
collectBf.filter(Predicate.not(Collection::isEmpty))
193194
.flatMap(myColl -> this.myMongoRepository.insertAll(Mono.just(myColl), BF_DAY_COL)
194195
.subscribeOn(mongoScheduler).timeout(Duration.ofSeconds(5L))
195196
.doOnError(ex -> LOG.warn("Bitfinex prepare day data failed", ex))

backend/src/main/java/ch/xxx/trader/usecase/services/BitstampService.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.util.Optional;
3131
import java.util.concurrent.CompletableFuture;
3232
import java.util.concurrent.TimeUnit;
33+
import java.util.function.Predicate;
3334
import java.util.stream.Collectors;
3435
import java.util.stream.Stream;
3536

@@ -151,7 +152,7 @@ private void createBsHourlyAvg() {
151152
.collect(Collectors.toList()))
152153
.flatMap(myList -> Mono
153154
.just(myList.stream().flatMap(Collection::stream).collect(Collectors.toList())));
154-
collectBs.filter(myColl -> !myColl.isEmpty())
155+
collectBs.filter(Predicate.not(Collection::isEmpty))
155156
.flatMap(myColl -> this.myMongoRepository.insertAll(Mono.just(myColl), BS_HOUR_COL)
156157
.timeout(Duration.ofSeconds(5L))
157158
.doOnError(ex -> LOG.warn("Bitstamp prepare hour data failed", ex))
@@ -187,7 +188,7 @@ private void createBsDailyAvg() {
187188
.collect(Collectors.toList()))
188189
.flatMap(myList -> Mono
189190
.just(myList.stream().flatMap(Collection::stream).collect(Collectors.toList())));
190-
collectBs.filter(myColl -> !myColl.isEmpty())
191+
collectBs.filter(Predicate.not(Collection::isEmpty))
191192
.flatMap(myColl -> this.myMongoRepository.insertAll(Mono.just(myColl), BS_DAY_COL)
192193
.timeout(Duration.ofSeconds(5L))
193194
.doOnError(ex -> LOG.warn("Bitstamp prepare hour data failed", ex))

backend/src/main/java/ch/xxx/trader/usecase/services/CoinbaseService.java

+10-9
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import java.util.concurrent.TimeUnit;
4040
import java.util.function.BiConsumer;
4141
import java.util.function.Function;
42+
import java.util.function.Predicate;
4243
import java.util.stream.Collectors;
4344
import java.util.stream.Stream;
4445

@@ -101,42 +102,42 @@ public Mono<QuoteCb> insertQuote(Mono<QuoteCb> quote) {
101102

102103
public Flux<QuoteCbSmall> todayQuotesBc() {
103104
Query query = MongoUtils.buildTodayQuery(Optional.empty());
104-
return this.myMongoRepository.find(query, QuoteCb.class).filter(q -> filterEvenMinutes(q))
105+
return this.myMongoRepository.find(query, QuoteCb.class).filter(CoinbaseService::filterEvenMinutes)
105106
.map(quote -> new QuoteCbSmall(quote.getCreatedAt(), quote.getUsd(), quote.getEur(), quote.getEth(),
106107
quote.getLtc()));
107108
}
108109

109110
public Flux<QuoteCbSmall> sevenDaysQuotesBc() {
110111
Query query = MongoUtils.build7DayQuery(Optional.empty());
111-
return this.myMongoRepository.find(query, QuoteCb.class, CB_HOUR_COL).filter(q -> filterEvenMinutes(q))
112+
return this.myMongoRepository.find(query, QuoteCb.class, CB_HOUR_COL).filter(CoinbaseService::filterEvenMinutes)
112113
.map(quote -> new QuoteCbSmall(quote.getCreatedAt(), quote.getUsd(), quote.getEur(), quote.getEth(),
113114
quote.getLtc()));
114115
}
115116

116117
public Flux<QuoteCbSmall> thirtyDaysQuotesBc() {
117118
Query query = MongoUtils.build30DayQuery(Optional.empty());
118-
return this.myMongoRepository.find(query, QuoteCb.class, CB_DAY_COL).filter(q -> filterEvenMinutes(q))
119+
return this.myMongoRepository.find(query, QuoteCb.class, CB_DAY_COL).filter(CoinbaseService::filterEvenMinutes)
119120
.map(quote -> new QuoteCbSmall(quote.getCreatedAt(), quote.getUsd(), quote.getEur(), quote.getEth(),
120121
quote.getLtc()));
121122
}
122123

123124
public Flux<QuoteCbSmall> nintyDaysQuotesBc() {
124125
Query query = MongoUtils.build90DayQuery(Optional.empty());
125-
return this.myMongoRepository.find(query, QuoteCb.class, CB_DAY_COL).filter(q -> filterEvenMinutes(q))
126+
return this.myMongoRepository.find(query, QuoteCb.class, CB_DAY_COL).filter(CoinbaseService::filterEvenMinutes)
126127
.map(quote -> new QuoteCbSmall(quote.getCreatedAt(), quote.getUsd(), quote.getEur(), quote.getEth(),
127128
quote.getLtc()));
128129
}
129130

130131
public Flux<QuoteCbSmall> sixMonthsQuotesBc() {
131132
Query query = MongoUtils.buildTimeFrameQuery(Optional.empty(), TimeFrame.Month6);
132-
return this.myMongoRepository.find(query, QuoteCb.class, CB_DAY_COL).filter(q -> filterEvenMinutes(q))
133+
return this.myMongoRepository.find(query, QuoteCb.class, CB_DAY_COL).filter(CoinbaseService::filterEvenMinutes)
133134
.map(quote -> new QuoteCbSmall(quote.getCreatedAt(), quote.getUsd(), quote.getEur(), quote.getEth(),
134135
quote.getLtc()));
135136
}
136137

137138
public Flux<QuoteCbSmall> oneYearQuotesBc() {
138139
Query query = MongoUtils.buildTimeFrameQuery(Optional.empty(), TimeFrame.Year1);
139-
return this.myMongoRepository.find(query, QuoteCb.class, CB_DAY_COL).filter(q -> filterEvenMinutes(q))
140+
return this.myMongoRepository.find(query, QuoteCb.class, CB_DAY_COL).filter(CoinbaseService::filterEvenMinutes)
140141
.map(quote -> new QuoteCbSmall(quote.getCreatedAt(), quote.getUsd(), quote.getEur(), quote.getEth(),
141142
quote.getLtc()));
142143
}
@@ -207,7 +208,7 @@ private void createCbHourlyAvg() {
207208
.timeout(Duration.ofSeconds(5L)).doOnError(ex -> LOG.warn("Coinbase prepare hour data failed", ex))
208209
.onErrorResume(ex -> Mono.empty()).subscribeOn(this.mongoScheduler).collectList()
209210
.map(quotes -> makeCbQuoteHour(quotes, timeFrame.begin(), timeFrame.end()));
210-
collectCb.filter(myColl -> !myColl.isEmpty())
211+
collectCb.filter(Predicate.not(Collection::isEmpty))
211212
.flatMap(myColl -> this.myMongoRepository.insertAll(Mono.just(myColl), CB_HOUR_COL)
212213
.timeout(Duration.ofSeconds(5L))
213214
.doOnError(ex -> LOG.warn("Coinbase prepare hour data failed", ex))
@@ -239,7 +240,7 @@ private void createCbDailyAvg() {
239240
.timeout(Duration.ofSeconds(5L)).doOnError(ex -> LOG.warn("Coinbase prepare day data failed", ex))
240241
.onErrorResume(ex -> Mono.empty()).subscribeOn(this.mongoScheduler).collectList()
241242
.map(quotes -> makeCbQuoteDay(quotes, timeFrame.begin(), timeFrame.end()));
242-
collectCb.filter(myColl -> !myColl.isEmpty())
243+
collectCb.filter(Predicate.not(Collection::isEmpty))
243244
.flatMap(myColl -> this.myMongoRepository.insertAll(Mono.just(myColl), CB_DAY_COL)
244245
.timeout(Duration.ofSeconds(5L))
245246
.doOnError(ex -> LOG.warn("Coinbase prepare day data failed", ex))
@@ -370,7 +371,7 @@ private GetSetMethodFunctions createGetMethodFunction(PropertyDescriptor propert
370371
return gsmf;
371372
}
372373

373-
private boolean filterEvenMinutes(QuoteCb quote) {
374+
private static boolean filterEvenMinutes(QuoteCb quote) {
374375
return MongoUtils.filterEvenMinutes(quote.getCreatedAt());
375376
}
376377
}

backend/src/main/java/ch/xxx/trader/usecase/services/ItbitService.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import java.util.Optional;
3232
import java.util.concurrent.CompletableFuture;
3333
import java.util.concurrent.TimeUnit;
34+
import java.util.function.Predicate;
3435
import java.util.stream.Collectors;
3536
import java.util.stream.Stream;
3637

@@ -124,7 +125,7 @@ private void createIbHourlyAvg() {
124125
.collect(Collectors.toList()))
125126
.flatMap(myList -> Mono
126127
.just(myList.stream().flatMap(Collection::stream).collect(Collectors.toList())));
127-
collectIb.filter(myColl -> !myColl.isEmpty())
128+
collectIb.filter(Predicate.not(Collection::isEmpty))
128129
.flatMap(myColl -> this.myMongoRepository.insertAll(Mono.just(myColl), IB_HOUR_COL)
129130
.timeout(Duration.ofSeconds(5L))
130131
.doOnError(ex -> LOG.warn("Itbit prepare hour data failed", ex))
@@ -160,7 +161,7 @@ private void createIbDailyAvg() {
160161
.collect(Collectors.toList()))
161162
.flatMap(myList -> Mono
162163
.just(myList.stream().flatMap(Collection::stream).collect(Collectors.toList())));
163-
collectIb.filter(myColl -> !myColl.isEmpty())
164+
collectIb.filter(Predicate.not(Collection::isEmpty))
164165
.flatMap(myColl -> this.myMongoRepository.insertAll(Mono.just(myColl), IB_DAY_COL)
165166
.timeout(Duration.ofSeconds(5L))
166167
.doOnError(ex -> LOG.warn("Itbit prepare day data failed", ex))

backend/src/main/java/ch/xxx/trader/usecase/services/StatisticService.java

+42-42
Original file line numberDiff line numberDiff line change
@@ -77,104 +77,104 @@ private <T extends Quote> Mono<CommonStatisticsDto> calcStatistics(List<T> quote
7777

7878
<T extends Quote> void calcStatistics5Years(List<T> quotes, CommonStatisticsDto commonStatisticsDto) {
7979
List<T> quotes5Year = quotes.stream()
80-
.filter(myQuote -> myQuote.getCreatedAt().after(this.createBeforeDate(0, 5))).toList();
80+
.filter(myQuote -> myQuote.getCreatedAt().after(StatisticService.createBeforeDate(0, 5))).toList();
8181
commonStatisticsDto.setRange5Year(
82-
new RangeDto(this.getMinMaxValue(quotes5Year, false), this.getMinMaxValue(quotes5Year, true)));
83-
commonStatisticsDto.setPerformance5Year(this.calcPerformance(quotes5Year));
84-
commonStatisticsDto.setAvgVolume5Year(this.calcAvgVolume(quotes5Year));
85-
commonStatisticsDto.setVolatility5Year(this.calcVolatility(quotes5Year));
82+
new RangeDto(StatisticService.getMinMaxValue(quotes5Year, false), StatisticService.getMinMaxValue(quotes5Year, true)));
83+
commonStatisticsDto.setPerformance5Year(StatisticService.calcPerformance(quotes5Year));
84+
commonStatisticsDto.setAvgVolume5Year(StatisticService.calcAvgVolume(quotes5Year));
85+
commonStatisticsDto.setVolatility5Year(StatisticService.calcVolatility(quotes5Year));
8686
}
8787

8888
<T extends Quote> void calcStatistics2Years(List<T> quotes, CommonStatisticsDto commonStatisticsDto) {
8989
List<T> quotes2Year = quotes.stream()
90-
.filter(myQuote -> myQuote.getCreatedAt().after(this.createBeforeDate(0, 2))).toList();
90+
.filter(myQuote -> myQuote.getCreatedAt().after(StatisticService.createBeforeDate(0, 2))).toList();
9191
commonStatisticsDto.setRange2Year(
92-
new RangeDto(this.getMinMaxValue(quotes2Year, false), this.getMinMaxValue(quotes2Year, true)));
93-
commonStatisticsDto.setPerformance2Year(this.calcPerformance(quotes2Year));
94-
commonStatisticsDto.setAvgVolume2Year(this.calcAvgVolume(quotes2Year));
95-
commonStatisticsDto.setVolatility2Year(this.calcVolatility(quotes2Year));
92+
new RangeDto(StatisticService.getMinMaxValue(quotes2Year, false), StatisticService.getMinMaxValue(quotes2Year, true)));
93+
commonStatisticsDto.setPerformance2Year(StatisticService.calcPerformance(quotes2Year));
94+
commonStatisticsDto.setAvgVolume2Year(StatisticService.calcAvgVolume(quotes2Year));
95+
commonStatisticsDto.setVolatility2Year(StatisticService.calcVolatility(quotes2Year));
9696
}
9797

9898
<T extends Quote> void calcStatistics1Year(List<T> quotes, CommonStatisticsDto commonStatisticsDto) {
9999
List<T> quotes1Year = quotes.stream()
100-
.filter(myQuote -> myQuote.getCreatedAt().after(this.createBeforeDate(0, 1))).toList();
100+
.filter(myQuote -> myQuote.getCreatedAt().after(StatisticService.createBeforeDate(0, 1))).toList();
101101
commonStatisticsDto.setRange1Year(
102-
new RangeDto(this.getMinMaxValue(quotes1Year, false), this.getMinMaxValue(quotes1Year, true)));
103-
commonStatisticsDto.setPerformance1Year(this.calcPerformance(quotes1Year));
104-
commonStatisticsDto.setAvgVolume1Year(this.calcAvgVolume(quotes1Year));
105-
commonStatisticsDto.setVolatility1Year(this.calcVolatility(quotes1Year));
102+
new RangeDto(StatisticService.getMinMaxValue(quotes1Year, false), StatisticService.getMinMaxValue(quotes1Year, true)));
103+
commonStatisticsDto.setPerformance1Year(StatisticService.calcPerformance(quotes1Year));
104+
commonStatisticsDto.setAvgVolume1Year(StatisticService.calcAvgVolume(quotes1Year));
105+
commonStatisticsDto.setVolatility1Year(StatisticService.calcVolatility(quotes1Year));
106106
}
107107

108108
<T extends Quote> void calcStatistics6Months(List<T> quotes, CommonStatisticsDto commonStatisticsDto) {
109109
List<T> quotes6Month = quotes.stream()
110-
.filter(myQuote -> myQuote.getCreatedAt().after(this.createBeforeDate(6, 0))).toList();
111-
commonStatisticsDto.setPerformance6Month(this.calcPerformance(quotes6Month));
112-
commonStatisticsDto.setAvgVolume6Month(this.calcAvgVolume(quotes6Month));
113-
commonStatisticsDto.setVolatility6Month(this.calcVolatility(quotes6Month));
110+
.filter(myQuote -> myQuote.getCreatedAt().after(StatisticService.createBeforeDate(6, 0))).toList();
111+
commonStatisticsDto.setPerformance6Month(StatisticService.calcPerformance(quotes6Month));
112+
commonStatisticsDto.setAvgVolume6Month(StatisticService.calcAvgVolume(quotes6Month));
113+
commonStatisticsDto.setVolatility6Month(StatisticService.calcVolatility(quotes6Month));
114114
commonStatisticsDto.setRange6Month(
115-
new RangeDto(this.getMinMaxValue(quotes6Month, false), this.getMinMaxValue(quotes6Month, true)));
115+
new RangeDto(StatisticService.getMinMaxValue(quotes6Month, false), StatisticService.getMinMaxValue(quotes6Month, true)));
116116
}
117117

118118
<T extends Quote> void calcStatistics3Months(List<T> quotes, CommonStatisticsDto commonStatisticsDto) {
119119
List<T> quotes3Month = quotes.stream()
120-
.filter(myQuote -> myQuote.getCreatedAt().after(this.createBeforeDate(3, 0))).toList();
120+
.filter(myQuote -> myQuote.getCreatedAt().after(StatisticService.createBeforeDate(3, 0))).toList();
121121
commonStatisticsDto.setRange3Month(
122-
new RangeDto(this.getMinMaxValue(quotes3Month, false), this.getMinMaxValue(quotes3Month, true)));
123-
commonStatisticsDto.setPerformance3Month(this.calcPerformance(quotes3Month));
124-
commonStatisticsDto.setAvgVolume3Month(this.calcAvgVolume(quotes3Month));
125-
commonStatisticsDto.setVolatility3Month(this.calcVolatility(quotes3Month));
122+
new RangeDto(StatisticService.getMinMaxValue(quotes3Month, false), StatisticService.getMinMaxValue(quotes3Month, true)));
123+
commonStatisticsDto.setPerformance3Month(StatisticService.calcPerformance(quotes3Month));
124+
commonStatisticsDto.setAvgVolume3Month(StatisticService.calcAvgVolume(quotes3Month));
125+
commonStatisticsDto.setVolatility3Month(StatisticService.calcVolatility(quotes3Month));
126126
}
127127

128128
<T extends Quote> void calcStatistics1Month(List<T> quotes, CommonStatisticsDto commonStatisticsDto) {
129-
Date beforeDate = this.createBeforeDate(1, 0);
129+
Date beforeDate = StatisticService.createBeforeDate(1, 0);
130130
List<T> quotes1Month = quotes.stream()
131131
.filter(myQuote -> myQuote.getCreatedAt().after(beforeDate)).toList();
132132
commonStatisticsDto.setRange1Month(
133-
new RangeDto(this.getMinMaxValue(quotes1Month, false), this.getMinMaxValue(quotes1Month, true)));
134-
commonStatisticsDto.setAvgVolume1Month(this.calcAvgVolume(quotes1Month));
135-
commonStatisticsDto.setPerformance1Month(this.calcPerformance(quotes1Month));
136-
commonStatisticsDto.setVolatility1Month(this.calcVolatility(quotes1Month));
133+
new RangeDto(StatisticService.getMinMaxValue(quotes1Month, false), StatisticService.getMinMaxValue(quotes1Month, true)));
134+
commonStatisticsDto.setAvgVolume1Month(StatisticService.calcAvgVolume(quotes1Month));
135+
commonStatisticsDto.setPerformance1Month(StatisticService.calcPerformance(quotes1Month));
136+
commonStatisticsDto.setVolatility1Month(StatisticService.calcVolatility(quotes1Month));
137137
}
138138

139-
private <T extends Quote> BigDecimal calcVolatility(List<T> quotes) {
139+
private static <T extends Quote> BigDecimal calcVolatility(List<T> quotes) {
140140
final BigDecimal average = quotes.size() < 3 ? BigDecimal.ZERO
141-
: quotes.stream().map(myQuote -> this.getLastValue(myQuote))
141+
: quotes.stream().map(myQuote -> StatisticService.getLastValue(myQuote))
142142
.reduce(BigDecimal.ZERO, (acc, value) -> acc.add(value))
143143
.divide(BigDecimal.valueOf(quotes.size()), MathContext.DECIMAL128);
144-
BigDecimal variance = quotes.size() < 3 ? BigDecimal.ZERO : quotes.stream().map(myQuote -> this.getLastValue(myQuote)).map(lastValue -> lastValue.subtract(average))
144+
BigDecimal variance = quotes.size() < 3 ? BigDecimal.ZERO : quotes.stream().map(myQuote -> StatisticService.getLastValue(myQuote)).map(lastValue -> lastValue.subtract(average))
145145
.map(avgDifference -> avgDifference.multiply(avgDifference))
146146
.reduce(BigDecimal.ZERO, (acc, value) -> acc.add(value)).divide(BigDecimal.valueOf(quotes.size()), MathContext.DECIMAL128);
147147
BigDecimal volatility = variance.sqrt(MathContext.DECIMAL128);
148148
return volatility;
149149
}
150150

151-
private <T extends Quote> BigDecimal calcAvgVolume(List<T> quotes) {
151+
private static <T extends Quote> BigDecimal calcAvgVolume(List<T> quotes) {
152152
return quotes.size() < 3 ? BigDecimal.ZERO
153-
: quotes.stream().map(myQuote -> this.getVolume(myQuote))
153+
: quotes.stream().map(myQuote -> StatisticService.getVolume(myQuote))
154154
.reduce(BigDecimal.ZERO, (acc, value) -> acc.add(value))
155155
.divide(BigDecimal.valueOf(quotes.size()), MathContext.DECIMAL128);
156156
}
157157

158-
private <T extends Quote> BigDecimal getVolume(T myQuote) {
158+
private static <T extends Quote> BigDecimal getVolume(T myQuote) {
159159
return myQuote instanceof QuoteBs ? ((QuoteBs) myQuote).getLast() : ((QuoteBf) myQuote).getLast_price();
160160
}
161161

162-
private <T extends Quote> Double calcPerformance(List<T> quotes) {
162+
private static <T extends Quote> Double calcPerformance(List<T> quotes) {
163163
return quotes.size() < 3 ? 0.0
164-
: ((this.getLastValue(quotes.get(quotes.size()-1)).doubleValue() / this.getLastValue(quotes.get(0)).doubleValue()) - 1) * 100;
164+
: ((StatisticService.getLastValue(quotes.get(quotes.size()-1)).doubleValue() / StatisticService.getLastValue(quotes.get(0)).doubleValue()) - 1) * 100;
165165
}
166166

167-
private <T extends Quote> BigDecimal getMinMaxValue(List<T> quotes, boolean max) {
168-
Stream<BigDecimal> valueStream = quotes.stream().map(myQuote -> this.getLastValue(myQuote));
167+
private static <T extends Quote> BigDecimal getMinMaxValue(List<T> quotes, boolean max) {
168+
Stream<BigDecimal> valueStream = quotes.stream().map(myQuote -> StatisticService.getLastValue(myQuote));
169169
return max ? valueStream.max(BigDecimal::compareTo).orElse(BigDecimal.ZERO)
170170
: valueStream.min(BigDecimal::compareTo).orElse(BigDecimal.ZERO);
171171
}
172172

173-
private <T extends Quote> BigDecimal getLastValue(T myQuote) {
173+
private static <T extends Quote> BigDecimal getLastValue(T myQuote) {
174174
return myQuote instanceof QuoteBs ? ((QuoteBs) myQuote).getLast() : ((QuoteBf) myQuote).getLast_price();
175175
}
176176

177-
private Date createBeforeDate(int months, int years) {
177+
private static Date createBeforeDate(int months, int years) {
178178
return Date.from(LocalDate.now().minusMonths(months).minusYears(years).atStartOfDay()
179179
.atZone(ZoneId.systemDefault()).toInstant());
180180
}

0 commit comments

Comments
 (0)