karlwancl / YahooFinanceApi

A handy Yahoo! Finance api wrapper, based on .NET Standard 2.0

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error code 500 (Cannot find server.): GET https://fc.yahoo.com

memoryfraction opened this issue · comments

Flurl.Http.FlurlHttpException: Call failed with status code 500 (Cannot find server.): GET https://fc.yahoo.com
image

Code

[TestMethod]
public async Task GetDailyData_Should_Work()
{
    // 设置时间范围(过去1年)
    var toDate = DateTime.UtcNow;
    var fromDate = toDate.AddMonths(-1);

    // 创建一个标的(BTC/USD)并请求历史数据
    var symbol = "BTC-USD";
    var candles = await Yahoo.GetHistoricalAsync(symbol, fromDate, toDate, Period.Daily); // Daily, Weekly, Monthly

    // 访问OHLCV数据
    foreach (var candle in candles)
    {
        Console.WriteLine($"Date: {candle.DateTime}, Open: {candle.Open}, High: {candle.High}, Low: {candle.Low}, Close: {candle.Close}, Volume: {candle.Volume}");
    }
    Assert.IsTrue(candles != null && candles.Any());
}

seems it's an error caused by yahoo finance from yesterday
But finance(a python package), is working at the same time. I don't know why
image
Comment: the printscreen is from: https://fc.yahoo.com/

@memoryfraction
Could you try to upgrade your nuget package version?
I had the same issue, but it was resolved after the upgrade.
This seems to be resolved in #66