development

주식 시세 기호 조회 API [종료]

big-blog 2020. 8. 31. 20:53
반응형

주식 시세 기호 조회 API [종료]


단순한 기호 조회 서비스 만 제공하는 API가 있습니까? 즉, 회사 이름을 입력하면 시세 기호가 표시됩니까? 화면 스크래핑 Google Finance를 시도했지만 잠시 후 속도가 제한되므로 보안 문자를 입력해야합니다. 약 2000 개의 티커 기호를 일괄 조회하려고합니다. 어떤 아이디어?


yahoo의 기호 조회를 다음과 같이 사용할 수 있습니다.

http://d.yimg.com/autoc.finance.yahoo.com/autoc?query=yahoo&callback=YAHOO.Finance.SymbolSuggest.ssCallback

여기서 query 는 회사 이름입니다.

그 대가로 다음과 같은 것을 얻을 수 있습니다.

YAHOO.Finance.SymbolSuggest.ssCallback(
{
    "ResultSet": {
        "Query": "ya",
        "Result": [
            {
                "symbol": "YHOO",
                "name": "Yahoo! Inc.",
                "exch": "NMS",
                "type": "S",
                "exchDisp": "NASDAQ"
            },
            {
                "symbol": "AUY",
                "name": "Yamana Gold, Inc.",
                "exch": "NYQ",
                "type": "S",
                "exchDisp": "NYSE"
            },
            {
                "symbol": "YZC",
                "name": "Yanzhou Coal Mining Co. Ltd.",
                "exch": "NYQ",
                "type": "S",
                "exchDisp": "NYSE"
            },
            {
                "symbol": "YRI.TO",
                "name": "YAMANA GOLD INC COM NPV",
                "exch": "TOR",
                "type": "S",
                "exchDisp": "Toronto"
            },
            {
                "symbol": "8046.TW",
                "name": "NAN YA PRINTED CIR TWD10",
                "exch": "TAI",
                "type": "S",
                "exchDisp": "Taiwan"
            },
            {
                "symbol": "600319.SS",
                "name": "WEIFANG YAXING CHE 'A'CNY1",
                "exch": "SHH",
                "type": "S",
                "exchDisp": "Shanghai"
            },
            {
                "symbol": "1991.HK",
                "name": "TA YANG GROUP",
                "exch": "HKG",
                "type": "S",
                "exchDisp": "Hong Kong"
            },
            {
                "symbol": "1303.TW",
                "name": "NAN YA PLASTIC TWD10",
                "exch": "TAI",
                "type": "S",
                "exchDisp": "Taiwan"
            },
            {
                "symbol": "0294.HK",
                "name": "YANGTZEKIANG",
                "exch": "HKG",
                "type": "S",
                "exchDisp": "Hong Kong"
            },
            {
                "symbol": "YAVY",
                "name": "Yadkin Valley Financial Corp.",
                "exch": "NMS",
                "type": "S",
                "exchDisp": "NASDAQ"
            }
        ]
    }
}
)

JSON이며 작업하기 매우 쉽습니다.

쉿 ... 아무에게도 말하지 마세요.


Google Finance에서는 다음 URL을 사용하여 한 번에 최대 100 개의 주가를 검색 할 수 있습니다.

www.google.com/finance/info?infotype=infoquoteall&q=[ticker1],[ticker2],...,[tickern]

For example:

www.google.com/finance/info?infotype=infoquoteall&q=C,JPM,AIG

Someone has deciphered the available fields here:

http://qsb-mac.googlecode.com/svn/trunk/Vermilion/Modules/StockQuoter/StockQuoter.py

The current price ("l") is real-time and the delay is on par with Yahoo Finance. There are a few quirks you should be aware of. A handful of stocks require an exchange prefix. For example, if you query "BTIM", you'll get a "Bad Request" error but "AMEX:BTIM" works. A few stocks don't work even with the exchange prefix. For example, querying "FTWRD" and "NASDAQ:FTWRD" both generate "Bad Request" errors even though Google Finance does have information for this NASDAQ stock.

The "el" field, if present, tells you the current pre-market or after-hours price.


You can send an HTTP request to http://finance.yahoo.com requesting symbols, names, quotes, and all sorts of other data. Data is returned as a .CSV so you can request multiple symbols in one query.

So if you send:

http://finance.yahoo.com/d/quotes.csv?s=MSFT+F+ATT&f=sn

You'll get back something like:

"MSFT","Microsoft Corp"
"F","FORD MOTOR CO"
"ATT","AT&T"

Here is an article called Downloading Yahoo Data which includes the various tags used to request the data.


The NASDAQ site hosts separate CSV lists for ticker symbols in each stock exchange (NYSE, AMEX and NASDAQ). You need to complete the captcha and get the CSV dump.

http://www.nasdaq.com/screening/company-list.aspx


If you didn't want to sign up for a service, I'd probably go back to the exchanges themselves; most of them aren't CAPTCHAed yet...

The symbol lookup page for:

etc...


Use YQL and you don't need to worry. It's a query language by Yahoo and you can get all the stock data including the name of the company for the ticker. It's a REST API and it returns the results via XML or JSON. I have a full tutorial and source code on my site take a look: http://www.jarloo.com/yahoo-stock-symbol-lookup/


Currently, the NASDAQ web site publicly provides CSV files containing bulk listings -- it is broken up by first letter.

http://www.nasdaq.com/screening/companies-by-name.aspx?letter=A&render=download


Google Finance has an API - you probably have to apply for a developers key, but at least you'd save yourself the hassle of screen-scraping: http://code.google.com/apis/finance/reference.html


Your best bets are probably going with one of the other lookup services (still screen-scraping), and checking whether they don't require CAPTCHAs.

The last appears the least likely to require a CAPTCHA at any point, but it's worth checking all three.


Use YQL: a sql-like language to retrieve stuff from public api's: YQL Console (external link)

It gives you a nice XML file to work with!


You can use the "Company Search" operation in the Company Fundamentals API here: http://www.mergent.com/servius/

참고URL : https://stackoverflow.com/questions/885456/stock-ticker-symbol-lookup-api

반응형