Share your repls and programming experiences

← Back to all posts
Stock Market Visualizer
Roar123 (447)

Stock Market Visualizer

Hi everyone, I'm proud to present Stock Market Visualizer, the best way to view stock/ETF statistics from the comfort of the Python terminal. Search by ticker with live dropdown results and view detailed graphs with information. This was a very cool project to make as it combined my interests in stocks/investing and programming. It was also pretty mathematically challenging to create the graphs.

Note: The YFinance library has large dependencies like pandas so use the terminal which is next to the code editor (40s package installation), not the full page view (1 min 10s package installation).

How to use

Let's say you want to see statistics for an Apple share. Start by typing apple. Then use the dropdown results to figure out the stock ticker - in this case AAPL. After typing the ticker, a graph will pop up with information below. Here's an explanation to help you better understand the information:

  • Ticker: Unique series of letters assigned to security for trading purposes
  • Name: Name of company or security
  • Sector: Sections of an industry or the overall economy
  • Market Cap: Total value of all shares
  • Regular Market Volume: Total number of security traded over a period of time (usually one day)
  • 200 Day Average: Average share price over 200 days
  • 50 Day Average: Average share price over 50 days
  • P/E Ratio: Price to Earning - Share price to earnings per share
  • Trailing P/E: P/E based off last 12 months
  • Forward P/E: P/E based off of projected 12 months

Future Ideas:

  • Allow users to pick their chart view
  • Include other securities/financial instruments like crypto and mutual funds

Planned Improvements:

  • Candlestick view option for graph [completed here but still in beta]
  • More stock metrics

Completed Improvements:

  • Graph x-axis now shows start and end dates

Stock Market Visualizer:
Stock Market Data:
Stock Market Development (see new features before they're added):

Thanks for checking this out!
Also if you have any suggestions for stock metrics to include, tell me in the comments!

SixBeeps (5036)

I'm impressed with how well done this is! One of the best Repls I've seen in a while.

HahaYes (1913)

This is awesome. I studied the stock market this year, and this is literally exactly what we had to do.

Scoder12 (838)

Awesome! One suggestion, instead of this:

    si.insert(1, f"Name: {stock_info['shortName']}")
    si.insert(1, f"Name: {ticker_data[ticker.upper()]}")

you could do this:

name = stock_info.get('shortName', ticker_data[ticker.upper()])
si.insert(1, f"Name: {name}")

similarly for all of the try/except statements.

Roar123 (447)

@Scoder12 Thanks, this is really helpful!

AtticusKuhn (241)

Graphing in the terminal is quite cool.

SavoRodrigues (0)

wow! mate this is some awesome stuff. Keep it up.

Gaganjit1234 (1)

Astonishing work, haven't seen anything like this until now.

HahaYes (1913)

Whoa... this is way too good

SuperSonicHub1 (0)

Hey man, I want to make use of some of your code, specifically your search function in an API wrapper I'm making! Are you cool with that?

Roar123 (447)

@SuperSonicHub1 Sure but just remember to cite Roar123 as the original author.

Roar123 (447)

@adamseider2009 Yep it's real up to date info about stocks and etfs.

MichaelHampton2 (0)

this is so awesome bro im really impressed well done!! :)

Lucasl009 (0)

@Roar123 you should make links to articles about the stock. If you can.

Lucasl009 (0)

Bro this is awesome


Pretty cool! I haven't seen anything like far...

SabyaThakur (0)


The6thGrade6th (0)

This is amazing! How did you do the searching?

DynamicSquid (4618)


no seriously this is dope

coderash (286)

This is awesome dude!

SahilShah8 (0)

Great program! I hope you can add more and more beneficial features to this! I personally found this initial code to be very supportive!

HahaYes (1913)

This deserves so many more likes

Cookiezz (65)

Very unique and cool.

zplusfour (887)

I am interested with visualizers, need to help me make one with javascript or node.js?

Roar123 (447)

@ZDev1 It should be a lot easier to make a graph in JS - for Python I had to construct the graph in a 2d array. If you want to check out some JS libraries, go here.

firefish (985)

At the search again prompt, I type y, and it briefly goes to search by ticker, and then to no stocks found. Is this a problem? @Roar123

Roar123 (447)

@johnstev111 Interesting, when you press anything but "n", it should take you to "Search by ticker". I think what's happening is that you're also pressing enter after the "y" which causes the program to search. Since I used readchar.readkey() instead of input(), you don't have to press enter after typing the "y".

firefish (985)

@Roar123 Ouch. I don't even realise I'm hitting enter, probably just a natural habit of using linux a lot

firefish (985)

@Roar123 Which is probably also why shedloads of other programs don't work