Dashboard update: Inaction has reactions

Dashboard PDF file:

Macro and Markets Dashboard: United States (April 30, 2016 — PDF)

Dashboard update summary:

Markets closed down slightly on the week following inaction from both the Fed and Bank of Japan. Oil and Yen both still became five percent more expensive in dollar terms. Advance estimate 2016 Q1 real GDP growth was weak at 0.6 percent, but in line with expectations. Labor markets continue to be a bright spot, with eyes on next Friday’s April jobs report.

rgdpgrowth_apr302016

Real GDP ticked up 0.6 percent in log terms in the first quarter of 2016. Personal consumption expenditures and residential fixed investment helped to keep GDP growth positive despite a decrease in nonresidential fixed and inventory investment, and growth in the trade gap. The personal savings rate also increased slightly, in quarterly terms, to 5.2 percent in Q1 from 5.0 percent the previous quarter.

FOMC meeting statement changes are kindly highlighted by the Wall Street Journal and include removal of the language about global risks and, some suggestion in my view, based on labor market growth, household income, and consumer sentiment, of a June rate hike. This would depend on continued labor market strength and price pressure plus an upward revision of Q1 GDP.

pcecomp_apr302016

Personal consumption expenditures (PCE) continued to increase in Q1, led by higher spending on services. However, monthly data on PCE as a share of GDP decreased slightly in March over its February level. PCE on durable goods as a percentage of GDP was also down slightly in March, to 7.3 percent from 7.4 percent in February.

Labor market data continues to be spotless. The weekly 257,000 new jobless claims is still near the multi-decade low. Next Friday is jobs day. Both the labor force participation rate and wages should continue to improve.

nasdaq_apr302016

Disappointing earnings data from Apple includes the first decline in iPhone sales nearly since its introduction and a slowdown in sales in China. This hit the Nasdaq particularly hard, as the composite index was down 2.7 percent while the S&P 500 and Dow Jones industrial average fell 1.3 percent each during the week.

oil_apr302016

Oil prices still managed to climb five percent over the past five days. West Texas Intermediate (WTI) crude oil was trading above $46 a barrel at several points during the week. Two recent stories reminded me how oil price fluctuations cause enormous transfers of wealth between countries. Jamaica was praised in this week’s Alphachat series on sovereign debt, while noting that their recent fiscal fortune is aligned with lower prices on their fuel imports. Likewise, a recent IMF publication noted that oil exporting economies in the middle east and central Asia have enacted powerful fiscal stimulus measures to keep their economies moving while they suffer the oil revenue slowdown. Those who believe in the resource curse might note that government measures to shift the economy away from oil are both important and difficult to achieve.

Lastly, the Yen had a volatile week, closing with a five percent appreciation against the dollar. The Brazilian real appreciated nearly four percent during the week, the Swiss franc and Turkish lira appreciated nearly two percent each, the pound sterling nearly one and a half percent and the Canadian dollar nearly one percent.

The full dashboard is here: Macro and Markets Dashboard: United States (April 30, 2016 — PDF)

Advertisements

Dashboard update: oil rally

Dashboard PDF file:

Macro and Markets Dashboard: United States (April 23, 2016 — PDF)

Dashboard update summary:

Oil prices continue to play a dominant role in other markets’ movements. As mentioned in previous updates, corporate earnings expectations are depressed, so even dismal performance (GS Q1 earnings fell 60% for example) can lead individual stocks higher. However, recovery in energy and commodity markets pushes investors from uncertainty-safe investments into riskier pools. This past week was relatively quiet on the macroeconomic data side, and market volatility was low, however, next week offers both Q1 GDP first estimates and an FOMC meeting, and volatility may tick back up.

While Doha talks set expectations for a fall in oil prices, markets actually pushed prices up by 8.4% during the past week (as measured by front-month contracts of WTI crude). Analysts expected further downward pressure from labor strikes in Kuwait, however, prices continued to climb, suggesting we may be on the other side of the bottom. WTI closed at $43.73 on Friday (see below).

oil_apr232016

Yields on U.S. treasuries of various durations climbed during the week. Two-year treasury bond yields were up to 0.84 percent, more than 13 percent above their previous week level. Ten-year treasury yields climbed more than seven period during the week. Corporate bond yields fell during the week, from the AAA level to the junk-bond level.

Equities were mixed on the week, with the Nasdaq down six-tenths of a percent following disappointing earnings at Google, and the Dow and S&P 500 up a hair more than half a percentage point, each.

