Domanda

considering to build a hands-free web app for myself that uses nodeJS, express and mongoose with historical and live (dont mind if its 20min delay) from Yahoo Finance API.

Naturally i preferred Google Finance, but it was deprecated circa Oct 2012. Yahoo Finance API and forums depict it as C# friendly...is there a way around it?

È stato utile?

Soluzione

I once wrote a node.js app that queries and parses data from yahoo Finance. It works well, and was pretty easy to do. I'm not sure what you're actually asking, but here are some notes:

First, I tried using YQL (some info here), which can return JSON (and that's optimal for nodejs), but the service cut me off shortly after I started using it because I reached the quota. I don't know what the threshold is, but requesting 1500 stocks once per minute was understandably too much. So I wouldn't recommend using it for something like that.

So I resorted to requesting data from Yahoo's CSV service, avoiding YQL altogether (which, as I understand it, is just a layer on top of the said CSV service). Parsing the CSV data is pretty easy, esp. if you use a module (I used ya-csv).

Here's info about how to request quotes: http://cliffngan.net/a/13

Here's a description of how to query for historical time series (i.e. for graphs) http://code.google.com/p/yahoo-finance-managed/wiki/csvHistQuotesDownload

Now, since you're breaking out the node.js, you might consider using socket.io, because that really lends itself to the constantly changing nature of stock data.

Finally, a word of caution: every day between 4am and market open, yahoo resets all the quotes. I.e. price change becomes 0.00 (or 0%) for all stocks, although prices etc. remain correctly the same as the previous day's close. Not sure exactly why they do that, but it means that if you're doing, say, heatmapping or charting based on % change, it's not going to draw a very interesting graphic during those hours.

Oh, and one more note: I'm not sure you really need to include mongoose, or any DB for that matter. Depends on what you're doing with the data, of course, but if you're going for simplicity and low cost of development and hosting, consider the fact that you could store everything in memory. If the app crashes and restarts, you can just re-request all the quotes.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top