Ode To The BitMex Swap

Ever since I was four years old “making up videogames in my head”, the aesthetics of algorithms have been something I listen for. Whether it’s a fractal screensaver, a strategy game about nuclear war that’s balanced to make you experience self-horror at optimally psychopathic behavior, or Darius Kazemi’s satirical meme bots populating Twitter, there can be something distinctly beautiful about system designs and their dynamic run-time results. This is a young artistic meta-discipline with some academic tradition, a few waves of indie game design, and some hipster visual artists bleeding it onto the fringes of the mainstream, it seems likely from my extremely biased point of view that this is going to dominate 21st century art. Probably well-done CG characters in recent film would be an ok example of this in the mainstream, but the decidedly non-interactive + static-inputs nature of that algorthmic art relegates is to the shallow end of the pool of possibility.

Some years ago I left the videogame industry because, well, mostly I got burned waiting on Kris Jenner to sign a name and likeness license. Yes I was that much of a sell-out. I was young and didn’t have a cryptocurrency portfolio. Since then I’ve been in fintech — blockchain fintech — one buzzword away from a structural collapse into decoherence. Where is the art in this industry? Where is the delicately intricate, almost artistic, system design? Could a financial instrument that affects the lives of millions of users also be a sort of massive art project? Andre Breton might say yes though if he were alive today he’d be too occupied with the implications of public shootings.

Columbine… so surreal.

The one thing out there that I’ve found to be both financially useful, and also an algorthmic work of design excellence, is the Bitcoin/Dollar Swap contract that trades on BitMex. BitMex is an exchange based in Hong Kong, started by some decent dudes who worked in finance, yada yada, unit-tested clearing engine operating well under capacity with real-time auditing, manually reviewed withdrawals once a day from a multi-sig, they check the basic boxes. The site isn’t available to US persons because the CFTC claims jurisdiction on derivative contracts of commodities, which is how they classify Bitcoin and other virtual currencies. But what launched the site into being one of the top dollar based exchanges for Bitcoin wasn’t just doing the basics well, they also innovated.

“What the hell is a swap anyway?” — Leo Melamed, co-founder of the CME

If you understand swaps, you can begin to understand the last 30 years of finance. Why? Because banks use swaps to create money internationally and that money has driven the booms and busts.

Unlike normal plebes, who deal in either having money or being broke, banks get to dip into negative numbers, they have a license for it. So if I want a global payment from country A to country B, banks have to shuffle negative numbers around to make a positive one appear in a different currency. They have accounts and credit lines with each other — called correspondent banking — to clear payments, and they can enter into a foreign exchange swap contract to make a negative number in one currency check out as a positive number in a different currency. If that sounds like magic, keep in mind that the major difference between a magician and a conman is that the magician is paid at the door.

Think of a stock, you buy some with some currency, it goes up, you sell it, now you have more currency. It goes down, you hold it, assuming the company doesn’t go bankrupt, it’s still going to be there in a year or five — if you must get the cash back you can sell it lower and have less cash. These things change price all the time as people buy and sell, it’s kind of like a videogame, most people get this as it’s become a huge part of American culture since the e-Trade baby showed us what-for in 1998. In other countries, where the idea of owning a portfolio of equities is as alien as drive-through fast food, people still get this.

Now, a futures contract is like making that bet on something going up, but you only need to put 10% or 5% down. But if you only bring 5%, then a 5% drop will wipe you out, a 5% rise will double your grubstake. Futures are a little weird in that they have an expiration date, so your ability to take that bet has a time horizon, and they’re useful because you can easily take the opposite bet, that prices will drop, without some awkard borrowing of shares. The value of being able to take the bet is sometimes manifested in a difference between the price of the thing you’re betting on and the price of the bet itself, this difference is called the “premium”, and if you have the thing itself, and you bet against it equally, you lock in the dollar value of your thing *plus* the time value of that premium accruing to you between now and the expiration date. But why is the other guy, betting it’ll go up, providing the money to underwrite your risk, paying this premium? Because it’s basically like borrowing money. Remember, money is based on negative numbers against positive numbers, time-value, and sleights of hand.