twoten_apr232016

Exchange rates also continue to fluctuate from week-to-week. The pound sterling appreciated by more than a percent against the dollar, the Canadian dollar by more than two percent, and the Rand by more than 2.5 percent. Meanwhile, the Yen depreciated by more than 1.3 percent against the dollar during the one-week period. The Euro-dollar spot rate was unchanged on the week.

fx_apr232016

 

Dollar-indices: hitting recent lows (and how to plot with Python)

While the dollar has depreciated against most major currencies over the past month (notably 4.4% against the Canadian dollar, 3.3% against the Yen, 4.2% against the Real, and 8.6% against the Rand), the Fed H.10 release provides measures of exactly how much the value of the greenback has fallen relative to a weighted set of its trading partners. The latest data show that the U.S. dollar has fallen on April 12 to its lowest level since June 2015 compared to other major currencies, and its lowest level since October 2015 compared to a broad index of currencies.

This post covers the trade-weighted dollar and is split into two segments: a description of the index and its recent behavior, and a short python script showing how you can use the pandas and matplotlib libraries to retrieve the time series and plot it.

Two trade-weighted dollar indices, described

The Fed’s two most common trade-weighted indices of the foreign exchange value of the U.S. dollar are the major-currencies index and the broad-index. Both measure the value of the dollar relative to other countries’ currencies and intend to be aligned, through their weighting system, with the currencies closely related to U.S. trade patterns. The broad index, however, covers more currencies, and especially more emerging market currencies.

Discrepancies between even the broad index and the way the dollar is actually traded are inevitable. For example, the broad index weight in 2016 for Canada is 12.664 percent (broad index weights are updated yearly), whereas year-t0-date, 15.2 percent of total U.S. trade has been with Canada. From a share-of-total-U.S.-trade perspective, the broad index is somewhat overweight the Yuan, Euro, and Yen, and underweight the Canadian dollar and Mexican peso.

dtwexm_apr152016
The major currencies index contains fewer currencies than the broad index, and has fallen to a 22-month low. (plot from dashboard)

From 2005 through 2015, the major currencies index remained largely within a range of 70-85. After a steep climb through 2015, in January, the measure peaked at 95.8, to the frustration of U.S. exporters whose customers essentially pay more for the same goods (and as a result buy fewer). On April 12, the major currencies index hit its lowest level since June 2015.

Meanwhile, the broad index has moved in the same direction, hitting a five month low on April 12. The plot of the broad index is below, including how to obtain it. You can substitute DTWEXB with DTWEXM if you are interested in the major currencies index.

Python: Retrieve and plot the trade-weighted dollar

Next we show how Python can be used to gather and plot data on the Fed’s broad index of the foreign exchange value of the dollar. The script gathers data from Fred and plots each business day’s index value since the start of 2014.

Gathering data

First, we import pandas, numpy, and matplotlib and give them conventional short names. We will also use datetime and date.

In [1]:
# Import libraries
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
%matplotlib inline
import datetime
from datetime import date

Next, we use the pandas.io.data package to request the data from Fred. I’ve found the code for our series of interest, DTWEXB, by searching, but you can also find it on the Fred site by source (Board of Governors of the Federal Reserve System), or by release (H.10). We paste the series code into the datareader and provide start and end dates. Pandas retrieves the data into a dataframe.

In [2]:
import pandas_datareader.data as webdata
tstart = datetime.datetime(2014, 1, 1)
#retrieve trade-weighted dollar data from fred
dtwexb = webdata.DataReader("DTWEXB", "fred", tstart);
#display five most recent observations
dtwexb.tail(5)
Out[2]:
DTWEXB
DATE
2016-04-11 119.4527
2016-04-12 119.2860
2016-04-13 119.6278
2016-04-14 119.6472
2016-04-15 119.6701

When was the last time the measure was as low as its April 12 value?

In [3]:
print dtwexb[119.29>=dtwexb].dropna().tail(2)
              DTWEXB
DATE                
2015-10-21  119.1786
2016-04-12  119.2860

Line plot of data

Lastly, we can use matplotlib to plot the data.

In [4]:
#Create figure and plot dtwexb
fig = plt.figure(figsize=[7,5])
ax1 = plt.subplot(111)
line = dtwexb.DTWEXB.plot(color='blue',linewidth=2)

#Add a title
ax1.set_title('Trade-Weighted U.S. Dollar, Broad Index (1997=100)', fontsize=15)

