The Gateway to Algorithmic and Automated Trading

No Signal

Published in Automated Trader Magazine Issue 42 Q1 2017

NO SIGNAL is a regular column where we examine various snafus in the trading, particularly the automated trading world. We look at errors in application logic, mistakes by overzealous co-workers, failures in technology and temporary losses of power to both infrastructure as well as craniums. These all make for good stories that everyone can alternatively either learn from or be amused by - or both. If you have a story that you think makes for a valuable lesson or is simply funny in a facepalm moment kind of way, please get in touch with us at no.signal@trader.news. Naturally, we treat all submissions with the highest confidentiality. We are only interested in the lesson value, or in some cases the humour value, and not in identifying involved parties.

Floor to Ceiling

Numerical instability has caused big problems in the world of finance more than once. All areas of trading have been affected by calculations that were being performed 'approximately right'.

Every exchanage that wants to be taken seriously must have an index. At least that is the common perception. Thinking like the global player it wanted to be, the Vancouver Stock Exchange (VSE) introduced an index of all the stocks it traded.

And so the Vancouver Stock Exchange Index was launched in January 1982 with the initial index level set to 1,000 points.

Now this was the 1980s and things were looking pretty good for equities globally... although back then people paid more attention to established markets. For comparison, the Dow Jones Industrial Average (DJIA) was at 829 in January 1980 and finished the decade at 2740. A total return of 230% or an average return of 13% per annum.

However, north of the border, in Canada, the newly born VSE Index wasn't going up. It wasn't even going sideways. It was going down at an alarming rate. After the first year, it was down 27.5%, at 725 points. After another 11 months it made a low of almost 520. That's a 48% drop. In the meantime the DJIA rose 65% over the same period. What was happening? A number of the stocks on the VSE were hitting new highs, so why was the VSE Index making such dramatic new lows?

A few weeks of investigation in late 1983 turned up code like this:

        IndexValue = floor(1000*IndexValue)/1000
    

floor(x) is a truncation function that rounds any number downwards (towards negative infinity, e.g. 14.4 goes to 14, 1.98 goes to 1, -8.12 goes to -9 and so on).

We can see what this computation does: Every time floor() is applied, we are effectively truncating the number to three decimal places. Assuming a uniform distribution of the digit in the fourth decimal place (a reasonable assumption) this means that the Mean Truncation Error is 0.0005. That's with every calculation. An index normally ticks every time one of the underlying stocks in its basket ticks. For this particular index (in the 1980s) that was about 2,000 times a day. Which in turn led to one point being taken off the value of the index every day (on average). After nearly two years (500 trading days) the index had shed nearly 500 points, due to the improper use of the floor() function.

This was finally rectified and the index recalculated on Monday, 28 November 1983. Upon recalculation, the index jumped from Friday's close of 574.081 to 1,098.892, undoubtedly surprising many observers in the process. Note that the gain of 99 points over basically two years is a fairly modest appreciation on the order of 5% per annum. Not mind-blowing, but a drastic improvement over the previously disseminated number.

To those readers who are interested in following the interconnectedness of financial markets: there were no derivatives linked to the VSE Index. In fact, the S&P 500 Index Futures were only introduced in 1982 and the other big index future contract at the time - the MMI Futures - would not make its appearance until mid-1983.

What went wrong

What went right

  • Numerical code written without an understanding of the math involved
  • No verification of index calculations by other means
  • Problem went unnoticed for nearly two years
  • Thankfully no index-linked derivatives or similar transactions were involved

Dude... where's my dividend?

There are hundreds of different corporate action types and payment modalities around the world. Most of them are straightforward. And some of them are not.

