Python Programming Tutorial – How to Make a Stock Screener

This video teaches you how to create a stock screener based on any indicator you have built in Python. Don’t know how to build indicators in Python? No problem! I have tons of videos just for you:

S&P 500 company list:


Rob B says:

Great video! The link for S&P500 companies doesn’t seem to be working though 🙁


Hi , where can I get the sample codes for the tutorial? I am unable to find the link. Thanks

g jr. says:

just kidding still that was a goodvideo

Johnny Scott says:

Where can I obtain a copy of the code? The link in the description goes to a page with no scripts on it.

Luke Treloar says:

Appreciative watcher of many of your videos.  In this instance, the outcome of our stock screener is painfully linear.  Suggest going a video showing how to split the task across an MPI.   Merging our Raspberry Pi supercomputer and stock picker could be fun.  Keep them coming!  

JFTrading says:

wheres the list dude?!

Stephen Verheul says:

For everybody having trouble parsing the Yahoo data because of the changed website. There is also a Yahoo module in Python. You can find all the information about it here: This will make life much more easy.

Sahib Singh says:

where do i get the s and p 500 list from ?

Terrence Mathews says:

Thank you.

James Parrish says:

Do you know how to make trades based on certain parameters? If I am focusing on just one stock, I want to be able to have an algorithm that buys and sells instantly along say the 200 day MA. Please let me know if you can help!

dirte212 says:

Can you build a stock screener that incorporates price volatility or a price range over a period of time (say 1 month+)? I would like it to be able to identify stocks that have been moving pretty much sideways for a period of time.

Shem Am says:

the link for the s&p 500 list still doesn’t work (big fan btw!)

Michael Cerasoli says:

thank you im applying for a job with financial unix background currently using perl and java these tutorials are so helpful been programming for 25 years love the fresh perspective! 🙂 thank you again

Clover says:

have you ever tried mathematica for picking stock?Wolfram financial database is awesome.

Ian Finn says:

code dude….

Jason Smith says:

hi, when i run the python codes, there is this error
“from import candlestick
ImportError:cannot import name candlestick”
How do i solve this?
thanks in advance!

Lorenzo Moreno Muñoz says:

“S&P 500 company list” link is dead (404).

Troy Van der says:

Can you do a video of using python to make Algos for dummies?

shoeb khan says:

Very good code thanks
Will customize it and use for my own
Share some more python code for market analysis in future

Salman Saeed says:

No list

Francis Lambert says:

Just when I thought I have everything, I find this site that shows me how to make a stock screener…I write Python, and so, now I am going to create what I do not have, but, that I do need. Thank you for this tutorial.. Peace 🙂

Combusca Pirate Traders says:

nice video!! Thanks for sharing!

Kayson Chan says:

Hi Sentdex. thanks for sharing. Is there any code that can screen for stock that have its RSI breakout above 50 for the first time in 1 year or so? ty

Varunkumar Pothula says:

Here u go guys…
the list he used in the program

