Category: Market

Commentary on macro and micro markets

Something Something Coronavirus

coronavirus bottle virus

I originally thought about titling this post “Obligatory Coronavirus Post” but then realized it isn’t really obligatory, is it?

I’m watching the news, articles, reactions, and memes about COVID-19 with fascination.

In early January[1] I saw a few memes like this one:

Hmmm

I laughed, upvoted, and then forgot about them.

Then on January 11th the first coronavirus death was recorded, and within a few weeks the new virus was sweeping the world (figuratively and literally).

It’s shaken the stock market, emptied grocery stores of toilet paper, and gripped our collective conscience like few other things have in recent memory.

During this time I’ve read various arguments on both sides of the “stocking up on masks and TP” debate as well as stock market and supply chain effects; this made me review my recession indicator dashboard and dividend investing strategy with some caution.

As I’ve gone through these topics, I wondered if we’re on a similar path to a broader economic recession in ~1 year as we saw in 2007-2008.

That is, it won’t be the virus that directly causes a financial crisis, but the ripple effects that surface after, when the economy is weakened- just like how the housing market’s decline set the stage for imploding derivatives and banks later on.

To illustrate: there are reports that shipping is decreasing, and areas that are heavily dependent on shipping could lay off workers since there are fewer things to unload. That ripples across the supply chain; e.g., truckers have less work since there are fewer things to ship from the boats, and other workers have less to do since they aren’t receiving shipments from the truckers, so all of the workers spend less on cars, food, clothes, etc. which results in lower demand and therefore lower profits at the companies that make those goods, so more layoffs happen and then the cycle continues…those who are laid off miss payments, loans default, and highly leveraged assets become unstable.

I’m not saying this to panic or get you to panic; instead, I’m trying to look at things logically, in part based on books I’ve read about the what lead up to the financial crisis and trying to prepare for what may happen now.

I’ll note that this time around the Fed has eased quickly (compared to 2007/2008), however given their accommodative policy over the past decade I do wonder how much that will help by itself…so prepare for more QE perhaps?

[1] The timestamp of this meme is January 4th. Uncanny.

Recession Indicator Dashboard

This is my attempt at a dashboard showing key recession indicator signals. It’s not very good.

Signals and Noise – Some Background

“Recession” became the topic of an aggressive news cycle in August 2019. I found this fascinating; in the years before the music finally stopped[1] on Lehman Day in 2008, no one forecasted the beginning of The Great Recession with a high degree of timeline specificity, so now everyone’s convinced the next one’s right around the corner?

In the months since that news cycle the stock market has repeatedly seen new highs and recession fears have faded from the foreground, and almost as quickly as the predictions of doom came they disappeared.

That makes me wonder: how could we try forecasting a recession with a high degree of timeline specificity?

There are huge caveats to this: no one can know exactly when a recession will start, how severe it will be, or how long it will last. So given those caveats, I’m interested in teasing out as much information in advance of a recession as possible while (hopefully) cutting down as much noise as possible.

Most articles from August cited only a yield curve inversion as a solid recession indicator, and didn’t note that there’s a lot more nuance involved (e.g., which yield curve(s) inverted? And for how long?) or that other signals that could be potential recession signals.

So I decided to make a recession dashboard that tracks recession indicators. My goal is to pull in this data programmatically so it’s always current, however in the interim I’ll pull it in manually where needed (the gray rows at the bottom).

Dashboard

This recession dashboard is an embedded Google Sheet that fetches updates on a daily timer, mostly from Nasdaq (you all are amazing!). The first ~dozen rows are pulled dynamically but the rest aren’t supported yet (I’m also only using the free version) so I’ll investigate pulling that data in from another data source and update the backend soon.

Breakdown of Recession Indicator Signals

I mentioned nuance and noise above, and there’s plenty of that to go along with these signals. So this is my breakdown/rationale for each one:

  • Yield Curve Inversion (10y2y): This is the classic yield curve inversion signal that blew up in August. Lots has been written about this.
  • Yield Curve Inversion: 10y3m: Potentially more reliable near-term indicator than the 10y2y.
  • Unemployment: It’s typically a lagging indicator, however weakness in employment could predict an upcoming slowdown.
  • Nonfarm Wages/Payroll: Another lagging indicator; if wages are down since people are laid off, then it can cause a downward spiral.
  • Retail Sales: Slowdowns here can ripple elsewhere.
  • Consumer Sentiment: If consumers are spooked, they’ll spend less. If they spend less, companies earn less and may lay people off.
  • Service Sector: Large amount of the US economy is this sector, so slowdowns will impact other areas.
  • Corporate earnings growth/EPS:
  • Price of oil: If it shoots up quickly or sustains elevated prices then doing business and buying things becomes more expensive, which may lead to spending slowdowns.
  • Price of copper: If it’s down it can mean that fewer materials are being purchased for things like construction
  • ISM: Below 50 means contraction, but since manufacturing makes up less of the US economy than before, typically below 40 means a recession could be coming.
  • PMI: How supply chain managers view things; below 50 means contraction but not necessarily recession
  • Cass Freight Index: If fewer shipments are being made, demand for goods or corporate spending could be down.
  • Emerging Markets: This indicates smaller countries are slowing down. Typically some bellweather countries like South Korea are an early indicator of problems.
  • Economic Policy Uncertainty Index: Could become a self-fulfilling prophecy.
  • Fed’s Excess Reserve Rate: The rate the Federal Reserve pays to banks for their excess cash reserves; down means they pay the banks less, which may indicate the Fed wants fewer excess reserves from banks in order to encourage greater liquidity in the market.
  • Goldman’s Analyst Index: Overall indication of direction
  • Bearish Sector Rotation: Are investments moving into utilities, consumer staples, real estate, and healthcare? These are typically more “safe” investments.
  • Russell 2000: If down, indicates smaller companies are slowing their growth/earnings. Typically they feel contraction before larger companies.
  • Risk spreads: Tighter spreads mean worse conditions
  • Crazy news: Uncertainty or surprises mean emotional investors will make bad decisions, and likely make bad news worse
  • Baltic Dry Index: Upward spikes indicate higher shipping costs and recession