Once upon a time there was a portfolio manager who traded a lot of stocks. At any given moment he would have open positions in hundreds of companies. He didn't really know any of these stocks and simply traded them based on technicals. Not totally uncommon, but what was remarkable was the lack of attention on daily operations. One day he noticed that he was missing many hundreds of thousands of USD in his account (he was simply eyeballing it, but because the difference had grown so large it became hard to ignore). Dividend payments (and their resulting taxation) are normally easy enough to avoid during the course of normal trading, or by structuring your holding accounts in the appropriate way. However, in this case the portfolio manager insisted that "it doesn't matter much" and just took the resulting withholding tax payments in the (treasure) chest.

Only when money goes missing do people start paying attention. Upon closer examination, it turns out there were some large dividend payments missing. Where had they gone? To make matters more confusing, the account had been charged withholding tax for the large dividend payments in question. But the dividend in question was nowhere to be found.

Taxes on dividend are a common occurrence. In many jurisdictions, part of an income stream is withheld as tax at the source. And if it's not, dividend payments still make their way onto a corporation's or individual's tax return. However, there are exceptional circumstances that result in the tax being applied even if there is no real income earned. This was one such situation.

The normal chain of events for dividends is:

The normal chain of events for dividends

Normally, there is a delay between the record date and the pay date of a few weeks. Dividends are usually low single digit percentages of a stock price (plus, in the US they are normally paid quarterly, thus further reducing the value of regular dividends). The implied cost by a delay of a few weeks on a 0.5% dividend is maybe measured in one or two basis points, hardly worth worrying about.

For large dividends in the US, the stock exchanges operate a different model. In the case of a large dividend (say 10% of the value of the underlying stock), the stock exchange follows something called 'due-bill trading'. In this process, the ex-dividend date gets moved further out (closer to the pay date or even on the pay date itself).

This means, though, that the owners of the stocks that have settled on record date are possibly not the owners any more by the time this postponed ex-date rolls around. The astute reader will say: "Wait... would that not imply you can collect the dividend because you are owning the stock on record date and then it doesn't go ex, so you can just sell it and you keep the dividend? Free money?!"

That would indeed be free money. So, to get around this problem the stock exchanges engage in due-bill trading. This is something that is pretty much invisible to the normal account holder. What it means is that if you sell your stock between the official company record date and the new second record date you issue a so-called due bill along with the sale of your stock. So when you hand over your stock, you also hand along a piece of paper that says: "I will forward you on the dividend that I receive." In other words, even though the corporation will send you the dividend, if you sold your stock in this period, you have to pass it on to the new buyer. This procedure lasts until the ex-dividend date. And then things go back to normal.

Mind that this is a practice the stock exchanges operate, not the corporations themselves. They only set the dividend amount, the record date and the pay date - that's it as far as they are concerned.

Okay, you may say, apart from making America great again as far as the trading of dividend paying stocks is concerned... why does this really matter? It matters if you are subject to tax on dividends - which most investors are. The IRS levies taxes on dividends on the holders on the corporation's record date. The fact they have transfered the cash flow in the dividend with a due-bill to a third party in the meantime is irrelevant to them. This is known as "Revenue Ruling 82-11" and it is quite clear on this matter: If you receive the dividend from the corporation, you have to pay tax (either withholding tax, if you are foreign, or counting it on your tax return). However, you will not receive the dividend, because you have transfered that on to someone else.

Because the due-bill trading process is created precisely when dividends are large, withholding taxes will also be large. If the dividend is 30% of the stock, then the taxation implication might be 30% on it again (standard US withholding tax rate on US dividends at the moment). So you might easily incur a loss on 9% of the position if you happen to sell your stock between the official record date and the actual ex-date. In these potentially long periods (eight weeks), there is big risk of a high-dividend scenario with an attached due-bill trading period. This risk is further compounded by the fact that the companies that usually pay such high, one-off dividends are the more obscure small caps or mid caps that are not on most people's radar.

What went wrong

What went right

  • No understanding of dividend taxation issues
  • No monitoring of dividend flows, financing costs or non-standard corporate actions by portfolio manager
  • Nothing (lesson learned... maybe)