Getting Stock Prices from the Web

As the final step to complete our net asset application, we have to get the stock price from the web. We have the list of ticker symbols and the units in the file stocks.xml we saw earlier. For each of these symbols, we need to fetch the closing price. Thankfully, Yahoo provides a web service that we can use to get stock data. To find the latest closing price for Google stocks, for example, we can visit the following URL:

The parameters s, a, b, and c represent the ticker symbol, start month (January is 0), start day, and start year, respectively. If you don’t specify the end dates using the parameters d, e, and f, the service returns all prices ...

Get Pragmatic Scala now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.