Sign in

Data Analyst | Hacker | Financial Analyst | Freelancer | IIM MBA | Opensource | Democratize Knowledge |

A walk-through of how to plot option payoff diagrams using opstrat package in python

An option is a derivative, a contract that gives the buyer the right, but not the obligation, to buy or sell the underlying asset by a certain date (expiration date) at a specified price (strike price).

There are two types of options: calls and puts. Traders can construct option strategies ranging from buying or selling a single option to very complex ones that involve multiple simultaneous option positions.

Option payoff diagrams are profit and loss charts that show the risk/reward profile of an option or combination of options. …

How to obtain stock market data and create visualizations(candlestick, OHLC, PnF etc.) in Python using mplfinance library

Mplfinance is a dedicated data visulization package from matlplotlib for visualizing financial data.
Mplfinance enable visualization of financial data in the form of different types of charts- Candlestick chart, Renko Chart, OHLC chart, Point and Figure chart etc. with very few lines of code.
Mplfinance also facilitates superimposing moving averages on top of charts for decision making by technical analysts.

Getting the data

Typical market data includes OHLCV(Open High Low Close Volume) data. The data can be obtained by using the sites of stock exchanges, financial publications, APIs, web-scrapping etc.

Mplfinace package can be used to plot any dataframe provided the following conditions…

A data driven approach to identify the best replacement for the injured Liverpool Center Back Virgil Van Dijk


In this article, we scout for the best alternative for the injured Reds defender Virgil Van Dijk.
The steps involved in the process is as follows:
Data Collection:
All relevant player stats are collected from
KPI Generation:
Key Performance indicators are created for evaluation of players
Data Wrangling:
Data cleansing and feature engineering are performed
Finding the Players most Similar to VVD:
Players with KPIs similar to VVD can be found using proximity measures
Commenting on the findings of the excercise


Virgil van Dijk is arguably the most important player for the Reds. Since his arrival at Anfield…

This is a step by step tutorial on how to automate gmail using Yagmail package in python

The Simple Mail Transfer Protocol (SMTP) is an internet standard communication protocol used for sending email.
YAGmail is a python package for automating Gmail. The package derives its name for Yet Another Gmail SMTP client.

The package can be install by using the below code.
You can check out the official documentation here.

pip install yagmail

Credentials of gmail- username and password have to be provided to create an SMTP client, it can be considered as logging in to your account.

mailer=yagmail.SMTP(user=’USERNAME’, password=’PASSWORD’)

Once SMTP client is created, we can send email to whichever valid email id.
All components required for…

Implementing Black-Scholes Option Pricing Model using Opstrat package in python

The Black-Scholes model, also known as the Black-Scholes-Merton (BSM) model, is a mathematical model used to determine the fair prices of options contract.
The model owes its name to economists Fischer Black and Myron Scholes. Robert C. Merton was the first to publish a paper expanding the mathematical understanding of the options pricing model, and coined the term “Black–Scholes options pricing model”.
The model revolutionized financial landscape and earned Merton and Scholes the Nobel Memorial Prize in Economic Sciences in 1997.

The model utilizes the following five inputs to predict the price of option(C):
i. Current price (Spot price) of the…

How to generate a Gantt Chart which contains additional details like Departments, Percentage Completion etc.

This is the second part of visualizing Gantt Chart using python. Check this article in which steps for creating a basic Gantt Chart are explained in detail.

The basic Gantt Chart contains bars corresponding to every task of the project. In this article we will improve upon the basic Gantt Chart including details like completion status and sub-category for each task.

Preparation of a basic Gantt chart can be summed up in the following steps.

Step 1: Read data
Step 2: Convert dates to datetime format
Step 3: Add Duration
Step 4: Add relative date
Step 5: Create custom x-ticks and x-tick labels

A step by step tutorial on how to create a simple Gantt Chart using matplotlib in python

A Gantt chart, the most common method used in project management to visualize project schedule and status.
A Gantt chart is a type of bar chart showing activities (tasks or events) displayed against time.
The chart is named after its inventor, Henry Gantt, who designed such a chart around the early twentieth century.

In this article I will explain how to create a Gantt chart in python using matplotlib library.

First step in programing a Gantt Chart is importing the required libraries:
1. Pandas : Reading data and data analytics
2. Matplotlib : Data visualization
3. Datetime : Date manipulation

A data-driven attempt in predicting English Premier League results using xG Statistics

This is the last game week of a season which would be remembered for various reasons. This season has been a roller-coaster ride.
This is the final article on my EPL Prediction series. You can check out the previous predictions here.

Expected Goals or xG is the parameter used for prediction. If you are interested in understanding the algorithm for prediction, I recommend that you check out this article where it is explained in detail.

Data Courtesy: Football Reference

Analysis up to Game-week 37

Epl Table (Image by Author)

As we get to the last game week of the season, Man City has already been crowned the champions, and relegation…

A step by step tutorial for visualizing data as treemap using squarify and matplotlib packages

Treemap is a popular visualization technique used to visualize ‘Part of a Whole’ relationship like pie chart and donut chart. However, treemaps are easy to follow and interpret. Also, treemaps perform a better job when we have to compare a large number of items.

Squarify package is used for generating treemaps. If the package is not installed, the first step is to install the package using pip.

pip install squarify

We have to import the following packages.

import pandas as pd             # Read data from excel
import matplotlib # data viz
import matplotlib.pyplot …

Abhijith Chandradas

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store