#Add y label and no x-label since it is dates
ax1.set_ylabel('Index')
ax1.set_xlabel('')

#Axis options
ax1.spines["top"].set_visible(False)  
ax1.spines["right"].set_visible(False)  
ax1.get_xaxis().tick_bottom()
ax1.get_yaxis().tick_left()
ax1.tick_params(axis='x', which='major', labelsize=8)
ax1.yaxis.grid(True)

#Annotate with text
fig.text(0.15, 0.85,'Last: ' + str(dtwexb.DTWEXB[-1]) \
         + ' (as of: ' + str(dtwexb.index[-1].strftime('%Y-%m-%d'))\
         + ')');
url = 'https://research.stlouisfed.org/fred2/series/TWEXB'
fig.text(0.05, 0.025, 'Source: ' + url)
fig.text(0.65, 0.16, 'briandew.wordpress.com')

#Save as png
plt.savefig('dtwexb.png', dpi=1000)
dtwexb
The broad index hit a five-month low on April 12.

Dashboard update: lowered expectations

Dashboard PDF file:

Macro and Markets Dashboard: United States (April 16, 2016 — PDF)

Dashboard update summary:

Much of the past week’s macroeconomic news offered disappointment, yet markets dismissed the weak data as a result of what seems like lowered expectations. Retail sales, business inventories, and industrial production reports showed weakness in March (though labor market continues to look good). Corporate earnings have been quite soft in the first quarter, and GDP figures are likely to reflect the first quarter slowdown in output. Investors, however, seem relatively more risk-on, despite the weak macroeconomic data. Their expectations about earnings have fallen low enough to not only absorb the recent results, but to react positively in some cases. These investors are also faced with fewer high-earning alternatives, given sluggish and slowing growth abroad.

CPI and PPI data show little change, while oil prices continue to rebound. Currency markets are quite active, especially on the emerging markets side, where the dollar is weaker, partially as a result of the commodity price rebound.

Macro and Labor Market Indicators

Industrial production and total capacity utilization both fell in March. The industrial production index was down 0.6 points, largely stemming from decreases in production in mining and utilities market groups. This was magnified in the total percentage of capacity utilized figure, which fell to its lowest level since 2010. Mining capacity grew 1.6 percent year over year, despite a simultaneous 12.9 percent fall in production.

tcu_apr162016

The inventories to sales ratio ticked up in February, as a result of a fall in sales of 1.4 percent and an increase of inventories by 1.2 percent over their February 2015 levels. The most recent week’s data on new jobless claims showed the fewest new claims since 1973.

Equities and Fixed Income

Despite the weak data from the corporate side, equity markets were up and corporate bond yields down during the week. The Nasdaq and Dow were up 1.8 percent on the week, while the S&P 500 climbed 1.6 percent. Yields on U.S. Treasury bonds at all maturities, and U.S. corporate bonds at all maturities and credit ratings, have fallen over the past month, pushing prices higher.

Prices and Currency Markets

This week brought the release of March PPI and CPI data. Both were largely unchanged, as the PPI for all commodities increased slightly and the CPI fell slightly, over their February year over year percentage change levels. There was a surprise in CPI apparel prices, which fell 0.6 percent over their March 2015 levels, despite an increase in February. The data continue to reflect the very low prices of energy and moderate prices increase in healthcare and housing.

prices_apr162016

Currency markets were busy during the past week. The dollar strengthened against the Euro (0.91 percent), Yen (0.81 percent), and Swiss Franc (1.06 percent), while, as pointed out by FT’s hard currency, the dollar weakened further against the four R’s, the ruble, real, ringgit, and rand. These four currencies have seen a dramatic change in direction over the past month, appreciating against the dollar by more than 3.5 percent each and more than 5 percent in the case of the rand.

Note:

I try to gradually improve the dashboard and how I summarize changes. Any feedback would be much appreciated. Please feel free to leave a comment, or send me an email at brianwdew@gmail.com.

Dashboard update: signs of price pressure

Macro and Markets Dashboard: United States (April 9, 2016 — PDF)

The first full week of April saw active but net slightly down equity markets. While new economic data during the week was positive, expectations about corporate profits and output levels in the first quarter of 2016 are low. In light of solid fundamentals, and increasing aggregate demand, pessimists (including on the campaign trail) seem to be overreacting. Price data shows signs of upward pressure after an extended decline, and may soon join labor market and equity market indicators in signalling accelerating economic expansion.