sp500 = [‘a’, ‘aa’, ‘aapl’, ‘abbv’, ‘abc’, ‘abt’, ‘ace’, ‘aci’, ‘acn’, ‘act’, ‘adbe’, ‘adi’, ‘adm’, ‘adp’, ‘adsk’, ‘adt’, ‘aee’, ‘aeo’, ‘aep’, ‘aes’, ‘aet’, ‘afl’, ‘agn’, ‘aig’, ‘aiv’, ‘aiz’, ‘akam’, ‘all’, ‘altr’, ‘alxn’, ‘amat’, ‘amd’, ‘amgn’, ‘amp’, ‘amt’, ‘amzn’, ‘an’, ‘anf’, ‘ann’, ‘aon’, ‘apa’, ‘apc’, ‘apd’, ‘aph’, ‘apol’, ‘arg’, ‘arna’, ‘aro’, ‘ati’, ‘atvi’, ‘avb’, ‘avp’, ‘avy’, ‘axp’, ‘azo’, ‘ba’, ‘bac’, ‘bax’, ‘bbby’, ‘bbry’, ‘bbt’, ‘bby’, ‘bcr’, ‘bdx’, ‘beam’, ‘ben’, ‘bf-b’, ‘bhi’, ‘big’, ‘biib’, ‘bk’, ‘bks’, ‘blk’, ‘bll’, ‘bmc’, ‘bms’, ‘bmy’, ‘brcm’, ‘brk-b’, ‘bsx’, ‘btu’, ‘bwa’, ‘bxp’, ‘c’, ‘ca’, ‘cab’, ‘cag’, ‘cah’, ‘cam’, ‘cat’, ‘cb’, ‘cbg’, ‘cbs’, ‘cce’, ‘cci’, ‘ccl’, ‘celg’, ‘cern’, ‘cf’, ‘cfn’, ‘chk’, ‘chrw’, ‘ci’, ‘cim’, ‘cinf’, ‘cl’, ‘clf’, ‘clx’, ‘cma’, ‘cmcsa’, ‘cme’, ‘cmg’, ‘cmi’, ‘cms’, ‘cnp’, ‘cnx’, ‘cof’, ‘cog’, ‘coh’, ‘col’, ‘cop’, ‘cost’, ‘cov’, ‘cpb’, ‘crm’, ‘csc’, ‘csco’, ‘csx’, ‘ctas’, ‘ctl’, ‘ctsh’, ‘ctxs’, ‘cvc’, ‘cvs’, ‘cvx’, ‘d’, ‘dal’, ‘dd’, ‘dds’, ‘de’, ‘dell’, ‘df’, ‘dfs’, ‘dg’, ‘dgx’, ‘dhi’, ‘dhr’, ‘dis’, ‘disca’, ‘dks’, ‘dlph’, ‘dltr’, ‘dlx’, ‘dnb’, ‘dnr’, ‘do’, ‘dov’, ‘dow’, ‘dps’, ‘dri’, ‘dsw’, ‘dte’, ‘dtv’, ‘duk’, ‘dva’, ‘dvn’, ‘ea’, ‘ebay’, ‘ecl’, ‘ed’, ‘efx’, ‘eix’, ‘el’, ’emc’, ’emn’, ’emr’, ‘eog’, ‘eqr’, ‘eqt’, ‘esrx’, ‘esv’, ‘etfc’, ‘etn’, ‘etr’, ‘ew’, ‘exc’, ‘expd’, ‘expe’, ‘expr’, ‘f’, ‘fast’, ‘fb’, ‘fcx’, ‘fdo’, ‘fdx’, ‘fe’, ‘ffiv’, ‘fhn’, ‘fis’, ‘fisv’, ‘fitb’, ‘fl’, ‘flir’, ‘flr’, ‘fls’, ‘flws’, ‘fmc’, ‘fosl’, ‘frx’, ‘fslr’, ‘fti’, ‘ftr’, ‘gas’, ‘gci’, ‘gd’, ‘ge’, ‘ges’, ‘gild’, ‘gis’, ‘glw’, ‘gm’, ‘gmcr’, ‘gme’, ‘gnw’, ‘goog’, ‘gpc’, ‘gps’, ‘grmn’, ‘grpn’, ‘gs’, ‘gt’, ‘gww’, ‘hal’, ‘har’, ‘has’, ‘hban’, ‘hcbk’, ‘hcn’, ‘hcp’, ‘hd’, ‘hes’, ‘hig’, ‘hog’, ‘hon’, ‘hot’, ‘hov’, ‘hp’, ‘hpq’, ‘hrb’, ‘hrl’, ‘hrs’, ‘hsp’, ‘hst’, ‘hsy’, ‘hum’, ‘ibm’, ‘ice’, ‘iff’, ‘igt’, ‘intc’, ‘intu’, ‘ip’, ‘ipg’, ‘ir’, ‘irm’, ‘isrg’, ‘itw’, ‘ivz’, ‘jbl’, ‘jci’, ‘jcp’, ‘jdsu’, ‘jec’, ‘jnj’, ‘jnpr’, ‘josb’, ‘joy’, ‘jpm’, ‘jwn’, ‘k’, ‘key’, ‘kim’, ‘klac’, ‘kmb’, ‘kmi’, ‘kmx’, ‘ko’, ‘kr’, ‘krft’, ‘kss’, ‘ksu’, ‘l’, ‘leg’, ‘len’, ‘lh’, ‘life’, ‘lll’, ‘lltc’, ‘lly’, ‘lm’, ‘lmt’, ‘lnc’, ‘lo’, ‘low’, ‘lrcx’, ‘lsi’, ‘ltd’, ‘luk’, ‘luv’, ‘lyb’, ‘m’, ‘ma’, ‘mac’, ‘mar’, ‘mas’, ‘mat’, ‘mcd’, ‘mchp’, ‘mck’, ‘mco’, ‘mcp’, ‘mdlz’, ‘mdt’, ‘met’, ‘mgm’, ‘mhfi’, ‘mjn’, ‘mkc’, ‘mmc’, ‘mmm’, ‘mnst’, ‘mo’, ‘molx’, ‘mon’, ‘mos’, ‘mpc’, ‘mrk’, ‘mro’, ‘ms’, ‘msft’, ‘msi’, ‘mtb’, ‘mu’, ‘mur’, ‘mwv’, ‘myl’, ‘nbl’, ‘nbr’, ‘ndaq’, ‘ne’, ‘nee’, ‘nem’, ‘nflx’, ‘nfx’, ‘ni’, ‘nile’, ‘nke’, ‘nly’, ‘noc’, ‘nok’, ‘nov’, ‘nrg’, ‘nsc’, ‘ntap’, ‘ntri’, ‘ntrs’, ‘nu’, ‘nue’, ‘nvda’, ‘nwl’, ‘nwsa’, ‘nyx’, ‘oi’, ‘oke’, ‘omc’, ‘orcl’, ‘orly’, ‘oxy’, ‘p’, ‘payx’, ‘pbct’, ‘pbi’, ‘pcar’, ‘pcg’, ‘pcl’, ‘pcln’, ‘pcp’, ‘pdco’, ‘peg’, ‘pep’, ‘petm’, ‘pets’, ‘pfe’, ‘pfg’, ‘pg’, ‘pgr’, ‘ph’, ‘phm’, ‘pki’, ‘pld’, ‘pll’, ‘pm’, ‘pnc’, ‘pnr’, ‘pnw’, ‘pom’, ‘ppg’, ‘ppl’, ‘prgo’, ‘pru’, ‘psa’, ‘psx’, ‘pwr’, ‘px’, ‘pxd’, ‘qcom’, ‘qep’, ‘r’, ‘rai’, ‘rdc’, ‘rf’, ‘rhi’, ‘rht’, ‘rl’, ‘rok’, ‘rop’, ‘rost’, ‘rrc’, ‘rsg’, ‘rsh’, ‘rtn’, ‘s’, ‘sai’, ‘sbux’, ‘scg’, ‘schl’, ‘schw’, ‘sd’, ‘se’, ‘see’, ‘sfly’, ‘shld’, ‘shw’, ‘sial’, ‘siri’, ‘sjm’, ‘sks’, ‘slb’, ‘slm’, ‘sna’, ‘sndk’, ‘sne’, ‘sni’, ‘so’, ‘spg’, ‘spls’, ‘srcl’, ‘sre’, ‘sti’, ‘stj’, ‘stt’, ‘stx’, ‘stz’, ‘swk’, ‘swn’, ‘swy’, ‘syk’, ‘symc’, ‘syy’, ‘t’, ‘tap’, ‘tdc’, ‘te’, ‘teg’, ‘tel’, ‘ter’, ‘tgt’, ‘thc’, ‘tibx’, ‘tif’, ‘tjx’, ‘tm’, ‘tmk’, ‘tmo’, ‘trip’, ‘trow’, ‘trv’, ‘tsla’, ‘tsn’, ‘tso’, ‘tss’, ‘twc’, ‘twx’, ‘txn’, ‘txt’, ‘tyc’, ‘ua’, ‘unh’, ‘unm’, ‘unp’, ‘ups’, ‘urbn’, ‘usb’, ‘utx’, ‘v’, ‘vale’, ‘var’, ‘vfc’, ‘viab’, ‘vitc’, ‘vlo’, ‘vmc’, ‘vno’, ‘vprt’, ‘vrsn’, ‘vtr’, ‘vz’, ‘wag’, ‘wat’, ‘wdc’, ‘wec’, ‘wfc’, ‘wfm’, ‘whr’, ‘win’, ‘wlp’, ‘wm’, ‘wmb’, ‘wmt’, ‘wpo’, ‘wpx’, ‘wtw’, ‘wu’, ‘wy’, ‘wyn’, ‘wynn’, ‘x’, ‘xel’, ‘xl’, ‘xlnx’, ‘xom’, ‘xray’, ‘xrx’, ‘xyl’, ‘yhoo’, ‘yum’, ‘zion’, ‘zlc’, ‘zmh’, ‘znga’, ‘camp’, ‘cldx’, ‘ecyt’, ‘gtn’, ‘htz’, ‘nus’, ‘pvtb’, ‘qdel’, ‘snts’, ‘wgo’, ‘wwww’]
sp500short = [‘a’, ‘aa’, ‘aapl’, ‘abbv’, ‘abc’, ‘abt’, ‘ace’, ‘aci’, ‘acn’, ‘act’, ‘adbe’, ‘adi’, ‘adm’, ‘adp’]

