Has Yahoo finance web service disappeared? API changed? Down temporarily?

后端 未结 9 1436
礼貌的吻别
礼貌的吻别 2020-11-27 13:12

For quite some time I\'ve been using the following REST API to query Yahoo finance for current prices. It is documented in several Stack Overflow posts, e.g. Yahoo finance

相关标签:
9条回答
  • 2020-11-27 13:28

    I am the author of ValueViz on github.

    Daily prices

    You need to be familiar with RESTFUL services.

    https://quantprice.herokuapp.com/api/v1.1/scoop/day?tickers=MSFT&date=2017-06-09

    Historical prices

    You have to provide a date range :

    https://quantprice.herokuapp.com/api/v1.1/scoop/period?tickers=MSFT&begin=2012-02-19&end=2012-02-20

    If you don't provide begin or end it will use the earliest or current date:

    https://quantprice.herokuapp.com/api/v1.1/scoop/period?tickers=MSFT&begin=2012-02-19

    Multiple tickers

    You can just comma separate tickers:

    https://quantprice.herokuapp.com/api/v1.1/scoop/period?tickers=IBM,MSFT&begin=2012-02-19

    Rate limit

    All requests are rate limited to 10 requests per hour. If you want to register for a full access API send me DM on twitter. You will receive an API key to add to the URL.

    We are setting up a paypal account for paid subscription without rates.

    List of tickers available

    https://github.com/robomotic/valueviz/blob/master/scoop_tickers.csv

    I am working also to provide fundamental data and company data from EDGAR. Cheers.

    0 讨论(0)
  • 2020-11-27 13:33

    Since the service is down, I use the following URL to query Yahoo data (for ACA.PA):

    Link

    The JSON result is different but I found the informations that interests me.

    For more information , visit the page https://developer.yahoo.com/yql/

    0 讨论(0)
  • 2020-11-27 13:35

    Yes, it does seem like Yahoo! has discontinued the (private, mostly-undocumented) Yahoo Finance API that many have been relying on for years for currency data. We received some notifications about it over the past 24 hours. (edit: All responses seem to be returning "Not a valid parameter". I suppose there's a chance they may switch it back on, but they don't officially support that API anywhere as far as I can tell.)

    I created Open Exchange Rates about five years ago, and our exchange rate API now supports a community of tens of thousands of developers - and their tens of millions of users - with accurate, up-to-date information.

    Please feel welcome to check out our Forever Free service at https://openexchangerates.org.

    Our API is in a simple, original JSON format, which has actually caught on as a standard method for displaying rates because it's so simple to work with (unlike the Yahoo API, which required you to parse the obscure nested objects to pull out the basic info you needed...)

    If you need assistance porting from the deprecated Yahoo! API, we'll be happy to assist via email.

    (I am the founder of Open Exchange Rates.)

    0 讨论(0)
  • 2020-11-27 13:42

    Check out this excellent API Wrapper, available on NuGet: https://github.com/salmonthinlion/YahooFinanceApi

    Get stock quotes

    var quotes = await Yahoo.Symbol("AAPL", "GOOG").Tag(Tag.LastTradePriceOnly, Tag,ChangeAndPercentChange, Tag.DaysLow, Tag.DaysHigh).GetAsync();
    var aapl = quotes["AAPL"];
    var price = aapl[Tag.LastTradePriceOnly];
    

    Get historical data for a stock

    // You should be able to query data from various markets including US, HK, TW
    var history = await Yahoo.GetHistoricalAsync("AAPL", new DateTime(2016, 1, 1), new DateTime(2016, 7, 1), Period.Daily);
    foreach (var candle in history)
    {
        Console.WriteLine($"DateTime: {candle.DateTime}, Open: {candle.Open}, High: {candle.High}, Low: {candle.Low}, Close: {candle.Close}, Volume: {candle.Volume}, AdjustedClose: {candle.AdjustedClose}");
    }
    

    Get dividend history for a stock

    // You should be able to query data from various markets including US, HK, TW
    var dividendHistory = await Yahoo.GetHistoricalDividendsAsync("AAPL", new DateTime(2016, 1, 1), new DateTime(2016, 7, 1));
    foreach (var candle in dividendHistory)
    {
        Console.WriteLine($"DateTime: {candle.DateTime}, Dividend: {candle.Dividend}");
    }
    
    0 讨论(0)
  • 2020-11-27 13:45

    I was facing a similar issue from last 2-3 days. The url works on the smartphone, where on the desktop it gives "Not a valid parameter" error and HTTP Code 406.

    This can be resolved by adding user agent as "Mozilla/5.0 (Linux; Android 6.0.1; MotoG3 Build/MPI24.107-55) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36" while invoking the get request.

    For example, if you are downloading from curl in php use as follows:

    curl_setopt($session,CURLOPT_USERAGENT,"Mozilla/5.0 (Linux; Android 6.0.1; MotoG3 Build/MPI24.107-55) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.81 Mobile Safari/537.36");
    

    I hope this will resolve the issue.

    0 讨论(0)
  • 2020-11-27 13:46

    I had the same issue. Here is the API URL to pull stock from YAHOO. Hope this helps.

    https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.quotes%20where%20symbol%20in%20(%22YHOO%22)&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys&callback=
    
    0 讨论(0)
提交回复
热议问题