Skip to content

Instantly share code, notes, and snippets.

@0x4f53
Created June 9, 2021 22:20
Show Gist options
  • Save 0x4f53/bd7fc6ed95e6abacafa55084867c44c3 to your computer and use it in GitHub Desktop.
Save 0x4f53/bd7fc6ed95e6abacafa55084867c44c3 to your computer and use it in GitHub Desktop.
Get company ticker symbol / code from name in Python
import requests
def getTicker (company_name):
url = "https://s.yimg.com/aq/autoc"
parameters = {'query': company_name, 'lang': 'en-US'}
response = requests.get(url = url, params = parameters)
data = response.json()
company_code = data['ResultSet']['Result'][0]['symbol']
return company_code
@alexdinisor98
Copy link

Unfortunately, it returns now 403 Client Error: Forbidden for this url.

@leftmove
Copy link

leftmove commented Jan 16, 2023

Created a new gist which will get this working again. Same code pretty much just using a different Yahoo finance endpoint.

(My username was changed from "bruhbruhroblox" to "leftmove")

@0x4f53
Copy link
Author

0x4f53 commented Jan 16, 2023

Awesome dude! I'll link it up there and credit you.

@gpetrone84
Copy link

It does not longer work to me unfortunately @bruhbruhroblox

@leftmove
Copy link

Hi everyone, it seems that changing my username caused my linked gist to stop working.
@0x4f53 If you can, please link the new gist with the new link.

https://gist.github.com/leftmove/dd9d981c8c37983f61e423a45085e063

I had to change my username as I created it when I was young. Sorry for the incoveinence!

@0x4f53
Copy link
Author

0x4f53 commented May 29, 2024

Done, we all do things we find silly as we grow up 🙃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment