First of all thanks for your impressive and motivational reponse for the Nifty Returns Heatmap Generation post. Here is yet another simple visualization stuff using python to compute bunch of NSE Sectoral Indices returns (52 Weeks, YTD , MTD, Last month returns) and visualize the same in a barchart.
Everyone love to visualize this market in their own way. Python comes handy when comes to visualization. One of the Awesome programming language to code any level of complexity. However I start here by simply generating a heatmap which visualizes the Historical Nifty returns since 2000 and there by visualizing the reality of the market.
Hodrick Prescott Filter does Time series decomposition involves separating a time series into several distinct components(Cycle component and Trend Component). And this filter looks like it can be applied to any timeseries data especially with stock prices to understand the underlying trend and the cycle involved in it. Should be a better tool for Stock Cycle lovers!
In the last tutorial we had seen how to import data from NSEindia using NSEpy library and how to compute co-integration. In this tutorial we will be using plotly – a library to visualize your data interactively and pandas – library to manage time series data to build interactive candle stick charts.
Cointegration is used in Statistical Arbitrage to find best Pair of Stocks (Pair Trading) to go long in one stock and short(Competitive peers) another to generate returns. Statistical Arbitrage(StatArb) is all about mean reversion, looking for deviation in the spreads and expecting mean reversion from the spread.