Skip to main content


Showing posts from March, 2022

Keep Your Screen Active Forever Using Python

If your boss is very workaholic and you are not working from office then you must have heard one of these statements from your boss: Why were you not at your desk  Why your status was away in Teams/Skype/etc I couldn't see you really putting 8 hours at work, blah blah blah. source: And all these statements are coming because your machine was inactive and that change your communicator status to Away . Well, so today we are going to solve this problem where in we will not let our communicator status change by its own. How can we do that? Answer is very simple. This problem can be solved, if our machine is active, if we are continuously (or in few mins) pressing some keys or moving our mouse.  Here we will use Python to write just few lines of code to perform this magic.  Python package We will use Python package named pyautogui as it allows us to automate mouse and keyboard interactions. It works very well on Windows, Mac as well as Linux. You can install this pa

Create Candlestick Charts For Stocks Using Yahoo Finance

In this article, we will see how to create candlestick chart with historical data for any given symbol using open financial API named Yahoo Finance and Python. We will start by pushing data in a CSV file and then we will use Plotly to create the candlestick chart in Python. Introduction to candlestick chart This is one of the heavily used charts you may have seen multiple times while dealing with stock market dashboards. This is very much used by traders as it provides price movement based on the past patterns. One candle represents 4 points: Open, Close, High, Low as shown below:  In above figure, first candle is filled which depicts that open price was higher than close price. Similarly, second candle depicts that close price was higher than open price. Here do not focus on the color of candle as it can be configured based on your favorite color, based on the dashboard you are using.  In general,  bullish candlestick (close price > open price) is represented by green color and bea

Top 5 Visual Studio Code Extensions for Azure

In my one of the recent posts, I mentioned about top five Visual Studio Code extensions and after that I received lot many feedbacks asking my top recommendation on Azure specific extensions. Hence, this article is here. When it comes to Azure, there are lot many extensions you can find. Here is the gist of that: Above list is not limited to what I've shown above, there is much more than this. Let's quickly jump on to my top five favorite extensions specific to Azure: Azure Tools This is my most favorite one as it handles lot many things. It includes long list of extensions which are very much useful to interact with Azure. It allows you to host your web sites, it allows very seamless interaction between MongoDB and Cosmos DB in terms of creating databases and writing scripts, you can manager your virtual machines, view all your Azure resource groups, you can deal with docker images and many more.  Here is the list extensions included in it: Docker Azure Functions Azure Resourc

Implementing Dependency Injection In Azure Functions

This article talks about how we can use dependency injection in Azure Functions. Dependency injection is a very well known design pattern that is used to implement IoC as provides you a facility to segregate object creation logic from its usage.  Prerequisites And Tools Used In order to implement dependency injection in Azure Function App, you need an active Azure subscription, Visual Studio (I’m using Visual Studio 2019), and working knowledge of the C# language.  Create Function App in Visual Studio The first step is to create a new project in Visual Studio of type Azure Functions: and select Http Trigger as shown below:  Add Classes For Dependency Injection Next, we need to add the service (classes) which we want to inject. For simplicity, we will create an interface and a class implementing that interface. This interface will have only one method named GetCurrentTime() and it will provide current time to the caller. Here are the definitions: public interface ICurrentTimeProvider {

Stock Risk Analysis App in Python

In this article, I’ll explain about how we can perform risk analysis for certain publicly listed stocks. To perform this, we will look at the data of certain time frames and will try to analyze which stock is riskier than the other one based on the price deviation and the average price. Throughout this exercise, I’ll be using Python as a programming language. Required Packages Here is the list of packages we need to be installed before proceeding: pandas numpy yfinance matplotlib Once packages are installed, we are good to go. Importing Libraries import pandas as pd import numpy as np import yfinance as yf import matplotlib . pyplot as pyplot Select Stocks and Duration Next, we need to select the list of stocks we want to analyze and the duration. Here, I’m going with Microsoft and Tesla stocks, and the duration I’m selecting is from 2018–01–01 to 2022–02–01. stocks = yf . download ( [ ‘MSFT’ , ’TSLA’ ] , start = ” 2018 – 01 – 01 ", end=”2022–02–01&quo