Skip to content

Commit

Permalink
Fixed download of latest and historic quotes from Yahoo Finance
Browse files Browse the repository at this point in the history
  • Loading branch information
buchen committed May 27, 2018
1 parent a5326e2 commit a24dd03
Show file tree
Hide file tree
Showing 4 changed files with 627 additions and 2,495 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,20 @@ public void testParsingHistoricalQuotes() throws IOException
List<LatestSecurityPrice> prices = feed.getHistoricalQuotes(responseBody, new ArrayList<Exception>());
Collections.sort(prices, new SecurityPrice.ByDate());

assertThat(prices.size(), is(2257));
assertThat(prices.size(), is(123));

LatestSecurityPrice price = new LatestSecurityPrice(LocalDate.of(2003, Month.JANUARY, 1), //
Values.Quote.factorize(29.35), //
Values.Quote.factorize(29.35), //
Values.Quote.factorize(29.35), //
LatestSecurityPrice price = new LatestSecurityPrice(LocalDate.of(2017, Month.NOVEMBER, 27), //
Values.Quote.factorize(188.55), //
0, //
0, //
0);
assertThat(prices.get(0), equalTo(price));

price = new LatestSecurityPrice(LocalDate.of(2011, Month.SEPTEMBER, 22), Values.Quote.factorize(32.74), //
Values.Quote.factorize(34.16), //
Values.Quote.factorize(32.35), //
10825200);
price = new LatestSecurityPrice(LocalDate.of(2018, Month.MAY, 25), //
Values.Quote.factorize(188.3), //
0, //
0, //
0);
assertThat(prices.get(prices.size() - 1), equalTo(price));
}

Expand All @@ -91,19 +92,20 @@ public void testParsingHistoricalAdjustedCloseQuotes() throws IOException
List<LatestSecurityPrice> prices = feed.getHistoricalQuotes(responseBody, new ArrayList<Exception>());
Collections.sort(prices, new SecurityPrice.ByDate());

assertThat(prices.size(), is(2257));
assertThat(prices.size(), is(123));

LatestSecurityPrice price = new LatestSecurityPrice(LocalDate.of(2003, Month.JANUARY, 1), //
Values.Quote.factorize(22.55), //
Values.Quote.factorize(29.35), //
Values.Quote.factorize(29.35), //
LatestSecurityPrice price = new LatestSecurityPrice(LocalDate.of(2017, Month.NOVEMBER, 27), //
Values.Quote.factorize(180.344), //
0, //
0, //
0);
assertThat(prices.get(0), equalTo(price));

price = new LatestSecurityPrice(LocalDate.of(2011, Month.SEPTEMBER, 22), Values.Quote.factorize(32.74), //
Values.Quote.factorize(34.16), //
Values.Quote.factorize(32.35), //
10825200);
price = new LatestSecurityPrice(LocalDate.of(2018, Month.MAY, 25), //
Values.Quote.factorize(188.3), //
0, //
0, //
0);
assertThat(prices.get(prices.size() - 1), equalTo(price));
}

Expand Down
Loading

0 comments on commit a24dd03

Please sign in to comment.