Mean-reversion or trend-following are two sides of a coin

Capital allocation with Convex Optimization, Kelly’s Criterion & Markowitz Efficient Frontier

Image by author

Trend-following which also termed as momentum trading strategies are widely used in the investment world. In this trading philosophy buying/selling decisions are made solely according to the observed market trend. To better understand the nature of trend-following trading strategies and discover the corresponding optimality conditions, let us consider the cases when the market trends i.e. the general direction the market is taking during a specified period of time. In mathematics trend is the degree of serial correlation in the data while a trend is a series of higher highs or lower lows in trading. …


Event driven back-testing with mean reversion trading strategy

Support & resistance levels thresholds for trading signal generation

Image by author

Mean reversion actually is originated from regression toward the mean. We always tend to apply our intuition for devising a trading strategy and that is perfectly all right. Considering if markets have been on roller-coaster ride, moving up/down all the time, the first thing our intuition will guide us, that probably it will continue to move in the same direction. Fundamentally that leads to trend following strategies. On the other hand, there is mean reversion which comes from the argument that, poor performing stocks will perform well in the subsequent periods and vice versa. …


Classification with class imbalance problem

Difficult task of solving Imbalance Class distribution

Image by author

Class distribution in general comprises of either skewed or imbalance classes and somewhat balanced classes. Either of these have their own set of challenges and metrics to evaluate classifier’s performance. Example of skewed classes are common in real-world data set e.g. medical diagnosis, fraud detection (credit card, phone calls, insurance), network intrusion detection, pollution detection, fault monitoring, biomedical, bioinformatics and remote sensing (land mine, under water mine) to name a few, suffer from these phenomena. Likewise balanced class could be prevalent in stock market data. …


Performance Assessment of Ensemble Learning

Boosting algorithms to improve the classification performance

Image by author

Adaptive Boosting (AdaBoost) has popular use as an Ensemble Learning Method in Supervised Machine Learning and was formulated by Yoav Freund and Robert Schapire, 2003. It is a meta-estimator and begins by fitting a classifier on the original dataset and then fits additional copies of the classifier on the same dataset but where the weights of incorrectly classified instances are adjusted such that subsequent classifiers focus more on difficult cases. We have seen earlier that, creating an effective classification model is a daunting task in the presence of imbalance classes in data set.

We will experiment with Boosting mechanisms to…


Which accuracy metrics to use for imbalanced class use case?

Image by author

Accuracy and F1 score computed on confusion matrices have been among the most popular adopted metrics in binary classification tasks and a lot of businesses are still relying on these when dealing with imbalance data set. Imbalanced distribution of data is a big challenge for standard learning algorithms and statistical measures can dangerously show overoptimistic inflated results. Imbalanced class is persistent in many real world problems, especially when connected with anomaly detection, such as in financial fraud, email fraud detection, medical diagnosis or computer intrusion detections.

Here, we will talk about Matthews Correlation Coefficient (MCC) and Cohen’s Kappa; these two…


Intraday Trading Models

Intraday high frequency trading using EMA’s

Image by author

Exponential Moving Average is a kind of weighted moving average which gives more weightage to recent price data compared to simple moving averages. To simplify, exponential moving average reacts faster to the recent changes in the underlying data. Here, we will use EMAs crossover to time buy/entry and sell/exit points in stock trade. Testing is extremely critical for whatever trading strategy we take; more hypotheses we create during testing stage, better the evaluation and outcome result.

Let us observe the data points we have; we have intraday minute frequency data of S&P E-mini as shown below.

Data (S&P E-Mini index):

Original data was in…


LSTM for future forecast

Traffic flow prediction with big data & deep learning

Image by author

Traffic flow as a part of transportation management and control, has become more data intensive work. Forecasting traffic flow primarily depends on historical and real-time traffic data collected from various sensor sources, including inductive loops, radars, cameras, mobile Global Positioning System, crowd sourcing, social media, etc.

We all are aware of the fact that, the traffic follows a very particular pattern for week days. In the morning the traffic flow increases and reaches a peak (rush hour) before slowing down rest of the day till evening or late afternoon. Traffic flow depends on time dependent and spatial correlations. Data driven…


Risk management is critical for fund managers

Market risk measures using statistical approach

Image by Author

Risk analysis is critical and extremely important which not only potentially avoid making huge financial losses, but, by performing effective risk analysis we may be able to increase profits.

We will discuss about the risk involve in stock trading and portfolio management. The way it works is, the moment we open a position in the market, we are vulnerable to various types of risks, such as volatility risk. credit risk, market risk, operational risk etc.; well for portfolio management, we are aware of the primary risk element is market risk. Therefore, it is extremely important for a trader to understand…


Calibration & simulation of Interest rate model

Fixed income modeling for risk management

Image by author

IInterest rate models are mainstay for risk and asset managers, in particular for those overseeing long term investments. We are aware of the fact that, interest rates affect all levels of economic activities and it is quite well known that, Central banks of most of the countries target interest rates as a policy tool to influence economic activity.

There are several interest rate models have been proposed for financial studies e.g Vasicek model, CIR model, and Hull-White model. Mostly involve modeling the short rate and rely on factors with most of them using only one factor. Two-factor and multifactor interest…


text mining and unsupervised machine learning

Business Intelligence, Entity Recognition and LDA topic Modeling

Image by author

Text Analytic is quite useful and proven to extract relevant information and knowledge hidden in unstructured content. Extracting business Intelligence and characterizing the content of large set of unstructured data is a common problem in real-life data mining use cases. By applying effectively to a corpus, it helps to gather important insights from unstructured data e.g. patterns, trends and insights.

Here, we will experiment with news articles by focusing on named entities in news using natural language toolkit (NLTK) which is quite useful NLP. Furthermore, Latent Dirichlet Allocation ( LDA) algorithm will be used for modeling purpose. …

Sarit Maitra

Data Science Practice Lead at KSG Analytics Pvt. Ltd.

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