O'Reilly logo

Pragmatic Scala by Venkat Subramaniam

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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:

 
http://ichart.finance.yahoo.com/table.csv?s=GOOG&a=00&b=01&c=2015

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required