Get the "Applied Data Science Edge"!

The ViralML School

Fundamental Market Analysis with Python - Find Your Own Answers On What Is Going on in the Financial Markets

Hot off the Press!

The Little Book of Fundamental Market Indicators

My New Book: "The Little Book of Fundamental Analysis: Hands-On Market Analysis with Python" is Out!

Grow Your Web Brand, Visibility & Traffic Organically

The Little Book of Fundamental Market Indicators

5 Years of amunategui.github.Io and the Lessons I Learned from Growing My Online Community from the Ground Up

ISM Index, PMI Down Worldwide! Not Good for the Economy! Hands-on Market Analysis with Python

Introduction

The ISM Manufacturing Index also referred to as Purchasing Manager's Index (PMI), is down almost across the board. Let's download the raw data, breakout a Jupyter notebook and check this out for ourselves. The ISM/PMI is an economic number released monthly that hovers around a 50 line. Above means the outlook of the economy is expanding, below, contracting.

Code

ViralML-PMI-Down-Globally-Hands-On-Market-Analysis-with-Python
In [25]:
from IPython.display import Image
Image(filename='viralml-book.png')
Out[25]:

ISM Manufacturing Index Also Referred to as Purchasing Manager's Index (PMI), Is Down Almost Everywhere

What is the ISM/PMI?

It is a montly number part of an index indicator. It is a diffusion index as it hovers around a 50 line, above means the outlook of the economy is expanding, below, contracting. The data comes from a montly survey sent out to leading purchasing managers and supply management executives. Questions cover the ares of new orders, production, employment, supplier deliveries, and inventories.

From investopedia (https://www.investopedia.com/terms/p/pmi.asp

"The direction of the trend in the PMI tends to precede changes in the trend in major estimates of economic activity and output, such as the GDP, Industrial Production, and Employment. Paying attention to the value and movements in the PMI can yield profitable foresight into developing trends in the overall economy."

Let's get some data:

PMI Composite Index

https://www.quandl.com/data/ISM/MAN_PMI-PMI-Composite-Index

S&P 500 (^GSPC)

https://finance.yahoo.com/quote/%5EGSPC

In [26]:
%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
import io, base64, os, json, re 
import pandas as pd
import numpy as np
import datetime
import warnings
warnings.filterwarnings('ignore')

path_to_market_data = '/Users/manuel/Documents/financial-research/market-data/2019-09-30/'
In [13]:
# Load PMI data
pmi_df = pd.read_csv(path_to_market_data + 'ISM-MAN_PMI.csv')
pmi_df['Date'] = pd.to_datetime(pmi_df['Date'])  
print(np.min(pmi_df['Date'] ),np.max(pmi_df['Date'] ))
pmi_df = pmi_df.sort_values('Date', ascending=True) # sort in ascending date order
pmi_df.tail()
1948-01-01 00:00:00 2019-09-01 00:00:00
Out[13]:
Date PMI
4 2019-05-01 52.1
3 2019-06-01 51.7
2 2019-07-01 51.2
1 2019-08-01 49.1
0 2019-09-01 47.8
In [27]:
# Load S&P 500 Index data
gspc_df = pd.read_csv(path_to_market_data + '^GSPC.csv')
gspc_df['Date'] = pd.to_datetime(gspc_df['Date'])
gspc_df = gspc_df[['Date', 'Adj Close',  'Volume']]
gspc_df.columns = ['Date', 'SP500_Close', 'SP500_Volume']
gspc_df = gspc_df.sort_values('Date', ascending=True) 
print(min(gspc_df['Date']), max(gspc_df['Date']))
print(gspc_df.shape)
gspc_df.head()
1927-12-30 00:00:00 2019-10-01 00:00:00
(23046, 3)
Out[27]:
Date SP500_Close SP500_Volume
0 1927-12-30 17.660000 0
1 1928-01-03 17.760000 0
2 1928-01-04 17.719999 0
3 1928-01-05 17.549999 0
4 1928-01-06 17.660000 0
In [28]:
cut_off_date = '1948-01-01'
pmi_df_tmp = pmi_df.copy()
pmi_df_tmp = pmi_df_tmp[pmi_df_tmp['Date'] >= cut_off_date]

 
fig, ax = plt.subplots(figsize=(16, 8))
plt.plot(pmi_df_tmp['Date'], 
         pmi_df_tmp['PMI'], color='blue', label='PMI')
plt.grid()
plt.title("Purchasing Manager's Index (PMI) Composite Index")
plt.legend(loc='upper left')

plt.axhline(50, color ='black')
Out[28]:
<matplotlib.lines.Line2D at 0x1219f8390>
In [31]:
cut_off_date = '2000-01-01'
pmi_df_tmp = pmi_df.copy()
pmi_df_tmp = pmi_df_tmp[pmi_df_tmp['Date'] >= cut_off_date]

 
fig, ax = plt.subplots(figsize=(16, 8))
plt.plot(pmi_df_tmp['Date'], 
         pmi_df_tmp['PMI'], color='blue', label='PMI')
plt.grid()
plt.title("Purchasing Manager's Index (PMI) Composite Index")
plt.legend(loc='upper left')

plt.axhline(50, color ='black')
Out[31]:
<matplotlib.lines.Line2D at 0x1218b35c0>
In [24]:
cut_off_date = '2006-01-01'
pmi_df_tmp = pmi_df.copy()
pmi_df_tmp = pmi_df_tmp[pmi_df_tmp['Date'] >= cut_off_date]
gspc_df_tmp = gspc_df.copy()
gspc_df_tmp = gspc_df_tmp[gspc_df_tmp['Date'] >= cut_off_date]
 
fig, ax = plt.subplots(figsize=(16, 8))
plt.plot(pmi_df_tmp['Date'], 
         pmi_df_tmp['PMI'], color='blue', label='PMI')
plt.grid()
plt.title("Purchasing Manager's Index (PMI) Composite Index")
plt.legend(loc='upper left')

plt.axhline(50, color ='black')

ax.twinx()
plt.plot(gspc_df_tmp['Date'], 
         gspc_df_tmp['SP500_Close'] , color='red', label='S&P 500')
plt.legend(loc='lower left')
Out[24]:
<matplotlib.legend.Legend at 0x123279048>

Show Notes

(pardon typos and formatting -
these are the notes I use to make the videos)

The ISM Manufacturing Index also referred to as Purchasing Manager's Index (PMI), is down almost across the board. Let's download the raw data, breakout a Jupyter notebook and check this out for ourselves. The ISM/PMI is an economic number released monthly that hovers around a 50 line. Above means the outlook of the economy is expanding, below, contracting.