1

I have a company name and i want to get the stock symbol of that company and all the information related to it. I have tried using yahoo call back Stock ticker symbol lookup API but for some reason it returns a http 400 bad request. Could someone please tell me how i would go about getting the symbol for that stock so that i can query yahoo and get all the data. Also is it possible to just use this company name to get all the stock related data.

request i sent-"http://d.yimg.com/autoc.finance.yahoo.com/autoc?"+symbol+"=yahoo&callback=YAHOO.Finance.SymbolSuggest.ssCallback" where symbol=Thomas Scott

Community
  • 1
  • 1
user1092042
  • 1,297
  • 5
  • 24
  • 44
  • 1
    What was the HTTP request you sent? – biziclop Mar 27 '12 at 15:03
  • Have added the request to the question.Please take a look at it. – user1092042 Mar 28 '12 at 02:43
  • 2
    Have you tried one-word company names (e.g. Google)? Make sure to convert spaces to `%20` in your company names. Spaces will mess up the query string parameters. – Bernard Mar 28 '12 at 02:55
  • Where do i read up more on what symbols yahoo cannot recognize.For example i have observed that & does not work in yahoo. – user1092042 Mar 28 '12 at 03:35
  • 1
    @user1092042 It's not Yahoo not recognising those symbols, space is simply an invalid character in URLs. If you're using Java, calling [`URLEncoder`](http://docs.oracle.com/javase/6/docs/api/java/net/URLEncoder.html) for every string you concatenate to your URL takes care of these problems. In the javadoc you can also read up on the exact rules of what is and what isn't allowed. – biziclop Mar 28 '12 at 12:32

1 Answers1

3

Your query is malformed. Try:

http://d.yimg.com/autoc.finance.yahoo.com/autoc?query=Thomas%20Scott&callback=YAHOO.Finance.SymbolSuggest.ssCallback
GreyBeardedGeek
  • 29,460
  • 2
  • 47
  • 67