# Trouble calculating the Dow Jones Industrial Average

I can successfully calculate the Dow Jones closing price by taking the sum of closing prices of the 30 component companies. However, using this same method, I'm unable to calculate the correct opening price. What am I doing wrong?

Here's some sample R code:

library(quantmod)

Dow.components <- c("MMM","AXP", "AAPL", "BA", "CAT", "CVX", "CSCO", "KO", "DIS", "DWDP",
"XOM", "GE", "GS", "HD", "IBM", "INTC", "JNJ", "JPM", "MCD", "MRK",
"MSFT", "NKE", "PFE", "PG", "TRV", "UTX", "UNH", "VZ", "V", "WMT")

Dow.divisor <- 0.14523396877348

Stocks.open = lapply(Dow.components, function(sym) {
Op(getSymbols(sym, from="2018-05-07", to = "2018-05-08", auto.assign=FALSE))})

Stocks.close = lapply(Dow.components, function(sym) {
Cl(getSymbols(sym, from="2018-05-07", to = "2018-05-08", auto.assign=FALSE))})

# Sum (Dow components close prices)
rowSums(do.call(merge, Stocks.close)) / Dow.divisor
# 24357.32

# Dow Jones index close price
as.numeric(Cl(getSymbols("^DJI", from="2018-05-07", to = "2018-05-08", auto.assign=FALSE)))
# 24357.32

# Sum (Dow components open prices)
rowSums(do.call(merge, Stocks.open)) / Dow.divisor
# 24346.23

# Dow Jones index open price
as.numeric(Op(getSymbols("^DJI", from="2018-05-07", to = "2018-05-08",
auto.assign=FALSE)))
# 24317.66


I'm getting the correct closing price of 24357.32. But I can't get the correct open price of 24317.66.

• The stocks in the average do not necessarily open simultaneously. so opening DJIA $\ne$ average of openings of stocks in DJIA. – Alex C May 16 '18 at 0:24
• Thanks for the quick reply. That would make a lot of sense - but how do I reconcile with this reference which states that "The Dow Jones components are all listed on the New York Stock Exchange (NYSE) or the Nasdaq...Both exchanges follow the same schedule of hours from 9:30 a.m. to 4 p.m. EST" ? – Rez99 May 16 '18 at 2:53
• When the market opens at 9:30 am, all stocks are declared open for trading, but not all immediately begin trading. For less active stocks, several minutes may elapse before the first order is processed. The computation and dissemination of the INDU proceeds regardless: for stocks which have traded the current price is used, for stocks that have not yet traded a "stale" price equal to yesterday's close is used in the average. So for several minutes the INDU average is not an accurate representation of current prices, but mixes together current nd stale information. – Alex C May 16 '18 at 10:32