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

Interest rate models are mainstay for risk and asset managers, in particular for those overseeing long term investments. Vasicek suggests that short-term interest rate would revert to a certain level in a long run and suggested to use Ornstein-Uhlenbeck process to model the mean reversion property of interest rate.

here, we will implement PCA and a Vasicek short-rate model for swap rates, treasury rates and the spread between these two. Vasicek interest rate model is quite popular among the practitioners due to the interpretability of its parameters and the parsimonious setup. It has extensive use to determine bond, option, prices…

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. …

Algorithmic trading simplified

Algorithmic Trading and PnL Evaluation

Image by Author

Price Oscillator is a technical indicator calculating the difference between two price moving averages. It is quite similar to MACD indicator. Crossovers of two moving averages correspond to crossovers of price oscillator [PO (MACD)] and zero central signal line around it oscillates.

To understand price oscillator, we need to know the exponential moving averages (EMA) concept. In simple term, EMA is the average price over a certain number of days, with more recent days weighted more heavily i.e. exponentially. EMA needs to be calculated over a period of appropriate length to maximize meaningful data while minimizing random movement. There are…

Back-testing is a key component of algorithmic trading

Predictive Model & Back-testing with Natural Gas data

Image by Author

Back-testing which is in the form of performance testing is one of the most complicated tasks involved in an algorithmic trading research system. There are several things such as software latencies, network latencies, slippage, fees etc. are involved to build an algorithmic trading framework. The basic idea is to that is, given the historical data, what would be the performance of the trading strategy.

Here, we will explore as how we can use machine learning algorithm to predict future direction and define a strategy for trading. …

Linear Programming to improve decision

Optimization modeling for Decision Support System

Linear algebra is widely used for mathematical optimization and applications can be found almost in every industry operating under conflicting constraints. We will here work with a simple and quite common use case of cost optimization problem. The problem can be formulated as a standard linear optimization problem with the objective function is to minimize the transportation cost, subject to supply & demand with equality and inequality constraints. If we want to write a simple mathematical equation:

[d] = solver{O(), c1(), c2(), c3(), ….}


  • d = decision (optimal input variables which constitute best decision
  • solver = mathematical optimizer to…

mathematical solution to determine optimal value

Mixed-integer quadratic programming problem

Optimization modeling is a part of prescriptive analytic and mathematical solution to determine the optimal (maximin or minimum) value of a complex equation. A key aspect is that, given a constraints or limitations business need to arrive at realistic solutions. Optimization method has a wide application in the industry in many diverse fields such as machine learning, finance, aviation & logistics etc. to name a few. If we model the optimization method it will consists of three elements:

  • the objective function,
  • decision variables and
  • business constraints.

Once we zeroed down on the problem statement, the next step is to solve…

Intuition based trading strategy

Fundamentals of signal generation using technical analysis

Profitability of stock market trading is directly related to the prediction of trading signals. Here, we will discuss about some basic to advanced and popular technical analysis to build trading signals. Our focus will be on signal generation and visualization. A long list of technical indicators are available covering principal domains such as trend, momentum, volume, volatility, and support and resistance. We will cover a few of these here.

However, once signal is generated, strategy is defined, the next most important task is performance testing which is not the scope of this article. However, it’s not only the strategy decides…

Brent Crude Oil Futures price movements prediction

Algorithmic trading strategy evaluation based on crude oil data set

Image by author

Prediction and classification are important and of great interest for the simple fact that successful prediction of stock prices lead to rewarding benefits. However, there is no universal common set of rules but a series of highly complicated and quite difficult tasks are involved for such prediction.

Here, we will show a simple use case to showcase how classification rule can be applied to obtain a trading strategy and conclude with a performance testing of the strategy by running a simple script.

Let us load the data from Quandl.

BC = BC.loc['2010-01-01':,]
BC.sort_index(ascending=True, inplace=True)

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