The Nasdaq composite index fell 1.3 percent on the week, while both the S&P 500 and the Dow Jones Industrial Average fell 1.2 percent. Volatility, as measured by the VIX, closed Friday 17 percent above its previous week level. The Shiller index of price to earnings ratios climbed in March to 25.5. Expectations about first quarter earnings are very weak.

pe_apr092016

Prices data showed a continuation of upward pressure in March from commodity and food prices. Oil prices climbed more than eight percent during the past week. U.S. oil inventory fell for the first time in eight weeks. March CPI data, due out next week, should reflect the rising fuel and commodity prices.

wti_apr092016

World food prices, measured by the Food and Agriculture Organization of the UN, showed an uptick in March from a jump in sugar prices. This is only the second material increase in the world food price index since early 2014.

ffpi_apr092016

The trade-weighted dollar index continues to show a depreciation in the U.S. dollar. To the frustration of the Bank of Japan, the Yen appreciated nearly three percent against the dollar during the past week, which is not included in the lagged trade-weighted index. The dollar did appreciate against many emerging market currencies, pound sterling, and the Canadian dollar, during the past week.

fx_apr092016

Oil Price Data with Python

This example shows how Python can be used to take a look at oil prices. The script gathers daily oil price data from Quandl and plots how the price has changed over the past few months.

Gathering data

First, we import pandas, numpy, and matplotlib and give them conventional short names.

In [1]:
# Import libraries
import pandas as pd
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
%matplotlib inline

Next, we identify the url for our data. In this case, the data is provided by Quandl and the url can be obtained by clicking ‘csv’ under the API for any series on the right-hand side of the page. We read the CHRIS CME_CL1 csv file provided by Quandl into a pandas dataframe.

In [2]:
# Import from Quandl WTI crude oil price data
url = "https://www.quandl.com/api/v3/datasets/CHRIS/CME_CL1.csv"
wticl1 = pd.read_csv(url, index_col=0, parse_dates=True)
wticl1.sort_index(inplace=True)
wticl1_last = wticl1['Last']
wticl1['PctCh'] = wticl1.Last.pct_change()

Line plot of oil price

Lastly, we can use matplotlib to generate a line plot showing the most recent 68 days worth of closing prices for WTI crude front month contracts. The past week has seen this measure of oil prices reach nearly $40 per barrel.

In [3]:
fig = plt.figure(figsize=[7,5])
ax1 = plt.subplot(111)
line = wticl1_last.tail(68).plot(color='red',linewidth=3)
ax1.set_ylabel('USD per barrel')
ax1.set_xlabel('')
ax1.set_title('WTI Crude Oil Price', fontsize=18)
ax1.spines["top"].set_visible(False)  
ax1.spines["right"].set_visible(False)  
ax1.get_xaxis().tick_bottom()
ax1.get_yaxis().tick_left()
ax1.tick_params(axis='x', which='major', labelsize=8)
fig.text(0.15, 0.85,'Last: $' + str(wticl1.Last[-1])\
         + ' (as of: ' \
         + str(wticl1.index[-1].strftime('%Y-%m-%d'))\
         + ')');
fig.text(0.15, 0.80,'Change: $' + str(wticl1.Change[-1])\
         + '; ' \
         + str((np.round((wticl1.PctCh[-1] * 100), \
         decimals=2))) + '%')
fig.text(0.1, 0.06, 'Source: ' + url)
fig.text(0.1, 0.02, 'briandew.wordpress.com')
plt.savefig('oil.png', dpi=1000)
oil

Dashboard update: green shoots in March

Macro and Markets Dashboard: United States (April 2, 2016 — PDF)

The final week of March capped off a month of solid equity market gains and encouraging macroeconomic data. New data shows a continued strengthening of labor markets and a reduction in volatility. Bond yields fell during the week, and the dollar depreciated against most major currencies.

All three major U.S. equity market indices were up more than 6.5 percent on the month, while the Nasdaq composite index climbed nearly three percent during the week ending April 1. Volatility, as measured by the VIX, fell to its lowest level since August 2015. Indeed, nearly all major U.S. asset classes posted gains during the month, following a bearish January and February. West Texas Intermediate (WTI) crude oil prices jumped 13.6 percent in March, though they declined more than 2.5 percent during the most recent week.

manpmi_apr022016

Manufacturing Purchasing Managers Index (PMI) data for March from the Institute for Supply Management (ISM) suggests improvement in manufacturing conditions (see above chart). The PMI, which can be thought of as the weighted percentage of purchasing managers who report positively (above 50 suggests growth), posted its first increase in six months. As a bonus, this monthly report comes with possibly the most pithy explanation accompanying any statistic:

