Skip to content

Error Code 401 #226

@ahmzd21

Description

@ahmzd21

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());
      }
  }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions