Showing posts with label Market. Show all posts
Showing posts with label Market. Show all posts

May 4, 2016

Shiny R code for multiple plots using ggplot2 and gridextra

Shiny R code for multiple plots using ggplot2 and gridextra

Sample code to use shiny for multiple graphs in same plot
Use ggplot2 and gridextra



Dec 31, 2015

R code to download Options and Futures data from NSE

The code below can download daily bhav for Futures and Options from the NSE website. 

I have also include sample code that downloads indices level from the National Stock Exchange

Sep 3, 2015

Factor to explain factor

The new fama-french model replaces the existing five-factor model.  The new five-factor fama-french model includes  profitability and investment factors.
Profitability factor: Robust minus weak operating profit (RWA )= (SR + BR) / 2 – (SW + BW) / 2 = [(SR – SW) + ( BR - BW)] / 2 

Investment factor:  Conservative minus aggressive Investment (CMA)  = (SC + BC) / 2 – (SA + BA) / 2 = [(SC – SA) + ( BC -BA)] / 2

S = small ; B = big; R = Robust; W= Weak; C= Conservative; A = Aggressive 

The new model is:

$R_{t}-RF_{t} = \alpha + \beta_{1}[RM_{t}-RF_{t}] + \beta_{2}SMB_{t}  + \beta_{3}HML_{t}  + \beta_{4}RMW_{t}  + \beta_{5}CMA_{t}  + \epsilon_{t}$

$RM_{t}-RF_{t}$ = excess market return
$SMB_{t}$ = the Size factor
$HML_{t}$ = the value factor
$RMW_{t}$ = the profitability factor
$CMA_{t}$ = the investment factor
$RF_{t}$ = risk free rate


Jul 6, 2012

Do we need stock exchanges?


 Bombay stock exchange is one of the oldest stock exchanges in Asia.  Currently, BSE, NSE and some more exchanges which are competing each other for success, clients and liquidity. The way the Indian market has opened up investment opportunities for the world , we can't deny the role of these stock exchanges.But, one article that has made me think about the contribution of these stock exchanges is in relation to growth and the upliftment of the poor in India. 
Mark Twain has divided the world into two kinds of people: Those who have seen the Taj Mahal , and those who haven't.  The same division is applicable for both India and the rest of the world. We can divide people into those who invest in stock market and those who don't. Majority of people don't  invest in stocks and few reasons could be:
  1. 30%  of the population are still below poverty line. Investment is a distance dream for one third of the citizens in the country
  2. Many who are capable to save their earning, view stock market are for gamblers, a traditional perception that is persistent across India . They dash their cash in Gold, bank deposit or various govt and non govt saving schemes.  They get better pay off with low risk. (Gold is not risk free!)
  3. Some show great interest to invest in stock market, but they don't know the process to trade in the market. Undoubtedly,the retail participation in the Indian stock markets is very low compared to other developed markets.
Possibly, only 5-10% of the citizen are investing in stock markets.!!!! But there are 3-4 24X7 TV channels which have rooms filled with market experts and investors and their hosts who can both excite and lament in every 5-10 points swing in Sensex. Knowingly or unknowingly, our economists try to mimick developed countries policies. Major investors now have FII status, they put cash, take profit and leave this market when they sense uncertainty , creating panic among other local investors and depriving cash in hand of those who connect to stock markets with different market linked investment vehicles: Mutual funds, ETFs, ULIPs etc. When Indian companies can list in the global stock exchanges and can infuse money to their markets, they can definitely  create same direct or indirect benefits in their base country. Why should we make market for the 1 % of citizens who own more than 50% of 2000+ listed companies in BSE and NSE and create investment opportunity for hardly 10 % of Indians.

Aug 15, 2011

Overview of Indian Quant Mutual Funds

In a quant (quantitative) fund, an investor manager employs computer-based numeric and mathematical
model to select securities. The computer-model determines buy or sell decision for the fund managers,
avoiding human intervention. Quantitative model for investment has become widespread with the advent
of modern computers and Internet connectivity. The use of complex theories of mathematics to physics in
the model puzzle investors even the most sophisticated ones.
The use of quant-based investment is gaining popularity in Indian fund houses. Many
renowned proprietary trading firms and hedge funds, which use ruled-based scientific methods to exploit
investment opportunities, have entered Indian market. Few mutual funds have quant-based investment
schemes for their investors. However, these mutual funds are not using purely mathematical model.
Instead, they are using a middle ground where the fund manager will use human judgment in addition to a
quantitative model.

