Skip to content
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

New source for ticker data needed #42

Closed
cjc343 opened this issue Nov 2, 2017 · 11 comments
Closed

New source for ticker data needed #42

cjc343 opened this issue Nov 2, 2017 · 11 comments

Comments

@cjc343
Copy link
Contributor

cjc343 commented Nov 2, 2017

http://download.finance.yahoo.com/d/quotes.csv?s=%s&f=sl1c1p2oghjkva2r2rdyj3j1 is no longer serving quote data. The following message is displayed:

It has come to our attention that this service is being used in violation of the Yahoo Terms of Service. As such, the service is being discontinued. For all future markets and equities data research, please refer to finance.yahoo.com.

In short, a new source for ticker data is needed to replace yahoo. There will likely be additional changes required to support any new data source.

@alexaisok
Copy link

alexaisok commented Nov 7, 2017

Alpha Vantage looks promising. It offers a proper API instead of the common web scraping options.

@arvin-foroutan
Copy link

Here's another Yahoo source that still works but in a different format:

Single quote: https://query1.finance.yahoo.com/v7/finance/quote?symbols=AAPL
Multiple quotes: https://query1.finance.yahoo.com/v7/finance/quote?symbols=AAPL,NFLX

Both return json and I can't seem to get them to return csv via query parameters. Let us know if you guys have better luck.

@arinbjornk
Copy link

There exists a python library for downloading quotes in the new format c0redumb/yahoo_quote_download

Not sure if it actually returns CSV but it says:

The CSV file downloaded through the new API has a few data and format differences from the CSV file from the original iChart source. If you plan to use the downloaded data with code that used to process the data from old API, please check your code to make sure that these differences are taken care of.

@hp4k1h5
Copy link

hp4k1h5 commented Nov 15, 2017

there is also the google api:
npm has a package which might simplify the process of moving this over
https://www.npmjs.com/package/google-finance

@metiscus
Copy link

metiscus commented Feb 8, 2018

I've written some code in c++ that can get and parse the google api and retrieve almost all of the data needed here. I don't really know Go but in case someone who does has the time and inclination, you can find the code https://github.com/metiscus/cquote/blob/master/main.cpp

The general idea is as follows:
Do an HTTP GET for
std::string query = "https://finance.google.com/finance?q=";
query += stock.ticker;
query += "&output=json";

Chop off the first 5 characters of the returned string as well as the last character to make it valid JSON. Then all you need to do is to remap the json keys.
stock.is_valid = true;
stock.name = d["name"].GetString();
stock.exchange = d["exchange"].GetString();
stock.last = parse_float(d["l"].GetString());
stock.change = parse_float(d["c"].GetString());
stock.change_pct = parse_float(d["cp"].GetString());
stock.open = parse_float(d["op"].GetString());
stock.high = parse_float(d["hi"].GetString());
stock.low = parse_float(d["lo"].GetString());
stock.stat_52_low = parse_float(d["hi52"].GetString());
stock.stat_52_high = parse_float(d["lo52"].GetString());
stock.stat_eps = parse_float(d["eps"].GetString());
stock.stat_pe = parse_float(d["pe"].GetString());
stock.stat_dividend = parse_float(d["ldiv"].GetString());
stock.stat_yield = parse_float(d["dy"].GetString());
stock.stat_shares = d["shares"].GetString();
stock.stat_volume = d["vo"].GetString();
stock.stat_avg_volume = d["avvo"].GetString();

@NewbieReader
Copy link

Capture12

Guys sorry for being a totally noob. Im getting the same comment as this guys post.
Error fetching stock quotes. Can you please give me the noob explanation why I cant get the quotes?
I have read that its has something to do with yahoo finance that now its giving its data availability. So how can I fix it? Please explain it in a matter that a total noob like me could understand please.

Anyway, I found that the upper codes of my cnn.market.go works just fine coz as I browse the context of the code where such values were found I have data for the STOCKS like:

market.Dow[change] = matches[1]
market.Dow[latest] = matches[2]
market.Dow[percent] = matches[3]
market.Nasdaq[change] = matches[4]
market.Nasdaq[latest] = matches[5]
market.Nasdaq[percent] = matches[6]
market.Sp500[change] = matches[7]
market.Sp500[latest] = matches[8]
market.Sp500[percent] = matches[9]

I read that the Error in quotes has something to do with the market.regex, im not sure if im quite following this right but as my analysis to the script, this seems where I am getting the error can add new stock in the main.go program. Anyway im running this at termux. I found out that theres a script that runs stocks in Linux so I search and ended up in this Mob in GitHub. Im totally a noob so please do help me guys! thanks my Seniors :). Im just running around this thread about Mob but I cant really get what im missing so I decided to ask for help. Says this Issue #42 has the answer but I cant really get to understand how to change my ticker from yahoo-finance to something that works. Hope you understand Thanks

@brandleesee
Copy link
Collaborator

Leave this here as this is part of the research:
https://blog.api.rakuten.net/api-tutorial-yahoo-finance/

@laoshaw
Copy link

laoshaw commented Aug 19, 2019

RxJSInAction/rxjs-in-action#13

"Ran into the same issue. Found that this Yahoo API call will work, https://query1.finance.yahoo.com/v7/finance/quote?lang=en-US&region=US&corsDomain=finance.yahoo.com&symbols=FB&fields=regularMarketPrice but it returns JSON not csv."

@brandleesee
Copy link
Collaborator

Should be fixed as per e619620 a4b86c4 f1908ce brandleesee@34a3485 brandleesee@308a29d.
Feedback appreciated.
If successful will close.

@ghost
Copy link

ghost commented Nov 1, 2019

Works for me!

@brandleesee
Copy link
Collaborator

Great, noted!
Closing then :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants