27
Alex Camhi Shankar Kar Jason Siegel Financial Market Analysis

Computational Intelligence Final Project

Embed Size (px)

DESCRIPTION

• Applied neural networks and genetic algorithms to track the Dow Jones Index• Used historical data from January 2005 to March 2010 as training data sets• Developed a portfolio that selected 5 best companies on a weekly basis

Citation preview

Page 1: Computational Intelligence Final Project

Alex Camhi

Shankar Kar

Jason Siegel

Financial Market Analysis

Page 2: Computational Intelligence Final Project

Agenda

Overview

DOW Jones Index

SP 500 Index

Data Collection

Objective Function

Results

DOW Jones Index

SP 500 Index

Page 3: Computational Intelligence Final Project

Background Information

Page 4: Computational Intelligence Final Project

Dow Jones DOW Jones Index:

Referred to as “DOW 30”

Created by Wall Street Journal Editor – Charles DOW and statistician Edward Jones

Second oldest U.S market index

index that includes 30 large Blue Chip public owned companies in US that trades in the stock market

Index is price weighted , to compensate for effects of stock splits and adjustments – a scaled average.

Actual average is calculated by summing the 30 component stock prices and dividing it by a divisor

where p are the prices of the component stocks and d is the Dow Divisor.

Divisor is adjusted in case of stock splits or spinoff ( a company sells part of its company)

Page 5: Computational Intelligence Final Project

Data Collection

Dow Jones Index:

Historical Data from January 1,2005 to March

24,2010

Obtained from Yahoo! finance website

Divisor value

Account for holidays and new companies added to

the index.

Removed: C, AIG, MO, HON

Replaced with: BAC, CVX, CSCO, TRV

Page 6: Computational Intelligence Final Project

S&P 500

S&P 500 Index:

500 Stock components on NYSE/Nasdaq

Owned and maintained by Standard & Poors

Components selected by committee

Must be commonly traded among general public

Representative of all major US industries

Float Weighted

Market capital of public shares vs. index

Page 7: Computational Intelligence Final Project

Data Collection

S&P 500:

Historical data from Jan 2005 to April 2010

Source: Google Finance

Not split adjusted

Method of Collection

Script to collect historical prices

Data compiled and holidays added

Page 8: Computational Intelligence Final Project

Genetic Algorithm Specifics

Page 9: Computational Intelligence Final Project

Two GAs

Buy and Hold Active Management

X number best stocks

chosen

Stocks are held for

the duration of the

test

X number best stocks

chosen each period

Y stocks swapped at

start of each period

Data must be

renormalized each

time stocks are

swapped

Page 10: Computational Intelligence Final Project

Objective Function

Index data normalized

Selected stocks are weighted to total $1000 at

start of period

RMSE – (ΣDifference in value^2)^1/2

Page 11: Computational Intelligence Final Project

DJIA Tracking

Page 12: Computational Intelligence Final Project

Purpose

Individual Investors consider investing in an index for

many reasons

Tracker manages portfolio for individual investor

With advancements in the tracking technology, future

market collapses could be seen in advance so that

corrective action may be taken prior to the collapse.

Page 13: Computational Intelligence Final Project

No Active ManagementRunning GA Script Stock 1

Parameters: (From Jan 1 2005 – Dec 31 2007)

Number of stocks to pick = 10

Number of generations = 1000

Population size = 30

Mutation rate = 0.1

Seed number = 2

Page 14: Computational Intelligence Final Project

No Active ManagementStocks 1 1/3/2005 1/1/2008

TickerOriginal Pivots Weights

Price on 1/1/2008

$ Holdings on 1/1/2008

Price on 3/24/2010

$ Holdings on 3/24/2010

AXP 3 2.1687 52.02 112.815774 41.01 88.938387

XOM 12 1.7997 93.69 168.613893 66.5 119.68005

JPM 19 2.707 43.65 118.16055 44.94 121.65258

KO 10 0.68282 61.37 41.9046634 54.62 37.2956284

MMM 1 1.326 84.32 111.80832 81.61 108.21486

MCD 21 2.0184 58.91 118.903944 66.8 134.82912

HPQ 14 2.4255 50.48 122.43924 53.06 128.69703

GE 13 2.4639 37.07 91.336773 18.45 45.458955

WMT 29 1.5981 47.53 75.957693 55.58 88.822398

HD 15 1.4127 26.94 38.058138 32.32 45.658464

$ Total on 1/1/2008 999.9989884

$ Total on 3/24/2010 919.2474724 % Portfolio Change -8.08%

DJIA on 1/1/2008 13043.96 DJIA on 3/24/2010 10836.15 % DJIA Change

-16.93%

Percent Error -8.85%

No active Management$ Total on 1/1/2008 $1,000.00

$ Total on 3/24/2010 $919.25

Page 15: Computational Intelligence Final Project

Active ManagementRunning GA Script Stock 3

Parameters: (From Jan 1 2005 – Jan 28 2008)

