+ All Categories
Home > Economy & Finance > Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011

Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011

Date post: 06-Jul-2015
Category:
Upload: jromich
View: 71 times
Download: 0 times
Share this document with a friend
Description:
An introduction to emerging alternative data sources available to investors which are increasingly easy to access using R and it's many community-contributed packages. Presented to the R/Finance conference in Chicago in 2011 http://www.rinfinance.com/RinFinance2011/agenda/
Popular Tags:
24
Transcript
Page 1: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011
Page 2: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011
Page 3: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011

Image Source: http://www.ritholtz.com/blog/wp-content/uploads/2010/09/Hemline-1-.jpg

Page 4: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011

Image source: http://alliedow.wordpress.com/2009/11/17/dancing-in-your-nuddy-pants/

Page 5: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011
Page 6: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011
Page 7: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011
Page 8: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011
Page 9: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011
Page 10: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011

Page 11: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011

Page 12: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011

http://xkcd.com/55/

Page 13: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011
Page 14: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011
Page 15: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011

Can signal a change in trends

Page 16: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011

library(twitteR)

tweets <- searchTwitter("Stock Market", n=1500)

times <- sapply(tweets, function(x) format(x@created, "%b %d %H:00"))

users <- sapply(tweets, function(x) x@screenName)

times <- times[!duplicated(users)] # removing duplicate users to avoid spammers and news

counts <- table(times)

bp <- barplot(counts, main="Counts of 'Stock Market' Tweets by Hour", col="lightblue", border=NA, ylim=c(0,200))

lines(spline(counts ~ bp), lwd=3, lty="dashed", col="darkblue")

Page 17: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011
Page 18: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011

http://www.huffingtonpost.com/dan-mirvish/the-hathaway-effect-how-a_b_830041.html

Page 19: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011
Page 20: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011

library(RGoogleTrends)library(quantmod)

ans = getGTrends("Anne Hathaway")trend <- xts( ans$Week$anne.hathaway, order.by=as.Date(ans$Week$Week, "%b %d %Y"))brk <- getSymbols("BRK-A", auto.assign=F, from = "2004-01-01" )x <- na.locf(merge(trend, Cl(brk)))[index(trend)]

#plot returns and search volumepar(mfrow=c(2,1))plot(x$trend, main="Google Trends: Anne Hathaway", col="blue")plot(x$BRK.A.Close, main="Berkshire Hathaway Share Price", col="red", cex=.7)

#evaluate returns by search volumex$Return <- Delt(x$BRK.A.Close)breaks <- cut(x$trend, seq(0,10, 1))boxplot(as.numeric(x$Return) ~ breaks, ylab="Weekly Return", xlab="Search Volume",

col="lightblue", border="darkblue" )abline(h=0, col="blue")

Page 21: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011
Page 22: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011
Page 23: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011

Page 24: Alternative Data Sources for Measuring Market Sentiment and Events (using R) - R/Finance 2011

Recommended