Final Dzuo Tding Vfang PDF
Final Dzuo Tding Vfang PDF
Market Sentiment
Tina Ding Vanessa Fang Daniel Zuo
Northwestern University Northwestern University Northwestern University
Apt 301, 1940 Sherman Avenue 2133 1/2 ridge Ave, #2D 626 University Place
Evanston, IL 60201 Evanston, IL 60201 Evanston, IL 60201
1-847-702-4609 1-703-405-0688 1-847-220-3178
xiaotianding1.2013@u.north vanessafang2014@u.north pengzuo2014@u.northwest
western.edu western.edu ern.edu
3.1 Times Series Data Analysis Momentum measures the amount that a financial instrument's
price has changed over a given timeframe.
Based on S&P movement chart, we found that the magnitude of
Attribute 3: Relative Strength Index- Movement
index movement varies a considerable amount and more than a
quarter of the movements are within [-5,5]. Therefore, we The RSI is classified as a momentum oscillator, measuring the
believed labeling movements into 3 categories would provide velocity and magnitude of directional price movements. It is
more useful information on market movement. Since the intended to chart the current and historical strength or weakness of
magnitude of movement between [-5, 5] is relatively small, we a stock or market based on the closing prices of a recent trading
chose to label this as “same” or “not moving.” We finally have 3 period.
labels for S&P index movement: Up, Down, and Same (relative to Attribute 4: Stochastic-Oscillator
previous day).
The Stochastic Oscillator is a momentum indicator that shows the
location of the close relative to the high-low range over a set
number of periods.
Attribute 5: Weighted Moving Average-Movement (WMA-
Movement)
A weighted moving average (WMA) has the specific meaning of
weights that decrease in arithmetical progression.
Results:
SVM (RBF) Logistic Neural
1-day 43.37% 42.37% 39.56%
5-day 51.00% 49.20% 48.19%
10-day 39.36% 43.78% 40.76%
30-day 43.57% 42.97% 40.56%
Table 2. Initial results from time series data analysis
Figure 1. Market Movement Histogram We observed that using 5-day data returns the best result, and
SVM outperformed the other two models in all cases.
Label Up Same Down Total
Count 186 137 175 498 3.2 Sentiment Analysis
(Percentage) (37.34%) (27.51%) (35.14%) (100%)
We decided to use a simple approach, Naive Bayes Classifier, to
Table 1. Data distribution analyze sentiment in the tweet data set. The Python NLTK
provides a built-in Naive Bayes classifier, which can be trained
given a labeled feature set and then used to classify future
We used the following attributes to predict S&P movement. We instances.
chose our attributes based on “Prediction of Closing Stock
Prices”[6]. For each attribute, there is a threshold or criteria that After training our Naive Bayes classifier on the training set, we
indicate the S&P will go up or down in the next day. Since we ran the classifier on each tweet in our data set. For each tweet, the
have 3 classes of index movements, we decided to change the classier outputs a score in the range of (0, 1). For each day, we
number of labels of each attribute from 2 to 3. computed the average score for all the tweets and used the
average score as a benchmark to label each tweet: we labeled the
Based on the original threshold value and criteria, we divided tweets with a score higher than average as positive, and the tweets
each attributes into three classes: we label it as “-1” if it strongly with a score lower than average as negative. In the end, we
indicates the market will go down, “1” if it strongly indicates the divided the number of positive tweets by the total number of
market will go up, and “0” if it does not have strong indication. tweets within a day to get the daily sentiment score.
We chose the threshold values so that each attribute are
approximately evenly divided.
We also wanted to compare the performance of using data of
different time period. Therefore, we adjusted the calculations of
attributes so that their values reflect the information of a certain
time period. Here are the calculation and labeling of each attribute
for t-day period data: Figure 2. Example output from NLTK Naïve Bayes Classifer
Attribute 1: On Balance Volume-Movement
On Balance Volume (OBV) measures buying and selling pressure 3.3 Combined Analysis
as a cumulative indicator that adds volume on up days and
subtracts volume on down days. Before incorporating the sentiment scores into original time series
data analysis, we labeled the sentiment scores as up, down or
same. We set the cutoffs to 0.52 and 0.56 such that any day with a moderately, and the improvement is only statistically
sentiment score lower than 0.52 is labeled down, between 0.52 significant in using SVM on 10-day and 30-day of prior
and 0.56 is labeled same, and above 0.56 is labeled up. data.
After adding the labeled sentiment results into the original model, For future work, there are three aspects that can be improved on.
we obtained the results represented in the following table. Firstly, the current data set that we performed sentiment analysis
on provided only keywords instead of original tweets. This lack of
SVM (RBF) Logistic NN
context may have affected the accuracy of our sentiment analysis.
1-day 40.21% 44.12% 42.01% The small training set that we built may be another aspect that can
be improved. With only a number of 295 training examples, the
5-day 51.88% 50.42% 48.13% learned model is far from being accurate and comprehensive.
10-day 43.75% 41.46% 38.54% Thirdly, the sentiment analysis method we used from the Python
NLTK is a very simple and preliminary textual sentiment analysis
30-day 48.54% 46.04% 42.92% tool. There are a lot of sophisticated tools available in the market
Table 3. Results from combined analysis that may yield more accurate results.
From the figures in Table 3, we observed that, in 8 out of the 12 We believe that with better sentiment analysis tools, a data set
cases, the performance was improved by adding in the sentiment providing more contexts for words and a larger training set, it may
analysis. Overall, there is an average increase of 1.11% in be possible to further increase the accuracy of the methods
classification correctness among the 12 cases. presented.