Yoga Scientist says:

will like to see more of programming in stock market. nice video, information, thanks.

환희 K says:

GGGGGGreat Man!!

Rick Johnson says:

This is what I’m getting when I run it on Python 2.7:

Warning (from warnings module):
  File “”, line 136
    warnings.warn(message, mplDeprecation, stacklevel=1)
MatplotlibDeprecationWarning: The finance module has been deprecated in mpl 2.0 and will be removed in mpl 2.2. Please use the module mpl_finance instead.Traceback (most recent call last):
  File “C:/Python27/”, line 9, in
    from import candlestick
ImportError: cannot import name candlestick

I do not know how to fix it.

Sagar Rane says:

+sentdex i went to the given link . copy paste the code. but not able to install the numpy module. tried to install it gives error tried to find the error in the stack overflow website not able to find the solution how should i proceed? Please help

Zharfan Dhaifullah says:

i have problem like this :
Traceback (most recent call last):
File “C:Python27Stock”, line 9, in
from import candlestick
ImportError: cannot import name candlestick

can you help me ?

Deo Moore says:

I’m having trouble getting the S&P company list. When I click on the link, it just takes me to a page that says “Unfortunately, we were unable to find that page for you (404).” Could you help me with this?

32saorise32 says:

Thank you for your awesome vids! Mad propz.

Mirko Sabljic says:

Really great tutorial, please do keep em coming!

One question, would it be possible to somehow automate the process getting the list of the S&P 500 stocks and have it always updated in order to avoid getting it manually and risking it’s outdated? Perhaps scrape it from some website or something?

Max Digilov says:

Hey man! Great teaching material! Out of curiosity, do you use any of your algos to for live trading?

 Write a comment


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!