3. BUSINESS PROBLEM
We need to find the adjusted closing price for
each day a stock has not reported dividend.
We are given two data sets:
1Dividends – A CSV file that gives us information
about the dates a dividend is returned.
2. NYSE_daily_prices – A bunch of CSV files that has
all the information about stock prices.
4. continued…
• We have to retrieve the dates when
dividends have a value 0, from the
dividends data set and match that with
the NYSE daily prices data set and hence
retrieve the corresponding adjusted
closing price.
.
5. UNDERSTANDING DATA
The NYSE Daily Prices File has the following
columns separated by commas(CSV File):
exchange, stock_symbol, date, stock_price_open,
stock_price_high, stock_price_low, stock_price_close,
stock_volume, stock_price_adj_close
The NYSE Daily Dividends File has the
following columns separated by commas(CSV
File):
exchange, stock_symbol, date, dividends
7. PSEUDOCODE - MAPPER
public static class StockAnalysisMapper extends MapReduceBase
implements Mapper<LongWritable, Text, Text, Text>
{
@Override
public void map(LongWritable key, Text
value,OutputCollector<Text, Text> output, Reporter reporter)
throws IOException
{
// switch case to parse the input lines and store the data
// check for null values in the key
// check the header and send the key value to output collector
}
}
8. PSEUDOCODE-REDUCER
public static class StockAnalysisReducer extends MapReduceBase implements
Reducer<Text, Text, Text, Text>
{
@Override
public void reduce(Text key, Iterator<Text> values,OutputCollector<Text, Text> output,
Reporter reporter) throws IOException
{
while (values.hasNext())
{
// Parse the inputs which are count,stock adjusted closing price and check
// Store them as required after parsing
//check for null values of stock adjusted closing price
}
//Increment the sum
// write to output if sum is 1
}
}
9. BUSINESS IMPLICATION
The closing price of a stock is exactly that: the
price of that stock at the close of the trading day.
The adjusted closing price uses the closing price
as a starting point, but it takes into account factors
such as dividends, stock splits and new stock
offerings.
The adjusted closing price represents a more
accurate reflection of a stock's value, since
distributions and new offerings can alter the
closing price.
10. Continued…
The primary use for the adjusted closing
price is as a means to develop an
accurate track record of a stock's
performance.
The comparison of a stock's historical
adjusted closing price to its current price
shows the true rate of return.