-
Notifications
You must be signed in to change notification settings - Fork 123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Yahoo Finance v7 API (since 2017-05-16) - initial work (1/3) #37
Conversation
Thanks for the patch. But it is returning empty quote data array for me
|
Sure :) That snippet's working for me though. If you cloned from my repo, make sure you checkout the 'cookie' branch (it's not the default). If you patched an existing install, make sure you
|
Ok. Thanks. I have that code running now. But hitting an error. TypeError: str.trim is not a function |
Yeah, that's the cookie bug in |
I tried
That installed request-promise 4.2.1 but still getting the same error. |
That's weird. $ grep ' "version' node_modules/{request-promise,tough-cookie}/package.json
node_modules/request-promise/package.json: "version": "4.2.1"
node_modules/tough-cookie/package.json: "version": "2.3.2" |
Whoot! tough-cookie was 2.3.1 - but that that didnt fix it. The Thanks. I have a couple of fixes I will submit soon. Nothing major. |
Ok awesome! Thanks! That's a bit worrying that I can put |
- Catch exception to prevent fatal error. ( Might not be required with updated dependencies ) - Default the symbol for the url ( prevent it getting the cookie for 'undefined' )
Catch and default
Hello, I am the founder of https://dividendstocks.io/, which completely relies on the Yahoo finance API, so currently our service is completely broken. I wanted to thank all the contributors of this package, without which our site won't even exist :) Do you know when the fix will be released? Thanks! |
Thank you @gadicc rm -rf node_modules/ // edit package.json to make use of commit# from gadicc "yahoo-finance": "git@github.com:gadicc/node-yahoo-finance.git#9e4f30d48b65b2c4b657d918f02b20ceecd5e2d2" Just in case @marcoschwartz or others wants to make use your fix temporarily |
hey @marcoschwartz, your site looks awesome :) thanks, this will be my first contribution to @sarjarapu, thanks for sharing that. I think best to use Just a heads up though, this is still in development. See the Roadmap at the top for where we currently stand. I guess historical() is probably working as expected. For snapshot() it's going to take some time to see if I can get it to return results in the same format as before (so nothing breaks). I never used That might also be relevant for Other note: just added some unit and integration tests using mocha/chai/proxyquire. Still needs refining but I think it's a good foundation. The tests at least are ES7 via babel. |
Thanks! Your latest commit worked for me, I've been able to 'patch' my app by making some changes to adapt to the new data format. Indeed, there is much more data returned by the new version. Do you know how to actually force the snapshot function to return all this additional data? Or is there a documentation somewhere on the Yahoo side? |
Don't rely on the current output of But yes, I'm sure we can have a new API that's more faithful to the current Yahoo API. Check out the new quote(), which I guess is returning exactly what |
TSLA quote didn't have dividend fields, added quote_MSFT.json, adding missing dividend fields to docs/quote.md, started old API field map in fields._map.
@marcoschwartz, or anyone else who understands this stuff :), I'd be grateful if you could check my map at fields._map if it looks right and if you can find anything else that I missed, because, I don't work in finance, and really have no idea between the different of a forward or trailing PE / EPS, whether data is realtime (I guess it isn't, but maybe we should still return SOME result), post/pre/regular market, etc. My last commit also added some missing fields to the quote doc (see the commit for a diff), since the TSLA example I used was missing them, and MSFT had them. If there are any more missing fields let me know. |
@marcoschwartz |
@gadicc I had a look at the map, seems right, I only have a doubt about:
In my opinion Yahoo Finance (the website) uses the trailingPE to display the PE on the pages, so I guess r & r2 should be inverted. |
Ah amazing, thanks guys!! |
Hey @gadicc nice to see you here again :) The addition of tests (no preference of framework), One thing I'd suggest is to break this mega PR into smaller PRs so that we can make it available for all much quicker. As the recent change in Yahoo's API completely broke |
@pilwon, hey! I actually just renamed Ok sure. I'm done for the day but will get on the smaller PRs tomorrow. Everyone else, note the renaming of |
@gadicc As for the naming of new function ( |
My 2c would be to continue with the current naming convention. There was a suggestion of breaking changes or enhanced features, and those could go in new functions with new the names. And as mentioned, this library is pretty close to the google finance one. It might be a good idea to keep them as close as possible in case Time/Yahoo do something to completely block access in the future. Disclaimer: I currently only use this library for historical data. |
Thanks guys. I agree re the name and am going to change it back :) Going to see what I can finish up today as time allows. |
@pilwon, on second thought, if shipping out a new release is the priority, let's rather merge this and I'll continue the rest as another PR. There is just so much interdependency on getCrumb, tests, utils, etc that splitting everything up will be quite complicated and take time to do so carefully and thoughtfully. Also we have to disable I added warnings to all the methods, see 3a082b6. I think it's our responsibility for a quick interim release to make this quite prevalent. What are your thoughts? We could consider only showing each warning once though - just don't want people to miss them :) For On that same note, see the updated README (in "Files Changed", above - it spans a few commits). I removed all the Let me know your thoughts. Of course I'm suggesting all these commits be squashed :) (or as mentioned, I'll make a few distinct PRs but it will take more time). Otherwise yeah I think we're ok but if you have any code of your own to test too that would be good! Ready to carry on from where I've left off after :) |
@gadicc I am totally fine with that approach and I completely agree with your ideas around deprecation warning and updates to README. Let me know when it's ready to be merged onto master. |
Oops I wasn't very clear :-( You can go ahead and merge.
…On 24 May 2017 21:32, "Pilwon Huh" ***@***.***> wrote:
@gadicc <https://github.com/gadicc> I am totally fine with that approach
and completely agree with your ideas around warning and README. Let me know
when it's ready to be merged onto master.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#37 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAXUGrydf2dz3RmEPPeqp_Bhycs7PF7Oks5r9IWpgaJpZM4NeJqO>
.
|
Addresses #36. WIP. Posting so it's public and obvious this is being worked on, and so others can test and comment on approach before final submission. Feedback appreciated.
Roadmap:
symbols
option (i.e. multiple symbols in one request - this needs multiple HTTP requests in yahoo's new API).other options:quote()
,getQuote()
,fetchQuote()
,snapshot2()
?docs, add to READMEsymbols
option (i.e. multiple symbols in one request - this needs multiple HTTP requests in yahoo's new API).Of particular note, how we retrieve the crumb, see the yahooCrumb.js source. Are we confident this will be reliable in the long term?
Trying it out / getting involved
Cloning from GitHub to play around
git clone git@github.com:gadicc/node-yahoo-finance.git
-b cookie
cd node-yahoo-finance
npm i
and use as usual.
Using in your project directly
This is dangerous. It's fine to do this to play around, but don't forget to remove it afterwards. Don't deploy with this work-in-progress code.
package.json
rm -rf node_modules/{tough-cookie,yahoo-finance}
npm i
(thanks sarjarapu)