Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Hadoop - Stock Analysis

2,693 views

Published on

Published in: Economy & Finance, Business
  • Be the first to comment

Hadoop - Stock Analysis

  1. 1. Stock Analysis using Hadoop Framework Presented by: Sudhanshu Ranjan Vaibhav Jain Santosh Koppada Sumit Sahay Madhumita Ghosh
  2. 2. AGENDA • OBJECTIVE • TECHNICAL ARCHITECTURE • BASIC STRUCTURE & CODES USED • FINAL RESULTS • BUSINESS IMPLICATIONS
  3. 3. OBJECTIVE • To obtain the companies adjusted closed share price after dividend distribution. • To review the past trends of dividend payout & formulate future group strategy. • Brand establishment increasing dividends. across the industry by paying
  4. 4. TECHNICAL ARCHITECTURE MapReduce Program Using Hive Mapper -1 Table Creation Reducer -1 Loading Data Final Output Inner Join Final Output
  5. 5. BASIC STRUCTURE & CODES USED(Using Hive) • FOR REMOVING THE HEADER: ON UNIX – • Tail -n +2 {FILE_NAME_WITH_HEADER} > {FILE_NAME_WITHOUT_HEADER} CREATING NYSE TABLE: ON HIVE – hive> CREATE TABLE NYSE (exchange STRING, stock_symbol STRING, T_date STRING, SP_open FLOAT, stock_price_high FLOAT, stock_price_low FLOAT, stock_price_close FLOAT, stock_volume INT, stock_price_adj_close FLOAT) ROW FORMAT DELIMITED FIELDS TERMINATED BY ','; • LOADING THE DATA INTO NYSE TABLE: – hive>Load data local inpath '/home/ec2-user/MS_Praxis/ NYSE_daily_prices_AT_W.csv' Overwrite into table NYSE; • To SELECT ADJUSTED CLOSING PRICE FOR EACH DAY THAT A STOCK REPORTED A DIVIDEND – hive> select n.stock_symbol,n.t_date,stock_price_adj_close FROM nyse n JOIN dividend d ON n.stock_symbol=d.stock_symbol and n.t_date=d.t_date;
  6. 6. BASIC STRUCTURE & CODES USED(Using MapReduce) : Mapper Import java and hadoop packages Public class stockers { Public static class stockanalysismapper extends mapreducebase implements mapper <longwritable, text, text, text> { // Declared the mapkey and mapvalue @Override Public void map(longwritable key, text value,outputcollector<text, text> output, reporter reporter) throws ioexception { // declaration of given variables // Used for loop 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 } }
  7. 7. Contd…Reducer public static class StockAnalysisReducer extends MapReduceBase implements Reducer<Text, Text, Text, Text> { //Declaration of required variables @Override public void reduce(Text key, Iterator<Text> values,OutputCollector<Text, Text> output, Reporter reporter) throws IOException { //Declaration of sum and flag variables 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 2 and flag is 0 } } }
  8. 8. Contd… • Implementation of MapReduce on Hadoop: – Copy the data from UNIX directory to HDFS • hadoop fs -put *.csv eproj/input/ – Run ‘JAR’ code on hadoop • hadoop jar Hadoop_matching.jar Stockers eproj/input mproj/output108 – To view the output • hadoop fs -cat mproj/output108/part-00000
  9. 9. RESULT • We have found the adjusted stock closing prices of companies on dates when they offered dividends.
  10. 10. BUSINESS IMPLICATIONS • Examining historical adjusted closing price trends as it give accurate representation of the company equity value beyond simple market price. • Basis the findings, it will encourage new investors will invest in the company. • It shows that the company is performing efficiently & meeting shareholder’s expectations. • Incase, there is no adjustment and the stock’s price is same after a dividend distribution, then any investor will get free money by buying the stock the day before the ex-date & later selling the stock after dividend distribution. Clearly no such arbitrage situation exists.
  11. 11. THANK YOU

×