Skip to content

Instantly share code, notes, and snippets.

@addisoneee
Created July 8, 2013 21:23
Show Gist options
  • Save addisoneee/5952622 to your computer and use it in GitHub Desktop.
Save addisoneee/5952622 to your computer and use it in GitHub Desktop.
import urllib2
#This program takes a single string parameter
#And will return the corresponding company name
def CUSIPLookup(cusipNum):
data = urllib2.urlopen('http://activequote.fidelity.com/mmnet/SymLookup.phtml?reqforlookup=REQUESTFORLOOKUP&productid=mmnet&isLoggedIn=mmnet&rows=50&for=bond&by=cusip&criteria='+str(cusipNum)+'&submit=Search')
data_string = data.read()
start = data_string.find("<tr><td height=\"20\" nowrap><font class=\"smallfont\">")
end = data_string[start:].find("</font>")
return data_string[start:][51:end]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment