How to get stock of finance yahoo API - yahoo-finance

I want to get data of some selected stock of finance yahoo API. I am listing these API here .
Chart
http://finance.yahoo.com/echarts?s=AAPL+Interactive#
Key statistics
http://finance.yahoo.com/q/ks?s=AAPL+Key+Statistics
Competitors
http://finance.yahoo.com/q/co?s=AAPL+Competitors
Analyst Opinion
http://finance.yahoo.com/q/ao?s=AAPL+Analyst+Opinion
Analyst Estimates
http://finance.yahoo.com/q/ae?s=AAPL+Analyst+Estimates
Major Holders
http://finance.yahoo.com/q/mh?s=AAPL+Major+Holders
Income Statement (annual and Quarterly)
http://finance.yahoo.com/q/is?s=AAPL
Balance Sheet (annual and Quarterly)
http://finance.yahoo.com/q/bs?s=AAPL+Balance+Sheet&annual
Cash Flow (annual and Quarterly)
http://finance.yahoo.com/q/cf?s=AAPL+Cash+Flow&annual
Is there any api which give me exact solution for this.Even it is paid.Please Provide me correct and sufficient information also thanks in advance.

You can get most of what you're looking for using the yahoo_fin package in Python. Its documentation is here: http://theautomatic.net/yahoo_fin-documentation/.
Here's some examples:
Pulling analyst info (e.g. https://finance.yahoo.com/quote/AAPL/analysts?p=AAPL):
from yahoo_fin.stock_info import *
get_analysts_info("AAPL")
Income statment:
get_income_statement("AAPL")
Cash flow statment:
get_cash_flow("AAPL")
Balance sheet:
get_balance_sheet("AAPL")
Key statistics (e.g. https://finance.yahoo.com/quote/AAPL/key-statistics?p=AAPL):
get_stats("AAPL")
Major holders (e.g. https://finance.yahoo.com/quote/AAPL/holders?p=AAPL):
get_holders("AAPL")
You just need to replace "AAPL" with whatever ticker you want data for.

Related

Google sheets - How to import revenue from Google Finance

I have a gsheet, where in the column A there are plenty of listed companies' (from different stock exchanges) tickers. In column B and C I need to have a data regarding Market Capitalization and Revenue for each company respectively. For Market Cap I've just used Googlefinance formula, but unfortunately due to its limitation I am unable to import the financial data.
I've tried "=IMPORTXML("https://www.google.com/finance/quote/TICKER","//table//tr[contains(#class,'roXhBd')]")" but unfortunately it returns only quaterly data, and I have no idea how to convert it to display annual values.

Google Ads API: want to find the cost data through API

The Image shows the overview of ads related to an ad account, I need to find the cost marked in the pic through API
I tried with
ad_group metrics.average_cost, metrics.cost,
account_budget.amount_served_micros,
account_budget.total_adjustments_micros,
account_budget.proposed_spending_limit_micros,
account_budget_proposal.account_budget,
account_budget_proposal.approved_spending_limit_micros, account_budget_proposal.proposed_spending_limit_micros,
campaign.campaign_budget,
campaign_budget.amount_micros,
campaign_budget.total_amount_micros
most of the values I got in these are zero or not relevant to the cost in the overview (marked in pic) . Can someone help me find the cost value( which is marked in the image) in the ads overview screen through GoogleAds API.
Your query isn't a complete query. We don't know what resource you're querying. For example, why are you requesting budgets?
If you share your code, we might be able to help you more. But you need to query the campaign costs from the campaign resource and aggregate yourself.
https://developers.google.com/google-ads/api/fields/v12/campaign?hl=en

Why does Google Finance display the wrong price for IOC (Indian Oil Corporation) in Google Sheets?

I am using Google Sheets for fetching EOD prices of Indian stocks, using the function
=GOOGLEFINANCE("IOC","price")
Google is returning 19.51 but the closing price for IOC on 11-11-2019 is INR 135.40.
price shows real-time of a particular stock. To get closing price use close.
Use complete ticker symbol from Google Finance. "NSE:IOC" for Indian Oil.
For example:
=GOOGLEFINANCE("NSE:IOC","close",DATE(2019,11,11))
For more information you can visit the documentation.
See this image as a working example:
I found a workaround:
=ROUND(IF(MIN(GOOGLEFINANCE(A1,"marketcap")/GOOGLEFINANCE(A1,"shares"),GOOGLEFINANCE(A1,"price"))=0,GOOGLEFINANCE(A1,"marketcap")/GOOGLEFINANCE(A1,"shares"),MIN(GOOGLEFINANCE(A1,"marketcap")/GOOGLEFINANCE(A1,"shares"),GOOGLEFINANCE(A1,"price"))),3)
Haven't fully tested it yet but works so far.
First of All Google Finance function is not designed to be used for only Indian Markets hence this problem is occuring. When you search for the live prices of IOC (Indian Oil Corporation as is yours case) its showing the prices of a scrip named IOC (Itochu Corp a Japanese Company listed on Frankfurt Stock exchange)Price of IOC as FRA stock
So to Get the Price of Indian Oil Corporation you have to use the script name as NSE:IOC instead of just IOC

Yahoo Finance API get list of all mutual funds and ETFs tickers

I'm looking for a way to get list of all mutual funds and ETFs tickers from Yahoo Finance. I've found few solutions like for example:
https://github.com/Benny-/Yahoo-ticker-symbol-downloader
or
http://investexcel.net/all-yahoo-finance-stock-tickers/
But unfortunantely after checking dozens of random tickers most of them didn't belong to mutual funds category. Having list of this tickers seems useful as long I could find a way to check ticker's category.
On Yahoo Finance website using search box, popup show ticker's category. How to replicate this functionality programmatically or using for example YQL?
EDIT:
After following Daniel's advise I've successfully filtered tickers and
updated them on my GitHub:
https://github.com/MichaelDz6/Yahoo_Finance_ETFs_Web_Scraper
It's possible to tell wether ticker is mutual fund or ETF but it's hard to distinct between mutual fund and ETF.
As an example let's take mututal fund with ticker TIBIX. From what I know only mutual funds and ETFs have category "Fund Family" in their profile tab. So you need YQL that checks whether ticker contains HTML span containing "Fund Family" inside.
Raw YQL query
select * from htmlstring where url='https://finance.yahoo.com/quote/TIBIX/profile?p=TIBIX' and xpath='//span/*[contains(.,"Fund Family")]//text()'
Endpoint for the query
https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20htmlstring%20where%20url%3D'https%3A%2F%2Ffinance.yahoo.com%2Fquote%2FTIBIX%2Fprofile%3Fp%3DTIBIX'%20and%20xpath%3D'%2F%2Fspan%2F*%5Bcontains(.%2C%22Fund%20Family%22)%5D%2F%2Ftext()'&format=json&env=store%3A%2F%2Fdatatables.org%2Falltableswithkeys
If you ticker is mutual fund or ETF, query should return such response:
{"query":{"count":1,"created":"2017-09-25T07:07:10Z","lang":"en-US","results":{"result":"Fund Family"}}}
Either way result will be empty.

How to get Yahoo Finance Key Statistics such as return on equity

I would like to get key statistics data for a given symbol in Yahoo! Finance.
I found a few ways to get statistics data using Yahoo Finance API.
For example, to get Appleā€™s name (n), ask (a), bid (b), market cap(j1),
http://finance.yahoo.com/d/quotes.csv?s=AAPL&f=nabj1
(e.g. http://www.jarloo.com/yahoo_finance/)
But I would like to extract more information such as return on equity and enterprise value.
How can I do this?
I cannot even fetch these values from web scraping either.
Key statistics can be accessed by calling the following API-Call:
https://query1.finance.yahoo.com/v10/finance/quoteSummary/AAPL?modules=defaultKeyStatistics
This includes enterprise value and book value.
I have not found a way to get return on equity directly from Yahoo Finance but it could be calculated from other values found in this answer.
Edit:
Return on equity can be found in the financial data:
https://query1.finance.yahoo.com/v10/finance/quoteSummary/AAPL?modules=financialData

Resources