How to Get Stock Prices in Real Time, Using Python (2021)

In under 10 lines of code you will be able to get the price of any stock in Python

Zita
Analytics Vidhya

--

Photo from Unsplash by Sigmund

It’s 2021 and the stock craze is the biggest it’s ever been. Ever day huge companies are hitting all-time highs which leads the public to buying more stocks in an attempt to cash in.

Of those in the public, the majority are headline chasers. They see that X company stock increases by Y% and they immediately invest.

The minority take the time to review the company and make models to have a better understanding where the price of the stock is going.

I’m apart of this minority and getting prices of stocks in real time for my models, has increased my portfolio greatly.

My goal is to increase this minority so I’m going to share with you how to get stock prices in real time in under 10 lines of code in Python.

BeautifulSoup

I know it’s a weird name but Beautiful Soup is a very powerful library in Python. This library will enable you to access a website and get real time data from said website. But for you to use it you first have to install it.

To install Beautiful Soup on your computer go to your Anaconda Prompt (just search up in…

--

--

Zita
Analytics Vidhya

Teaching Creators How to Automate Their Content Creation Using AI