PMI® at 51.8%

New Orders and Production Growing
Employment and Inventories Contracting
Supplier Deliveries Slower

The U.S. economy added 215,000 jobs in March, while unemployment figures ticked up slightly to five percent. However, as evidenced in the dashboard and in previous posts, an increase in the labor force participation rate tells a more complex story than an increase in the unemployment rate. A strong labor market will attract people who are otherwise not participating (someone without a job but not looking for work is not considered unemployed under the headline unemployment figure from the BLS). The labor force participation rate has experienced its first six consecutive months without decline since 2005, as people are being drawn into a decent labor market.

unemp_apr022016

Across the board, U.S. bond yields fell during the past week. The real yield curve on a five-year U.S. treasury pushed negative, reaching further than a quarter point into the red (see below). The yield on a ten-year treasury fell to 1.79 percent on Friday, from 1.91 a week earlier. Corporate bond yields in all credit segments were also down during the one-week period.

fiveyearrealyield_apr022016

Touching on some additional data, personal and personal disposable income both increased by 0.2 percent in February. The personal savings rate ticked up to 5.4 percent in February, from 5.3 percent in January. As expected, the net international investment position of the United States continued to deteriorate in Q4 of 2015. The economic policy uncertainty monthly index fell nearly 22 percent in March, providing further evidence for a reduction in uncertainty-related volatility.

Lastly, over the past week the U.S. dollar depreciated against all major non-pegged currencies. Notably, the greenback weakened by more than two percent against the Swiss franc and Canadian dollar, more than one and a half percent against the Yen, and around one percent against the Yuan during the five-day period.

Machine reading IMF data with Python: an example

UPDATE June 16, 2016: The IMF API has changed. My updated tutorial is here:

https://briandew.wordpress.com/2016/05/01/machine-reading-imf-data-data-retrieval-with-python/


Download PDF Example – Machine Reading IMF Data with Python

During the past 18 months, the International Monetary Fund has made all of its data available free-of-charge, and developed an API to allow access to data. This means data from sources such as International Financial Statistics (IFS) can be collected without the need for manual download.

I’ve written a crude example using Python. The example retrieves IMF Direction of Trade Statistics to show the declining U.S. share of world exports and the rapid rise of China’s export-led economy.

imf_api-Copy1_26_0

If you are getting started with Python for economic research, I recommend the free version of the Enthought Canopy deployment, which integrates several useful tools.

Dashboard update: recent economic data

Macro and Markets Dashboard: United States (March 19, 2016 — PDF)

As expected, the Fed left key interest rates unchanged. New economic data covering prices, industrial production, jobless claims, and inventories did not offer any dramatic surprises. Equity markets were up on the week, while treasury bond yields fell. The dollar weakened against nearly all major currencies.

Markets reacted positively to the Fed’s key interest rate decision and reduction of their forecast for 2016 rate hikes to two from four. The Nasdaq composite index increased one percent on the week, while the S&P 500 climbed 1.35 percent. Ten-year treasury bond yields fell to 1.88 percent on Friday.

Monthly CPI figures for February showed a year over year consumer price level increase of one percent, compared with a 1.3 percent increase in January. Energy and transportation costs fell more in February than January. Energy costs dropped 12.7 percent over their February 2015 level, while transportation costs fell 3.6 percent over the one-year period.  Healthcare, food, housing, and apparel prices all increased over the previous year’s level. Healthcare costs were up 3.5 percent.

cpi_mar192016

The industrial production index and total capacity utilization figures were both down slightly in February, following a modest increase in January.

iptcu_mar192016

New weekly jobless claims, at 265,000, showed no sudden increase, further supporting the so far solid labor market data. January data on manufacturing and trade inventories and sales, from the U.S. Census Bureau, showed that sales were down 1.1 percent over their January 2015 level, while inventories were up 1.8 percent over the same period, pushing the inventories to sales ratio to 1.4.

jobinv_mar192016

Over the past week, the U.S. dollar weakened against all major currencies except for the Egyptian pound, which was devalued by 14 percent against the dollar during the week. The dollar fell roughly two percent or a bit more against the Euro, Yen, and Canadian Dollar, and nearly a percent and a half against Pound Sterling and Swiss Francs. The dollar fell against the Yuan by nearly three quarters of a percent on Friday.

fx_mar192016