There are eight quant based funds in India.
Mutual Funds
Reliance Quant plus
Religare AGILE
Canara Robeco Large Cap Plus
Edelweiss Absolute Return
Religare AGILE tax
ETFs
Motilal Oswal MOSt Shares M50 ETF
Motilal Oswal MoSt Shares Midcap 100 ETF
Motilal Oswal MoSt Shares NASDAQ-100 ET

Jan 12, 2011

IIP data and Market (2011 January)

Industrial output in November grew at its slowest in a year and a half.
The 2.7% rise was way below the 11.3% annual growth in the previous month and under the median forecast of 6.6% in a Reuters poll. Disappointing industrial output data  was expected to drag market down. However market jumped back to 5860 level  with very strong  global clues  and  short covering. 


NSE Intraday data on 12th January 2011




 

IIP data was released around 11:00 AM IST and market was already down 50-60 points below the opening level at the time



Next most important event for market is Reserve Bank of India(RBI)  general meeting on credit policy.
RBI is likely to increase interest rate by 25 basis point.

Jan 6, 2011

Banks are gold mines only in Q3

The title may surprise you, but you can't ignore the statistics.
Every sector shows its strength depending on  the economy, government policies and supply/demand.

Here is my observation on Banking sector:
From 2003 to 2010, Banking sector  has been doing well in Q3 except 2002.
Using 2003-2010  NSE-Bankex data
Average return in Q3: 21%
Minimum return in Q3: 9.4% (2004)
Maximum return in Q3: 43%  (2006)
Number of -ve return in Q3: 0

Series of Q3 return is  all positive values.

Bankex Index  series  from July to September (Assuming 1st value of the July month as 1)
Bankex return for Q3:
 
Year 2003-Q3 2004-Q3 2005-Q3 2006-Q3 2007-Q3 2008-Q3 2009-Q3 2010-Q3
Return(%) 17.94% 9.44% 25.64% 43.24% 16.61% 17.03% 13.89% 31.26%

 Note: 2002 Q3 return of Bankex was negative (-6% ).

IIP data and January month

IIP(index of industrial production) data certainly have some influence on market. I am trying to compile previous 4-5 years data to take position with caution.
Around 2nd week of January,  Industrial Production  data from April to November in previous  are released. I assume better IIP data will push market upwards.
My analysis only involves IIP data and  performance of Market on the month of January.

Below is the  snapshot of NSE chart for January month in year 2004 to 2010: (Assuming Nifty Index on 1st trading day of January is 1)



Relative chart of Nifty Index for January month


IIP data released on 16th January 2006:
IIP figures reveal a 9.4% growth rate in April-November 2005, against 9.1% during the corresponding period in the previous fiscal.
IIP data signal: +ve
Other Indicators:: +ve
Market reacted positively to IIP data  in January'06.

IIP data released on 12th January 2007:
Country’s industrial output clocked a growth of 14.4 per cent in November 2006 as against 6 per cent in November 2005, the fastest in 11 years. Manufacturing, which has the highest weight in the Index of Industrial Production (IIP) basket, accelerated by 15.7 per cent in November this fiscal, the highest since June 1996.
IIP data signal: +ve 
Other Indicators:: +ve 
 Market reacted positively to IIP data.

IIP data released on 12th January 2008:
In November 2006, industrial growth was 15.3%.
Manufacturing sector growth also fell sharply to 5.4% in November 2007, against 17.2% in the same period the previous year. Consumer goods, consumer durables and consumer non-durables witnessed negative growth in the month. 
IIP data signal: -ve
Other Indicators:s: --ve
 Market  was down around 15-20%  fired by global slowdown.

 IIP data released on 12th January 2009:
Index for industrial production (IIP) recorded a positive growth of 2.4% in the month of November 2008 compared with negative growth of 0.4% in the previous month (October 2008). 
IIP data signal: +ve
Other Indicators: --ve

The data on industrial production for November has been a pleasant surprise, but it had absolutely no impact on the stock market. The other reason might be that many global and industrial indicators did not paint a rosy picture of the economy

 IIP data released on 12th January 2010:
The Index of Industrial Production (IIP) figure went up by 11.7 percent in the month of November last year. The growth was mainly fuelled by the demand for manufactured and consumer goods.   
Other Indicators: neutral /-ve
IIP data signal: +ve

However market  could not  react strongly and ended up lower level in January 2010. In 2010 January, market was entering to recovery phase and investors kept on booking profit.

This January global clues are encouraging. IIP signal  is going to be positive (Assumption).
My bet is due.  (10-12 Jan 2011). 

IIP data link
IIP data release calendar

(Caution: IIP data  are yet to declare.  Market in January is very volatile)