Automate browsing for stock values with Python

Lets automate browsing for stock values from yahoo finance

Requirements: Python, urllib2 library,

1)The Yahoo finance stock value of apple


2) URL, hints that searching various stock values in yahoo finance website can be automated.

URL of apple stock:
URL of google stock:

Therefore url search can be automated by changing code (AAPL, GOOGL) to a string that has list of company code.

3) Now in web-designing, each value or each text displayed in website has an unique id and code. If that can be fished out, and given to python to fish out stock value with respect to URL, automation of searching website and getting list of various company stock values is possible.


4) Armed with unique id of stock value, and unique URL id, lets write a program that give list of stock values. Get company list from NASDAQ website


and save only the company codes in the downloaded excel file, to a text file and move it to working directory.


5) Back-end work is done, and only coding is left

Here is the code


We wrote a code for generating list of first 5o companies stock values,

Like wise, to get list of all companies change

code as


while i <len(newstocklist)

6)  list of 5o companies stock values



Like wise, Google stock, weather list, can be automated.





Mtech in Clinical Eng Jointly offered by Indian institute of technology Madras& Christian medical college Vellore& Sree chitra tirunal institute for medical sciences and technology Trivandrum.
This entry was posted in Programming and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s