I am working on a small widget for my projects which basically looks like this. Futures for Yahoo Finance
How can I get the data for Natural Gas, Gasoline, Crude Oil, Heating Oil and their Change?. I want to retrieve those data via json maybe and create a box widget or a ticker. The Image attached is what I am trying to make. Thank you.
PS: I tried CLJ15.NYM Symbol for Crude Oil using yahoo.finance.quotes table in the YQL Console, but it did not work.
You can type the symbol in the same way you would type in a stock. Getting data from Yahoo Finance provides you with a good example of how to use stock symbols with yql.
For those exact 4, it would look like this:
select * from yahoo.finance.quote where symbol in ("CLK15.NYM", "HOK15.NYM", "NGK15.NYM", "RBK15.NYM")
Note: you can use yahoo.finance.quote or yahoo.finance.quotes
Related
I wanna extract the rating of a hotel room from Expedia in Google sheet. Unfortunatley, my code doesn't work. Can you take a look?
=IMPORTXML(https://www.expedia.co.in/Manila-Hotels-ZEN-Rooms-Pioneer-Street.h17368867.Hotel-Information,"//span[#class='rating-number']")
importXml() can import simple HTML, but it does not work with the most of modern sites. In this case too, importXml() was not able to retrieve div, span, etc. Nevertheless, you can get the whole html and then parse it.
Just change your XPath query to //html. And seen from the source, you know where and how to find the rating. So just get it by =mid(A2, find("out of 5.0", A2)-4, 3).
Sample sheet is here. I tested it with a few other hotels and it worked fine.
I read up on YQL. However i'm at a loss on how to get blocks of data.
I can get individual stock data fine but how do you get collated data like the FTSE 100 shares, without having to find the symbol for each 100 shares and pulling that data in individually?
Ideally i would have the hundred shares with each of their bits of data.
Thanks in advance,
Ewan
looks like you are right that only one stock can be queried at a time. since the api is restful, you can easily use a for loop in bash and curl all the stocks.
Whenever we query YQL table we need to give the SYMBOLS (tickers) as inputs. However there is a limit to the number of symbols you can enter in one go.
I created an Excel sheet where I read a list of symbols from a sheet and then query with YQL and dump the data in another sheet.
Let's assume you want to pull out historical prices with the following specifications:
Symbol/Ticker : symbol
StartDate
EndDate
The corresponding weblink to extract this info would be (in VBA syntax)
"http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20yahoo.finance.historicaldata%20where%20symbol%20in%20%28%27 " & symbol & "%27%29%20and%20startDate%20=%20%27" & startDate & "%27%20and%20endDate%20=%20%27" & endDate & "%27&diagnostics=true&env=store://datatables.org/alltableswithkeys"
You can find the Excel sheet present at my blog.
we are very interested to use YQL but unfortunately the query is not supported for Indian stock market , we are building one large web app where wee need to show BSE and NSE tickers with live updates , so we thought to use yahoo financial services but I have tried a lot in the console the below line but this is return with zero data
select * from yahoo.finance.quotes where symbol IN("^BSESN")
For that result we can't able to use yql , I have also change the symbol ^BSESN with other Indian company names like reliance ,tata but nothing is shown, feeling very poor......
select * from yahoo.finance.quotes where symbol IN("^BSESN") ---- not working any idea or suggestion will helpful to me
Thanks in advance
Yahoo's YQL shows uneven performance for bourses outside the West. For example:
You can obtain historical data for Reliance Industries from yahoo.finance.historicaldata using YQL as follows: select * from yahoo.finance.historicaldata where symbol in ('RIL.BO')
You cannot get stock quote from yahoo.finance.quotes using YQL as follows: select * from yahoo.finance.quotes where symbol in ("RIL.BO")
Try it!
This matter (getting a symbol form a company name) has already been solved in the following thread with Yahoo's API and I found the first and third answers quite useful.
I also noticed that the second answer dealt with Google Finance but it uses ticker symbols and not the company name ...
Unfortunately, I learnt that Yahoo sometimes uses different ticker symbols from the stock exchanges.
So I would like to do the same thing — that is, I give a company name and I get its symbol — but with the Google Finance API, instead of Yahoo's.
Is that possible ? Thanks
Back when Google Finance first provided a Google Sheets formula, it was this:
=GoogleLookup(A1, "ticker")
But this no longer works, and Google has been dropping the ball on Finance for quite some time now. The REVERSE lookup is possible tho; ie, given the TICKER SYMBOL you can look up the official corporate name (according to GoogleFinance)...
=GOOGLEFINANCE(B1, "name")
Where A1 is the cell in Google Sheets with the corporate name,
and B1 is the cell in GS w the ticker symbol.
Basically, you now need the ticker symbol to do anything with 'GOOGLEFINANCE'.
'LOOKUP' is still around but has been changed.
If you want ticker symbols, you have to write some API calls, and those solutions can be found elsewhere.
I'm using Yahoo's stock API to get stock quotes, as described here.
Basically, I just assemble a link like this:
http://finance.yahoo.com/d/quotes.csv?s=DOW+MSFT+AAPL+GOOG&f=snl1
which'll give me a list of the current price for those stocks (DOW, MSFT, AAPL, GOOG).
All's nice and dandy, but I'd also like to get the info for the NASDAQ and S&P 500 Indices, but I have no idea what to use as the symbol for those.
I tried all of these:
NASDAQ
INDEXNASDAQ
INDEXNASDAQ:.IXIC
INDEXNASDAQ.IXIC
IXIC
to no avail.
It seems like I have the whole idea flawed (I don't really know much about finance).
Can anyone help me with this?
Use the same symbols you see on the corresponding Yahoo finance page.
Nasdaq = ^IXIC
S&P = ^GSPC
Dow = ^DJI