Number of days to backtrack = 100

Number of swaps to make = 5

Number of Generations = 1000

Population size = 30

Mutation rate = 0.1

Seed number = 2

0 10 20 30 40 50 60 70 80 90 10096

98

100

102

104

106

108

110

Time

Po

rtf

oli

o h

old

ing

s

Portfolio holding tracker for DOW

RSME = 0.28806

DOW

Tracker

Page 16: Computational Intelligence Final Project

Active ManagementSwap 1 1/1/2008

New Pivots Weights Price on 1/1/2008 $ Holdings on 1/1/2008Price on

2/28/2008$ Holdings on

2/28/2008

1 34 1.504854 61.57 92.65384847 58.92 88.6659859

1 11 4.036599 44.09 177.9736675 44.84 181.0011171

1 28 3.554694 43.69 155.3045721 38.11 135.4693807

1 27 0.99632 76.54 76.2583305 73.73 73.45867139

1 1.326043 84.32 111.8119205 77.44 102.6887467

1 22 1.001714 58.11 58.20958311 49.25 49.33439973

14 2.425475 50.48 122.4379982 43.8 106.2358225

13 2.463909 37.07 91.33711034 34.72 85.54692395

29 1.598051 47.53 75.95537354 48.71 77.84107395

15 1.41268 29.64 41.87182927 29.14 41.16548937

5 $ Total on 1/1/2008 1003.814234$ Total on 1/28/2008 941.4076113 % Portfolio Change -6.22%

DJIA on 1/1/2008 13043.96 DJIA on 1/28/2008 12383.89 % DJIA Change -5.06%

Percent Error 1.16%

Active Management $ Total on 1/1/2008 1003.814234 $ P&L -62.40662

1003.814234 $ Total on 2/28/2008 941.40761

Page 17: Computational Intelligence Final Project

Active Management First Swap After 20 Days

Sold: AXP, XOM, JPM, KO, MCD Bought: HON, DD, VZ, UTX, MRK

Added 20 rows of data representing monthly management through the data to 3/24/2010

Gave the program the option to swap 5 stocks each month GA Optimizes the portfolio

Completed 30 iterations of this management process

Page 18: Computational Intelligence Final Project

Final ResultsSwap 30 3/24/2010

New Pivots Weights Price on 3/24/2010 $ Holdings on 3/24/2010 Price on 4/23/2010 $ Holdings on 4/23/2010

JPM 19 1.393579 44.94 62.62744026 44.94 62.62744026

UTX 27 2.6926242 73.04 196.6692716 76.47 205.9049726

WMT 29 3.037488 55.58 168.823583 54.53 165.6342206

IBM 17 0.8119807 128.53 104.3638729 129.99 105.5493647

1 DD 11 0.9013654 38.77 34.94593578 40.22 36.25291558

1 INTC 16 1.1872023 22.43 26.62894759 24.04 28.54034329

CAT 7 0.8815036 62.06 54.70611155 68.78 60.62981554

PG 25 0.8086214 63.61 51.4364098 63.54 51.3798063

JNJ 18 3.0818363 64.75 199.5489004 65.04 200.442633

HPQ 14 1.6989863 53.06 90.14821308 53.9 91.57536157

2 $ Total on 3/24/2010 989.898686 $ total on 4/23/2010 1008.536873 % Portfolio Change 1.88%

DJIA on 3/24/2010 10836.15 DJIA on 4/23/2010 11204.28 % DJIA Change 3.40%

Percent Error -1.51%

Average Error 0.69%

Page 19: Computational Intelligence Final Project

Final Results

Buy and Hold DJIA Value on 1/1/2008 Value on 3/24/2008 % Change

DJIA 13043.96 10836.15 -16.93%

$1,000 invested $1,000.00 $830.74 -16.93%

Buy the Tracker

$1,000 invested $1,000.00 $836.48

Total Trades Transaction Fees Total Fees

108 $0.25 $27.00

Follow the Tracker Value after Fees

$1,000 invested $836.48 $809.48

Page 20: Computational Intelligence Final Project

Final Results

-20.00%

-15.00%

-10.00%

-5.00%

0.00%

5.00%

10.00%

15.00%

1/1

/2008

2/1

/2008

3/1

/2008

4/1

/2008

5/1

/2008

6/1

/2008

7/1

/2008

8/1

/2008

9/1

/2008

10

/1/2

00

8

11

/1/2

00

8

12

/1/2

00

8

1/1

/2009

2/1

/2009

3/1

/2009

4/1

/2009

5/1

/2009

6/1

/2009

7/1

/2009

8/1

/2009

9/1

/2009

10

/1/2

00

9

11

/1/2

00

9

12

/1/2

00

9

1/1

/2010

2/1

/2010

3/1

/2010

% C

han

ge

Tracker VS. DJIA

% Portfolio Change

% DJIA Change

Percent Error

Page 21: Computational Intelligence Final Project

