YQL don't provide Indian stock quote related data - jquery-ui

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!

Related

Google Finance does not show last closing price after market hours. It just shows last *traded* price instead of *closing*

My query is on stock market of India where I fetch the quotes from =googlefinance function in my google sheet. I was very disappointed to know that the function does not show last closing price. Instead, it shows the last traded price.
Lets take an example of a stock RELIANCE:
=GoogleFinance("NSE:reliance", "price") result is 2498.00 which is incorrect.
Actual closing on Friday, 16 Sep 2022 was 2499.20 as per official National Stock Exchange of India. You may refer to this link for the Close price and the screenshot below
The incorrect quote 2498.00 is the last traded price before market closing
The correct quote is 2499.20 when the markets were closed.
This behavior is common across all stocks of Indian stock market. I have used almost all the parameters those are available in the =googlefinance function but I could not find a way to get the correct stock quote.
Then I decided to scrape the value from the official website using the following without success
<div id="closePrice">2,499.20</div>
//*[#id="closePrice"]
/html/body/div[2]/div[4]/div[2]/div[1]/div[4]/ul/li[6]/div[1]
document.querySelector("#closePrice")
I searched a lot of valuable articles on this site and also on google but could not find a solution which would fetch the desired result. Can someone help me with a way to get 2499.20 as a result for RELIANCE stock either using =googlefinance function or by scraping the value from office website?
Thank you.
Solution suggested by #TheMaster (Thank you so much!)
=LAMBDA(gf,INDEX(gf,ROWS(gf),2))(GOOGLEFINANCE("NSE:RELIANCE", "close",TODAY()-5,15))
Two other ways
=index(GOOGLEFINANCE("NSE:reliance","Close",today()-5,15),4,2)
=query(GOOGLEFINANCE("NSE:reliance","Close",today()-5,15),"select Col2 where Col1 < date '"&TEXT(today()+1, "YYYY-MM-DD")&"' order by Col1 desc limit 1",False)
I am also keen to know which one of these or other methods (if any) will get the results faster without crashes or any other processing issues as my googlesheet is loaded with thousands of stock quotes which will be refreshed every 1 minute.
Only historical prices support close attribute. Use the start date argument to get historical prices and get the last close:
=LAMBDA(gf,INDEX(gf,ROWS(gf),2))(GOOGLEFINANCE("NSE:RELIANCE", "close",TODAY()-5,15))
This is another way of achieving the result.
=query(GOOGLEFINANCE("NSE:reliance","Close",today()-5,15),"select Col2 where Col1 < date '"&TEXT(today()+1, "YYYY-MM-DD")&"' order by Col1 desc limit 1",False)
When I compared performance of both the solutions =LAMBDA and =QUERY on 2500+ stocks, I found query to be more faster than lambda.
Cheers!
However, my main query remains unresolved as no formula of google finance gives today's close until the actual day is over.

How to get commodity data from yahoo finance?

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

Yahoo Query Language (YQL) in iOS

Is it possible to get ALL results in a SELECT statement using the YQL without specifying a where clause.
For example, this block of code will give me stock information for these companies:
SELECT * FROM yahoo.finance.quotes WHERE symbol in ('YHOO','AAPL','GOOG','MSFT')
But, I am wanting an entire list of every single stock in the Yahoo database (something like this)
SELECT * FROM yahoo.finance.quotes
Why is this not working? When I do it in YQL console(https://developer.yahoo.com/yql/console/?q=show%20tables&env=store://datatables.org/alltableswithkeys), it tells me 'Cannot find required keys in where clause; expecting required keys: (symbol)'. Do I always have to use a where clause? If this is the case, then this doesn't seem very useful. If anybody knows a way to get all the stocks without a clause, I'd greatly appreciate some help.

Getting block data from YQL

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.

how to get results from Yahoo Ireland or Yahoo India search, using YQL

I just want to use YQL to get the top 10 results for a particular query, and a region, eg Yahoo India, or Yahoo Ireland.
How do i do this?
Thanks,
Arvind.
You can use a region value when querying against the search.web table, like
select * from search.web where query="pizza" and region="in"
(Try this query the YQL console.)
Available region values are listed in the Supported Regions and Languages for Web and News Search page for the Yahoo! BOSS API, which the search.web data table uses.
Following changes with the Yahoo Pipes V2 'upgrade' some YQL tables have been dropped.
Thankfully some new ones have appeared but are not widely known about yet.
SELECT * FROM microsoft.bing.web WHERE query="pizza india"

Resources