private void shortInterestRequestSample() { final List<ShortInterest> shortInterestList = iexTradingClient.executeRequest(new ShortInterestRequestBuilder() .withSample() .withMarket() .build()); System.out.println(shortInterestList); }
public ShortInterestRequestBuilder withMarket() { return withSymbol("market"); }
@Test public void shouldSuccessfullyCreateRequest() { final LocalDate date = LocalDate.of(2017, 5, 5); final RestRequest<List<ShortInterest>> request = new ShortInterestRequestBuilder() .withDate(date) .withSymbol("aapl") .build(); assertThat(request.getMethodType()).isEqualTo(MethodType.GET); assertThat(request.getPath()).isEqualTo("/stock/{symbol}/short-interest/{date}"); assertThat(request.getResponseType()).isEqualTo(new GenericType<List<ShortInterest>>() {}); assertThat(request.getPathParams()).contains(entry("date", "20170505"), entry("symbol", "aapl")); assertThat(request.getQueryParams()).isEmpty(); }
@Test public void shouldSuccessfullyCreateRequestWithMarket() { final RestRequest<List<ShortInterest>> request = new ShortInterestRequestBuilder() .withMarket() .build(); assertThat(request.getMethodType()).isEqualTo(MethodType.GET); assertThat(request.getPath()).isEqualTo("/stock/{symbol}/short-interest/{date}"); assertThat(request.getResponseType()).isEqualTo(new GenericType<List<ShortInterest>>() {}); assertThat(request.getPathParams()).contains(entry("date", ""), entry("symbol", "market")); assertThat(request.getQueryParams()).isEmpty(); }
.withBodyFile("rest/stock/ShortInterestResponse.json"))); final List<ShortInterest> shortInterestList = iexTradingClient.executeRequest(new ShortInterestRequestBuilder() .withSymbol("aapl") .build());
@Override public RestRequest<List<ShortInterest>> build() { return RestRequestBuilder.<List<ShortInterest>>builder() .withPath("/stock/{symbol}/short-interest/{date}") .addPathParam("symbol", getSymbol()) .addPathParam("date", getDate()).get() .withResponse(new GenericType<List<ShortInterest>>() {}) .build(); } }
@Test public void shortInterestAcceptanceTest() { final List<ShortInterest> shortInterestList = iexTradingClient.executeRequest(new ShortInterestRequestBuilder() .withSample() .withMarket() .build()); }
@Test public void shouldSuccessfullyCreateRequestWithSample() { final RestRequest<List<ShortInterest>> request = new ShortInterestRequestBuilder() .withSample() .withMarket() .build(); assertThat(request.getMethodType()).isEqualTo(MethodType.GET); assertThat(request.getPath()).isEqualTo("/stock/{symbol}/short-interest/{date}"); assertThat(request.getResponseType()).isEqualTo(new GenericType<List<ShortInterest>>() {}); assertThat(request.getPathParams()).contains(entry("date", "sample"), entry("symbol", "market")); assertThat(request.getQueryParams()).isEmpty(); }