Comments (27)
I suggest you try: https://github.com/dshe/YahooQuotesApi
from yahoofinanceapi.
Hi, I looked into the code. The problem is that now cookies are empty in response from yahoo finance and that's why it doesn't pass the check that cookies shouldn't be empty. This is the code where it fails https://github.com/karlwancl/YahooFinanceApi/blob/master/YahooFinanceApi/YahooClientFactory.cs. I removed that check and also modified the code for retrieving a crumb. For me now it works fine. I'd push the branch but seems I don't have access rights on doing this.
from yahoofinanceapi.
good news ! Can someone explain how to remove the check? I'm not familiar with this kind of programation.
Pls replace your old YahooFinanceApi.dll with this attached below. YahooFinanceApi.zip
Ciaoooo
Yes it works again, thank you !!
from yahoofinanceapi.
Using synchronous calls and 1 second delay has solved the problem.
from yahoofinanceapi.
I suggest you try the new version (5.1): https://github.com/dshe/YahooQuotesApi
from yahoofinanceapi.
YahooFinanceApi.zip
This are my changes that I made to the code in master branch. Just replace files in original solution with files from archive and than rebuild.
from yahoofinanceapi.
YahooFinanceApi.zip This are my changes that I made to the code in master branch. Just replace files in original solution with files from archive and than rebuild.
Thanks for the Code. Now i experience errors after the change and after several requests:
"Call failed with status code 401 (Unauthorized)"
Do you experienced the same problem?
yes, the 401 error was also happening with old dll. Yahoo has implemented some kind of time out defense against sever overloading and potential ddos attacks by tracking the number / frequency of requests from a specific ip address.
A 401 error code means the user is unauthorised.
To avoid the error, the method must be synchronous. I use a Thread.Sleep pause of 500 ms,/1s between requests.
Avoid any parallelism.
from yahoofinanceapi.
Same problem for me....
from yahoofinanceapi.
I suggest you try: https://github.com/dshe/YahooQuotesApi
My program is in VB.net, can I use a C# Api with?
from yahoofinanceapi.
"I suggest you try: https://github.com/dshe/YahooQuotesApi"
give me this problem:
YahooHistory: failure to reset HttpClient.
in YahooQuotesApi.YahooHistoryRequester.d__9.MoveNext() in C:\projects\yahooquotesapi\YahooQuotesApi\History\YahooHistoryRequester.cs: riga 98
in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
in System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() in YahooQuotesApi.YahooHistoryRequester.<Reset>d__8.MoveNext() in C:\projects\yahooquotesapi\YahooQuotesApi\History\YahooHistoryRequester.cs: riga 67 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in YahooQuotesApi.YahooHistoryRequester.<Request>d__7.MoveNext() in C:\projects\yahooquotesapi\YahooQuotesApi\History\YahooHistoryRequester.cs: riga 35 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in System.Runtime.CompilerServices.ConfiguredTaskAwaitable
1.ConfiguredTaskAwaiter.GetResult()
in YahooQuotesApi.YahooHistory.d__71.MoveNext() in C:\projects\yahooquotesapi\YahooQuotesApi\History\YahooHistory.cs: riga 65 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) in System.Runtime.CompilerServices.ConfiguredTaskAwaitable
1.ConfiguredTaskAwaiter.GetResult()
in YahooQuotesApi.ParallelProducerCache2.<Get>d__4.MoveNext() in C:\projects\yahooquotesapi\YahooQuotesApi\Utilities\ParallelProducerCache.cs: riga 34 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) in System.Runtime.CompilerServices.ConfiguredTaskAwaitable
1.ConfiguredTaskAwaiter.GetResult()
in YahooQuotesApi.YahooHistory.d__61.MoveNext() in C:\projects\yahooquotesapi\YahooQuotesApi\History\YahooHistory.cs: riga 36 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task) in System.Runtime.CompilerServices.ConfiguredTaskAwaitable
1.ConfiguredTaskAwaiter.GetResult()
in YahooQuotesApi.YahooQuotes.<b__12_0>d.MoveNext() in C:\projects\yahooquotesapi\YahooQuotesApi\YahooQuotes.cs: riga 142
in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
in System.Runtime.CompilerServices.ValueTaskAwaiter.GetResult()
in System.Threading.Tasks.Parallel.<>c__501.<<ForEachAsync>b__50_0>d.MoveNext() in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in YahooQuotesApi.YahooQuotes.<AddHistoryToSecurities>d__12.MoveNext() in C:\projects\yahooquotesapi\YahooQuotesApi\YahooQuotes.cs: riga 157 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in YahooQuotesApi.YahooQuotes.<GetSecuritiesAsync>d__10.MoveNext() in C:\projects\yahooquotesapi\YahooQuotesApi\YahooQuotes.cs: riga 93 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in System.Runtime.CompilerServices.ConfiguredTaskAwaitable
1.ConfiguredTaskAwaiter.GetResult()
in YahooQuotesApi.YahooQuotes.d__9.MoveNext() in C:\projects\yahooquotesapi\YahooQuotesApi\YahooQuotes.cs: riga 68
in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
in System.Runtime.CompilerServices.ConfiguredTaskAwaitable1.ConfiguredTaskAwaiter.GetResult() in YahooQuotesApi.YahooQuotes.<GetAsync>d__7.MoveNext() in C:\projects\yahooquotesapi\YahooQuotesApi\YahooQuotes.cs: riga 45 in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) in System.Runtime.CompilerServices.ConfiguredTaskAwaitable
1.ConfiguredTaskAwaiter.GetResult()
in YahooQuotesApi.YahooQuotes.d__6.MoveNext() in C:\projects\yahooquotesapi\YahooQuotesApi\YahooQuotes.cs: riga 29
in System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
in System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
in System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
in System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
in Ts.Core.MarketData.YahooConnector2.<>c__DisplayClass6_0.<b__0>d.MoveNext() in C:\Users\giorg\source\repos\TS\Ts.Core\MarketData\YahooConnector2.cs: riga 34
from yahoofinanceapi.
Hi all,
thks a lot
in case YahooFinanceApi doesn't work anymore, I will switch to yfinance
from yahoofinanceapi.
I had same problem getting history data from Yahoo on both YahooFinanceAPI and YahooQuotesAPI. Did yahoo change something to break the code? Did windows have an update that broke the code?
Both work to get current quotes - just not the history.
I can get yahoo history data using python's pandas_datareader without a problem but I need it from C#,
from yahoofinanceapi.
honestly speaking, I had no time to deeply investigate the problem yet. I believe it is protocol http client request vs yahoo server but I am not sure. (maybe ... HTTP2 vs HTTP1)
For the time being, I solved the problem using yfinance that is widely supported and used in the community. It is easy to wrap into a C# project without any performance loss.
from yahoofinanceapi.
from yahoofinanceapi.
Great thks! I modified the dll removing check too, It works perfectly!
from yahoofinanceapi.
good news ! Can someone explain how to remove the check? I'm not familiar with this kind of programation.
from yahoofinanceapi.
good news ! Can someone explain how to remove the check? I'm not familiar with this kind of programation.
hi,
1\ open your program in visual studio
2\ go in references, remove existing YahooFinanceApi.dll,
2\ unzip attached dll. Then in references: right mouse button, add reference and use YahooFinanceApi.dll unzipped
3\ rebuild solution
from yahoofinanceapi.
good news ! Can someone explain how to remove the check? I'm not familiar with this kind of programation.
Hi pls disregard the previous dll attached. It doesn't work.
I am working on it.
I will send you late afternoon
Ciao
from yahoofinanceapi.
good news ! Can someone explain how to remove the check? I'm not familiar with this kind of programation.
Pls replace your old YahooFinanceApi.dll with this attached below.
YahooFinanceApi.zip
Ciaoooo
from yahoofinanceapi.
from yahoofinanceapi.
Is this YahooFinanceApi.dll now ok? Will there be a normal upgrade through NuGet for this - a new version 2.1.3? There is also an a 3.0.0-beta3 but is has lots of changes and isn’t very compatible with 2.1.2. I’ve avoided using this so far since it is so different. Thanks, Don From: stagnoman @.> Sent: Wednesday, May 4, 2022 5:53 AM To: karlwancl/YahooFinanceApi @.> Cc: DonWM @.>; Comment @.> Subject: Re: [karlwancl/YahooFinanceApi] Exception: Failure to create client (Issue #52) good news ! Can someone explain how to remove the check? I'm not familiar with this kind of programation. Pls replace your old YahooFinanceApi.dll with this attached below. YahooFinanceApi.zip https://github.com/karlwancl/YahooFinanceApi/files/8620456/YahooFinanceApi.zip Ciaoooo — Reply to this email directly, view it on GitHub <#52 (comment)> , or unsubscribe https://github.com/notifications/unsubscribe-auth/AHQQC4L2CZPWVLFLPXIM54LVIJXLHANCNFSM5UT2IF3A . You are receiving this because you commented. https://github.com/notifications/beacon/AHQQC4JDI2ERAV42MDS7KBDVIJXLHA5CNFSM5UT2IF3KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOIKME4DQ.gif Message ID: @.*** @.***> >
Is this YahooFinanceApi.dll now ok? Yes, it works.
Will there be a normal upgrade through NuGet for this - a new version 2.1.3? No, in Nuget there is the old one. You have to replace the old dll with mine attached above manually in VS, build the program then.
There is also an a 3.0.0-beta3 but is has lots of changes and isn’t very compatible with 2.1.2. I’ve avoided using this so far since it is so different. Dll above is still net 2.0
from yahoofinanceapi.
For me it does'nt work after 5-6 querry it responds with 401 error
from yahoofinanceapi.
The 401 error was also happening with old dll. Yahoo has implemented some kind of time out defense against sever overloading and potential ddos attacks by tracking the number / frequency of requests from a specific ip address.
A 401 error code means the user is unauthorised.
To avoid the error, the method must be synchronous. I use a Thread.Sleep pause of 500 ms,/1s between requests.
Avoid any parallelism.
from yahoofinanceapi.
@lucastagnitta thanks for your dll but i have a problem. Assembly errors with Flurl
from yahoofinanceapi.
@lucastagnitta thanks for your dll but i have a problem. Assembly errors with Flurl
In the past, I got some troubles as well, I am using the following version, installed manually
Flurl 2.5.2
Flurl.Http 2.1.0
from yahoofinanceapi.
Hi, I looked into the code. The problem is that now cookies are empty in response from yahoo finance and that's why it doesn't pass the check that cookies shouldn't be empty. This is the code where it fails https://github.com/karlwancl/YahooFinanceApi/blob/master/YahooFinanceApi/YahooClientFactory.cs. I removed that check and also modified the code for retrieving a crumb. For me now it works fine. I'd push the branch but seems I don't have access rights on doing this.
Could you please show your exact changes in "YahooClientFactory.cs"? Would be very helpful. Thank you!
from yahoofinanceapi.
YahooFinanceApi.zip This are my changes that I made to the code in master branch. Just replace files in original solution with files from archive and than rebuild.
Thanks for the Code. Now i experience errors after the change and after several requests:
"Call failed with status code 401 (Unauthorized)"
Do you experienced the same problem?
from yahoofinanceapi.
Related Issues (20)
- Dividend Date HOT 1
- Exchange rate? HOT 1
- DividendDate issue HOT 1
- Empty dictionary? HOT 2
- stock split before after data is always zero HOT 4
- Can I retrieve historical data by hour?
- Is 3.0.0-beta3 the final version?
- v7 API now breaks with "code":"Unauthorized","description":"Invalid Cookie" HOT 16
- Failed with status code 403 on Android HOT 1
- Premarket data HOT 1
- Error Too Many Requests HOT 6
- Failing with Status code 502 since Dec 4? HOT 14
- Flurl.Http dependencies issues HOT 1
- Call failed with status code 500 HOT 1
- FlurlHttpException with StatusCode: 429, ReasonPhrase: 'Too Many Requests' HOT 10
- Error code 500 (Cannot find server.): GET https://fc.yahoo.com HOT 2
- Stock split question HOT 1
- Can't install nuget: Cycle Detected
- Flurl.Http.FlurlHttpException: 'Call failed with status code 429 (Too Many Requests): HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yahoofinanceapi.