The reason these contracts exist is because farmers needed to protect the value of their wheat and corn harvests. With thin margins due to bank interest, Monsanto chems, John Deere trapping you with terms and conditions, farmers needed to be able to lock in prices when they are high enough to assure them a profitable year. Nothing worse than working hard on your own small business just to lose money. Surely we can all get down with helping farmers.

The magical moment comes when the farmer who has hedged his wheat harvest with an October contract way back in March realizes that he has transformed a physical thing into basically a dollar savings account that is earning him the contract premium over the intervening 7 months.

Stock photo farmer likes money

If it’s possible to use a contract to turn something boring and real into something fun and imaginary, such as wheat → synthetic savings account, then why not go further and turn something fun and imaginary into something even more fun and more imaginary. This is where interest rate swaps come in.

A swap is like a future in that you go long or short, you pay/get-paid as the thing goes down or up. So you could imagine an interest rate swap as a bet on interest rates. But like, what about interest rate futures? Those exist, those are a straight bet on rates going up or down. What makes a swap special is that it also has this game mechanic of making the two parties make little payments between each other every so often.

Here’s an example: I’m a city’s comptroller who doesn’t know any better, and I’m worried about the risk of interest rates going up, making it more expensive to borrow in the future, so I make a contract with Goldman Sachs where I pay them a fixed rate and they pay me a variable rate. Now interest rate risk is Goldman Sachs’ problem, I just hedged it! Instead of hedging my wheat, I’m hedging my indebtedness. Then Goldman and other major banks who own the Fed have it continue this post-Kissinger-with-the-gold-selling-the-Arabs-on-petrodollar trend of ever lower interest rates. Now my rate is higher than Goldman’s and the city’s budget includes some interest for tentacle monster. If I wanted to pull the plug and get out of the swap, it would be just like if I had took a massive red number bath on interest rate futures; but hedgers just hold their contracts usually to keep the stability. So here the city is paying interest to Goldman for years and years. Here’s another example to reinforce.

This is what a multi-decade ponzi looks like. It keeps going like this for the next 20 years.

At a bigger scale, these interest rate swaps are what lent (pun very much intended) a false sense of security to all the socialist governments of the world, who contrary to Magaret Thatcher’s dictum, always seem to be able to borrow more money from capitalist financial corporations.

Those hundreds of trillions in derivatives? Mostly interest rate swaps. Then FX swaps; credit default swaps which got so much fun attention in 2008 are actually a relatively small piece of that pie. By hedging interest, the confidence is made to lend tons of new money into existence. By hedging foreign exchange rates, you can synthetically create new “dollars”. The supply of these “dollars” acts like meth on small economies and then they get “unwound” and vanish from existence just when you need them. Predictably, these economies then “need to crash” for a fiscal quarters just like a meth user is awake for 5 days and sleeps for 2. Money is deleted in the conventional, national banking system when people default on their loans, but since the 80s there’s been this hyperactive version affecting everyone.

The guy who co-founded the Chigaco Mercantile Exchange didn’t understand this. Bernanke and Yellen sure don’t. Most people in banking outside of Wall St. probably don’t. Now you kinda sorta do based on how effective this writing was, so… congratulations?

The BitMex guys, they understood this to enough of an extent to try and do it for Bitcoin. Bitcoin is a hyperfungible form of money issued to subsidize the security of its decentralized global ledger, it has a scarce ultimate supply, it’s not based on debt, and everyone is operating without a license. It’s been acting like a release valve for all the fiat money created over the years. BitMex took advantage of that hot money flow to tap into demand for their derivative. But it wasn’t just a copy job. This is where the design nuances come in.

First thing they did was say, ok, how the hell do we get this thing to track the price of bitcoin accurately? So they came up with something new to swaps, high frequency payments every day, then it became every 8 hours, and the payments might favor the longs or the shorts, depending on… how much the contract deviated from the index price of bitcoin. Hence, if the contract is trading under the price of bitcoin, it bakes in a payment to the longs, sweetening the prospect of taking the risk, and if the contract is so in demand that it’s trading ahead of a rising bitcoin price, then the people using it to hedge bitcoin or just bet on a drop will get paid instead. This worked well enough to keep the contract within 1% of the market, and usually within .1%. But the payments were all over the place.