I intend to fine tune this list over time, but for now it will suffice. If I’ve missed something or mischaracterized something let me know!

Recession Dashboard Code

Getting updates to the signals automatically is all done via Google Apps Script. I’ve set up a trigger to run the code and update the information once a day (note: most of the underlying data isn’t updated every single day, but this way updates are grabbed without having to worry about setting up monthly vs quarterly etc triggers).

I’ve also added some logic in the cells on Column E for “Up or Down” movements being good or bad omens, as well as color coding to make the chart update a lot simpler.

NOTE: You’ll see “quandl” used in the code below. That’s because when I wrote the code the source of my data was a company called Quandl; however, they were acquired by Nasdaq in September 2021. I updated the API call so it works with the new domain, but left the function and variable names the same.

Here’s the Apps Script code:

function queryQuandl(signal) {

  var APIKey = 'YOUR_KEY_HERE';
  
  var url = 'https://data.nasdaq.com/api/v3/datasets/'+ signal + '.json?limit=2&collapse=monthly&api_key=' + APIKey;
  
  // Make the request
  var response = UrlFetchApp.fetch(url);
  var contents = response.getContentText();
  var json = JSON.parse(contents);
  
  return json;
   
}

function updateData() {
  
  var sheet = SpreadsheetApp.getActive().getSheetByName("Sheet1");
  
  var numRows = sheet.getLastRow();
  
  // Get the Quandl data code
  var stockList = sheet.getRange(3, 8, numRows).getValues();
  
  for(var i=0; i<numRows-8; i++){
  
    var quandlData = queryQuandl(stockList[i]);
    
    var currentValue = quandlData.dataset.data[0][1];
    var previousValue = quandlData.dataset.data[1][1];
      
    sheet.getRange(i+3, 3).setValue(currentValue);
    
    if (previousValue > currentValue) {
      sheet.getRange(i+3, 4).setValue("Down");
    } else if (previousValue == currentValue) {
      sheet.getRange(i+3, 4).setValue("Flat");
    } else {
      sheet.getRange(i+3, 4).setValue("Up");
    }
    
  }
  
}

The updateData function grabs items from the spreadsheet, calls the queryQuandl function to get a response from Quandl, then writes the value and directional change to the appropriate cells.

Note too that you’ll need a free Nasdaq account to replace the placeholder key on line 3 with your own. Otherwise, this won’t work for you đŸ™‚

September 2021 Update: Adding an Indicator History Log

I added a new tab on the dashboard sheet called “Log” as well as new code to keep a history each day’s aggregate results so the indicators can be tracked over time.

Here’s the code for history logging:

function logSignals(){

  // Get the sheets
  var sheet1 = SpreadsheetApp.getActive().getSheetByName("Sheet1");
  var sheet2 = SpreadsheetApp.getActive().getSheetByName("Log");

  // Add a new row
  sheet2.insertRowBefore(2).getRange(1, 1, 1);

  // Set the date
  var date = new Date;

  sheet2.getRange(2,1).setValue(date);

  // Start setting up the signal logging
  // Not using this as not all signals are automatically pulled in
  //var numRows = sheet.getLastRow(); // subtract the first two rows as they aren't signals

  var signals = sheet1.getRange(3,5,16).getValues(); // the 16 would be numRows

  // Start counting the signals
  var yesSignals = 0;
  var noSignals = 0;

  for(var i=0; i<signals.length; i++){  

    if(signals[i] == "Yes"){
      var yesSignals = yesSignals+1;
    } else {
      var noSignals = noSignals+1;
    }

  }

  // Logging the signals
  sheet2.getRange(2,2).setValue(yesSignals);
  sheet2.getRange(2,3).setValue(noSignals);

  // Copy the percent formula
  var percentFormula = "=((B2/(B2+C2))*100)";
  sheet2.getRange(2,4).setFormula(percentFormula); //Copy the formula
  
}

Then add a call to logSignals(); at the end of your updateData function and you’re good to go!

2008 Correlations, Today

I added this section to highlight a few select articles I think merit more attention since they remind me of what happened in the lead-up to the 2008 financial crisis (according to “After the Music Stopped” by Alan Blinder and “The Alchemists” by Neil Irwin).

This isn’t meant to be a dump of “doom and gloom,” and I know that negative headlines are found almost everywhere you look, but there are corners of the economy I wasn’t aware of and others might not know too that could result in a similar Great Recession event:

I’ll add to this list over time, too.

Comments on my recession dashboard? Am I missing anything or misunderstanding a signal? Let me know!

[1] After The Music Stopped by Alan Blinder is an incredible (and surprisingly humorous at times) look into the before, during, and after of the financial crisis.