-
Notifications
You must be signed in to change notification settings - Fork 225
Open
Description
Output:
SLF4J(I): Connected with provider of type [org.slf4j.simple.SimpleServiceProvider]
[main] INFO yahoofinance.quotes.query1v7.QuotesRequest - Sending request: https://query1.finance.yahoo.com/v7/finance/quote?symbols=INTC
Error retrieving stock data: Server returned HTTP response code: 401 for URL: https://query1.finance.yahoo.com/v7/finance/quote?symbols=INTC
I was just running a simple code given below:
import yahoofinance.Stock;
import yahoofinance.YahooFinance;
import java.io.IOException;
import java.math.BigDecimal;
public class StockMarket {
public static void main(String[] args) {
try {
Stock stock = YahooFinance.get("INTC");
BigDecimal price = stock.getQuote().getPrice();
BigDecimal change = stock.getQuote().getChangeInPercent();
BigDecimal peg = stock.getStats().getPeg();
BigDecimal dividend = stock.getDividend().getAnnualYieldPercent();
stock.print();
} catch (IOException e) {
System.out.println("Error retrieving stock data: " + e.getMessage());
}
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels