An open API service indexing awesome lists of open source software.

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

A scraper to access Yahoo Finance data
https://github.com/mainstringargs/yahoo-finance-scraper

finance java stock stock-market

Last synced: 6 months ago
JSON representation

A scraper to access Yahoo Finance data

Awesome Lists containing this project

README

          

# 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:

```java
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
```