Created
June 9, 2021 22:20
-
-
Save 0x4f53/bd7fc6ed95e6abacafa55084867c44c3 to your computer and use it in GitHub Desktop.
Get company ticker symbol / code from name in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Done, we all do things we find silly as we grow up 🙃