Skip to main content

Posts

Showing posts with the label Python

Plot and Compare the Stock Price Trend

Introduction Nowadays, whoever is dealing with finance data, specifically with stock market needs very good understanding of data. Obviously, understanding of data completely depends on how the data is displayed or shown to someone. When we are putting money in the stock market, it is always advisable to first understand the pattern or behavior of the stock which you are going to buy or sell.  In this article, I'm neither going to cover the internals of finance nor am I going to discuss about what all parameters one needs to analyze or understand. The idea behind this article is, how one can use certain financial parameters to get the gist of market trend. Getting Started Let's consider a scenario, in which you would like to know, what is the opening price of Microsoft stock in the last few weeks. So that, by looking at the price, you can derive some conclusions. To perform this entire exercise, we need a few things: Stock symbol : In our case, it is MSFT. Prog

Extract Bitcoin Price In Realtime

This article talks about how we can read web pages and extract current Bitcoin prices. Now, to perform this web scrapping, we need a few things: Website Web scrapping libraries/tools  Programming language Website This is the website from which we are going to read the price of Bitcoin. There are many websites, from which you can read this data but for this article, I'm using  CoinmarketcapDOTcom. Web Scraping Libraries/Tools There are many web scraping libraries and tools available in the market. Below is the list of my recommendations: Beautiful Soup Scrapy Requests (HTTP for humans) LXML Selenium If you want to know the brief of any of these, you can watch out my YouTube channel named Shweta Lodha.  For this article, I'm using  Requests  along with  Beautiful Soup . Programing Language This article uses Python as a programming language import requests from bs4 import BeautifulSoup as bs URL = "https://coinmarketcap.com

Creating Virtual Environment for Python from VS Code

When we are talking about a term environment along with Python, it is a context in which our Python application runs, or we can say that the Python program runs.   An environment consists of an interpreter and all the installed packages, which clearly means that one can have multiple environments on a single machine, or rather I would say, every Python application can have its own environment. Now the question is, why do we need such environments?   To know more about the virtual environment and how to create one using Visual Studio Code, watch out my recorded video on my YouTube channel named Shweta Lodha.

Jupyter error - No module named ‘selenium’

Recently I installed Anaconda to learn more about it and the first thing I was about to try was opening a web page automatically using Selenium. So, to perform this, I used Jupyter and tried to import Selenium webdriver. Till here, everything went well, but when I ran my code using Jupyter Notebook, I got an error: ‘ No module named ‘selenium ’. The strange thing is, I got an error, although I have got Selenium installed on my machine using pip with below command:  pip install selenium. Now what could be the reason? So, to analyze it further, I wrote the same Python code in Visual Studio and ran it. It worked perfectly alright. So, I just thought to give a try to check the version of Selenium and first I tried with pip as shown below: As the above message says, it is already installed and didn’t complain anything. So, next I thought to try with Anaconda command prompt as shown below:  Did you notice that rectangl