S&P500 Tracking

Page 22: Computational Intelligence Final Project

GA Paramters

Portfolio Size: 20 Stocks

Replications: 3000

Population size: 30

Mutation Rate: 0.1

Number of Swaps: 5/Period

Back Data: 100 Days

Total time period: 28 months

Page 23: Computational Intelligence Final Project

Buy and Hold

Page 24: Computational Intelligence Final Project

Active Management

Period Length: 1 Month

Swap up to 5 stocks on the 1st of Month

GA run to optimize portfolio each period

Resulting portfolio values calculated and

compared to S&P500

Page 25: Computational Intelligence Final Project

Active Management ResultsPeriod # Start Date End Date Port. Start Port. End

% Change Portfolio S&P Start S&P End

% Change S&P500 % Error

0 1-Jan-08 1-Feb-08 1000 995.556 -0.00444 1468.36 1395.42 -0.04967 -0.04523

1 1-Feb-08 3-Mar-08 999.493 1145.35 0.145931 1395.42 1331.34 -0.04592 -0.19185

2 3-Mar-08 1-Apr-08 1006.13 1010.34 0.004184 1331.34 1370.18 0.029174 0.024989

3 1-Apr-08 1-May-08 1010.35 1017.21 0.00679 1370.18 1409.34 0.02858 0.02179

4 1-May-08 2-Jun-08 1013.98 969.142 -0.04422 1409.34 1385.67 -0.0168 0.027425

5 2-Jun-08 1-Jul-08 999.324 931.81 -0.06756 1385.67 1284.91 -0.07272 -0.00516

6 1-Jul-08 1-Aug-08 989.389 1019.97 0.030909 1284.91 1260.31 -0.01915 -0.05005

7 1-Aug-08 1-Sep-08 993.233 908.657 -0.08515 1260.31 1282.83 0.017869 0.103021

8 1-Sep-08 1-Oct-08 1000 790.565 -0.20944 1282.83 1161.06 -0.09492 0.114512

9 1-Oct-08 3-Nov-08 996.832 848.592 -0.14871 1161.06 966.3 -0.16774 -0.01903

10 3-Nov-08 1-Dec-08 1147.79 1251.88 0.090687 966.3 816.21 -0.15532 -0.24601

11 1-Dec-08 1-Jan-09 1003.86 1020.44 0.016516 816.21 903.25 0.106639 0.090123

12 1-Jan-09 2-Feb-09 1000 1063.15 0.06315 903.25 825.44 -0.08614 -0.14929

13 2-Feb-09 2-Mar-09 1010.08 932.356 -0.07695 825.44 700.82 -0.15097 -0.07403

14 2-Mar-09 1-Apr-09 1023 1098.13 0.073441 700.82 811.08 0.15733 0.083889

15 1-Apr-09 1-May-09 1110.44 1191.13 0.072665 811.08 877.52 0.081915 0.009251

16 1-May-09 1-Jun-09 1004.2 1017.73 0.013473 877.52 942.87 0.074471 0.060998

17 1-Jun-09 1-Jul-09 1040.6 989.969 -0.04866 942.87 923.33 -0.02072 0.027932

18 1-Jul-09 3-Aug-09 1001.02 1136.69 0.135532 923.33 1002.63 0.085885 -0.04965

19 3-Aug-09 1-Sep-09 994.411 1053.9 0.059823 1002.63 998.04 -0.00458 -0.0644

20 1-Sep-09 1-Oct-09 1094.66 1263.71 0.154432 998.04 1029.85 0.031872 -0.12256

21 1-Oct-09 2-Nov-09 1003.85 1021.42 0.017503 1029.85 1042.88 0.012652 -0.00485

22 2-Nov-09 1-Dec-09 860.552 881.989 0.024911 1042.88 1108.86 0.063267 0.038356

23 1-Dec-09 1-Jan-10 1008.54 1032.69 0.023946 1108.86 1115.1 0.005627 -0.01832

24 1-Jan-10 1-Feb-10 1000 1002.17 0.00217 1115.1 1089.19 -0.02324 -0.02541

25 1-Feb-10 1-Mar-10 973.935 992.138 0.01869 1089.19 1115.71 0.024348 0.005658

26 1-Mar-10 1-Apr-10 1004.55 1048.53 0.043781 1115.71 1178.1 0.05592 0.012139

Mean -0.01651

Page 26: Computational Intelligence Final Project

Active Management Results

Percent Error: 1.651%

-0.3

-0.2

-0.1

0

0.1

0.2

0.3

0.4

14-Nov-07 22-Feb-08 1-Jun-08 9-Sep-08 18-Dec-08 28-Mar-09 6-Jul-09 14-Oct-09 22-Jan-10 2-May-10

Perc

en

t C

han

ge

Date

Percent Change: Jan 2008-Mar 2010

% Change Portfolio

% Change S&P500

Page 27: Computational Intelligence Final Project

Questions?