So they made the math a bit more nuanced.

First they included a default interest rate based on the rates people were getting on the then top USD exchange, Bitfinex, for depositin USD and BTC and lending them to speculators on that site. However much more the USD rate was than the BTC rate would be the default rate paid to the shorts. Hence, it did a decent job of simulating the rate you might get, without requiring that you deposit all your money with them.

The next thing they did was come up with a boundary condition where if the deviation between the index and the contract price was less than +/- 0.05% on average, then the thing would just pay the shorts that reference interest rate describe above. This effectively stabilized the yield that someone shorting against their bitcoins could get, turning this “synthetic dollar” into something a bit more reliable as a savings vehicle.

Finally their day came when Bitfinex was massively hacked for a loss of over 100k BTC, which at the time was merely ~70M USD (now would be ~250M) and lots of traders decided depositing a fraction of your exposure to a site was the way to go. Bitfinex issued a debt token to everyone they bailed in (i.e. anyone who had money on the exchange at the time of the hack) and managed to pay it down from fees driven by the next wave in the bitcoin price (from $475 lows during the post-theft panic to ~$1200 six months later). Then something far worse than a massive theft befell Bitfinex — regulatory capture.

Taiwanese banks couldn’t get their wires cleared through USD correspond banks like Wells Fargo, because they were insufficiently effective at spying on their customers, especially dealing with crypto exchanges — even though doing USD wires from Bitfinex required verifying documentation for an individual, the risk that people might be running arbitrage through US banks and thus operating as unlicensed money transmitters was too much. The loss of a clear arb channel caused the interest rates on Bitfinex to get out of whack. As of this writing, there is still no broad-based fiat withdrawal option for all Bitfinex users, several months later.

See, now that you couldn’t have the USD on Bitfinex be as fungible, Gresham’s Law took over, in a less extreme way than it did with the premium on the insolvent Mt. Gox exchange years before, and people were paying more for BTC on Bitfinex than elsewhere, the price of escape. So then the demand to borrow bitcoins to short-sell went up, driving up the interest rate, well above that offered by USD. Yet, this scenario was the prelude to the next run up for the bitcoin price, from $900 to $2980. To be fair, this was largely driven by Korean and Japanese exchanges allowing new fiat liquidity to pump in and place a new population of cryptocurrency holders.

The bottom line is that this created severe disjunctions in the way the BitMex swap worked, as longs were getting paid for much of the way up, when the converse should have been true. It was like a wall of worry combined with a Gresham’s Law inversion of rates.

So the BitMex guys looked at the average USD Interest Rate- BTC Interest Rate over the last year or so, and decided to just make the default rate 0.01% per 8 hours, or 10.95% annualized.

In conclusion, the BitMex swap is actually rather amateurish from a mathy-design point of view, a few simple kludge values patched over the general chaos of these markets enough to make this a reliable product, thus snowballing their volume and open interest to make it one of the top USD-based products in bitcoin land. What’s amazing about it isn’t that they invented some smoothed out function to brilliantly streamline passive returns, what’s amazing is that they took something arcane and elite and obscured to the public by regulatory filters, and they managed to make it work with seemingly rudimentary fixes. In the process, they created a next-generation savings tool for the masses, except for US residents who are blocked thanks to CFTC/Dodd-Frank regulations. Apparently the right to hedge is not listed on the Bill of Rights, probably not what Barney had in mind when he wrote that bill.

Barney is unimpressed by this article.

The art is that it went well outside the mainstream, appropriated it, and that it works. The art is that we can decentralize banking. Ok maybe it’s not that artistic, but it’s at least as profound a statement as Duchamp signing a urinal. Oscar Wilde would say it’s disqualified from being art due to its usefulness. When millions of people are depending on the savings cashflow made possible by instruments like this, the performative beauty of this new kind of finance will be more obvious.