yahoo-finance-scraper

Scraper Library for Yahoo Finance Stock Data.

License

License

GroupId

GroupId

io.github.mainstringargs
ArtifactId

ArtifactId

yahoo-finance-scraper
Last Version

Last Version

1.1
Release Date

Release Date

Type

Type

zip
Description

Description

yahoo-finance-scraper
Scraper Library for Yahoo Finance Stock Data.
Project URL

Project URL

https://github.com/mainstringargs/yahoo-finance-scraper
Source Code Management

Source Code Management

https://github.com/mainstringargs/yahoo-finance-scraper

Download yahoo-finance-scraper

Dependencies

compile (5)

Group / Artifact Type Version
com.google.guava : guava jar 20.0
com.mashape.unirest : unirest-java jar 1.4.9
com.google.code.gson : gson jar 2.8.5
commons-lang : commons-lang jar 2.6
io.github.mainstringargs : stock-data-spi jar 1.1

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Yahoo Finance Scraper

Yahoo Finance discontinued their official API, but data can still be accessed. This project exposes that data as a Java project. There is an Example included which is intended to show how to access data relevant to a specific company.

To get started, clone the project and run:

./gradlew build

To try it out, run this command

./gradlew run

It will output Yahoo's recommendation mean for a couple of stocks.

The Example for code looks like this:

    for (String symbol : args) {

      YahooFinanceUrlBuilder builder =
          new YahooFinanceUrlBuilder().modules(YahooFinanceModules.values()).symbol(symbol);

      YahooFinanceRequest request = new YahooFinanceRequest();

      YahooFinanceData financeData = request.getFinanceData(request.invoke(builder));


      if (financeData.getFinancialData() != null) {
        FinancialData financials = financeData.getFinancialData();

        System.out.println(symbol + ": currentPrice: $" + financials.getCurrentPrice().getRaw()
            + "; recommendationMean " + financials.getRecommendationMean().getRaw());
      }
    }

Which will output something like this:

fb: currentPrice: $198.2235; recommendationMean 1.8
amzn: currentPrice: $1723.34; recommendationMean 1.7
baba: currentPrice: $208.42; recommendationMean 1.7

Versions

Version
1.1
1.0