1 | package pl.zankowski.iextrading4j.client.rest.request.forex; | |
2 | ||
3 | import com.google.common.collect.Maps; | |
4 | import pl.zankowski.iextrading4j.api.forex.HistoricalCurrencyRate; | |
5 | import pl.zankowski.iextrading4j.client.rest.manager.RestRequest; | |
6 | import pl.zankowski.iextrading4j.client.rest.manager.RestRequestBuilder; | |
7 | import pl.zankowski.iextrading4j.client.rest.request.marketdata.AbstractMarketDataRequestBuilder; | |
8 | ||
9 | import javax.ws.rs.core.GenericType; | |
10 | import java.time.LocalDate; | |
11 | import java.time.format.DateTimeFormatter; | |
12 | import java.util.List; | |
13 | import java.util.Map; | |
14 | ||
15 | public class HistoricalRatesRequestBuilder extends AbstractMarketDataRequestBuilder<List<List<HistoricalCurrencyRate>>, | |
16 | HistoricalRatesRequestBuilder> { | |
17 | ||
18 | public static final DateTimeFormatter IEX_DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd"); | |
19 | ||
20 | private static final String FROM_PARAM_NAME = "from"; | |
21 | private static final String TO_PARAM_NAME = "to"; | |
22 | private static final String ON_PARAM_NAME = "on"; | |
23 | private static final String LAST_PARAM_NAME = "last"; | |
24 | private static final String FIRST_PARAM_NAME = "first"; | |
25 | ||
26 | private final Map<String, String> queryParams = Maps.newHashMap(); | |
27 | ||
28 | public HistoricalRatesRequestBuilder withFrom(final LocalDate from) { | |
29 | queryParams.put(FROM_PARAM_NAME, IEX_DATE_FORMATTER.format(from)); | |
30 |
1
1. withFrom : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/forex/HistoricalRatesRequestBuilder::withFrom → KILLED |
return this; |
31 | } | |
32 | ||
33 | public HistoricalRatesRequestBuilder withTo(final LocalDate to) { | |
34 | queryParams.put(TO_PARAM_NAME, IEX_DATE_FORMATTER.format(to)); | |
35 |
1
1. withTo : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/forex/HistoricalRatesRequestBuilder::withTo → KILLED |
return this; |
36 | } | |
37 | ||
38 | public HistoricalRatesRequestBuilder withOn(final LocalDate on) { | |
39 | queryParams.put(ON_PARAM_NAME, IEX_DATE_FORMATTER.format(on)); | |
40 |
1
1. withOn : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/forex/HistoricalRatesRequestBuilder::withOn → KILLED |
return this; |
41 | } | |
42 | ||
43 | public HistoricalRatesRequestBuilder withLast(final int last) { | |
44 | queryParams.put(LAST_PARAM_NAME, String.valueOf(last)); | |
45 |
1
1. withLast : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/forex/HistoricalRatesRequestBuilder::withLast → KILLED |
return this; |
46 | } | |
47 | ||
48 | public HistoricalRatesRequestBuilder withFirst(final int first) { | |
49 | queryParams.put(FIRST_PARAM_NAME, String.valueOf(first)); | |
50 |
1
1. withFirst : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/forex/HistoricalRatesRequestBuilder::withFirst → KILLED |
return this; |
51 | } | |
52 | ||
53 | @Override | |
54 | public RestRequest<List<List<HistoricalCurrencyRate>>> build() { | |
55 |
1
1. build : replaced return value with null for pl/zankowski/iextrading4j/client/rest/request/forex/HistoricalRatesRequestBuilder::build → KILLED |
return RestRequestBuilder.<List<List<HistoricalCurrencyRate>>>builder() |
56 | .withPath("/fx/historical").get() | |
57 | .withResponse(new GenericType<List<List<HistoricalCurrencyRate>>>() {}) | |
58 | .addQueryParam(getSymbols()) | |
59 | .addQueryParam(queryParams) | |
60 | .build(); | |
61 | } | |
62 | } | |
Mutations | ||
30 |
1.1 |
|
35 |
1.1 |
|
40 |
1.1 |
|
45 |
1.1 |
|
50 |
1.1 |
|
55 |
1.1 |