{"id":8985,"date":"2018-08-09T20:09:12","date_gmt":"2018-08-09T20:09:12","guid":{"rendered":"https:\/\/davidgerard.co.uk\/blockchain\/?p=8985"},"modified":"2019-04-22T00:36:07","modified_gmt":"2019-04-22T00:36:07","slug":"the-okex-margin-trading-disaster-doing-what-crypto-margin-trading-usually-does","status":"publish","type":"post","link":"https:\/\/davidgerard.co.uk\/blockchain\/2018\/08\/09\/the-okex-margin-trading-disaster-doing-what-crypto-margin-trading-usually-does\/","title":{"rendered":"The OKEx margin trading disaster \u2014 how crypto margin trading goes wrong"},"content":{"rendered":"<p>The price of Bitcoin dropped 7% on Tuesday 31 July\u00a0\u2014 and a large margin trade on Hong Kong&#8217;s OKEx cryptocurrency exchange went so badly that the trader not only blew their margin, they lost more money on the trade than they had put up as collateral.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/davidgerard.co.uk\/blockchain\/2018\/08\/09\/the-okex-margin-trading-disaster-doing-what-crypto-margin-trading-usually-does\/okex-logo\/\" rel=\"attachment wp-att-9147\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-9147\" src=\"https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/2018\/08\/okex-logo.png\" alt=\"\" width=\"545\" height=\"194\" srcset=\"https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/2018\/08\/okex-logo.png 545w, https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/2018\/08\/okex-logo-300x107.png 300w\" sizes=\"auto, (max-width: 545px) 100vw, 545px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3>Margin trading<\/h3>\n<p><a href=\"https:\/\/www.investopedia.com\/university\/margin\/margin1.asp\">Margin trading<\/a> is when you borrow to multiply the effect of your trading \u2014 so rather than just having $100 to trade with, you can borrow and trade with $200, using the $100 as collateral. If your trade pays off, you\u2019ve done really well!<\/p>\n<p>If your trade <em>doesn\u2019t<\/em> pay off\u00a0\u2014 or even if the price dips enough that it looks like it won\u2019t pay off\u00a0\u2014 the lender forces you to liquidate the whole position and pay them back immediately, and you lose your collateral.<\/p>\n<p>Crypto prices are <em>ridiculously<\/em> volatile. Volatility attracts traders, but anyone who trades cryptos on margin is exceedingly foolish \u2014 you&#8217;ll get margin-called <a href=\"https:\/\/twitter.com\/bitmexrekt\">remarkably often.<\/a><\/p>\n<p>But margin trading on cryptos is incredibly popular\u00a0\u2014 because too often, there&#8217;s only a fine line between &#8220;crypto trader&#8221; and &#8220;gambling addict.&#8221;<\/p>\n<h3>How OKEx futures work<\/h3>\n<p>OKEx offers its own <a href=\"https:\/\/support.okex.com\/hc\/en-us\/articles\/360000247011-Introduction-to-Futures-Contract\">futures contracts<\/a> on the price of Bitcoin. These are in units of USD$100, but are settled by delivery of the bitcoins to the trader&#8217;s OKEx account. The contracts run weekly, closing 16:00 Hong Kong local time (HKT) every Friday. Margin is 10\u00d7 or 20\u00d7.<\/p>\n<p>(These are completely unrelated to the <a href=\"https:\/\/www.cmegroup.com\/trading\/equity-index\/us-index\/bitcoin.html\">CME<\/a> or <a href=\"http:\/\/cfe.cboe.com\/cfe-products\/xbt-cboe-bitcoin-futures\">CBOE<\/a> Bitcoin futures \u2014 which are run in a much more orderly fashion, with maximum leverage around 2\u00d7.)<\/p>\n<p>At settlement time, the losers supply the profits of the winners. If the losers don&#8217;t have enough funds, someone gets short-changed.<\/p>\n<p>When a trader&#8217;s margin gets called, the exchange submits a market order at the price they blew their margin at. If that order isn&#8217;t filled before the futures contract expires &#8230; the exchange takes a loss.<\/p>\n<p>Fortunately, OKEx has a <a href=\"https:\/\/support.okex.com\/hc\/en-us\/articles\/360000139652-Forced-Liquidation\">mechanism<\/a> to deal with that \u2014 they have an &#8220;insurance fund,&#8221; supported by &#8220;the premiums after forced liquidations,&#8221; and contributions directly from OKEx&#8217;s own funds.<\/p>\n<p>If that&#8217;s not sufficient \u2014 they take the money from traders whose trades <em>didn&#8217;t<\/em> go bad! They call this <a href=\"https:\/\/support.okex.com\/hc\/en-us\/articles\/360000139652-Forced-Liquidation\">&#8220;societal loss&#8221;:<\/a><\/p>\n<blockquote><p>OKEX Futures uses a &#8220;full account clawback&#8221; system to calculate the clawback rate. The system&#8217;s margin call losses from all three contracts will merged and clawbacks will be calculated according to each user&#8217;s entire account profit, instead of calculating each contract&#8217;s margin call loss and clawback separately. Only users that have a net profit across all three contracts for that week will be subject to clawbacks. Clawbacks will only occur if the insurance fund does not have enough funds to cover the system&#8217;s total margin call losses.<\/p><\/blockquote>\n<p>This is an unusual system, not found outside crypto trading. OKEx requires customers to pass <a href=\"https:\/\/www.okex.com\/futureTrade\/beforeFuture\">a test on their terms of service<\/a> before they can trade futures.<\/p>\n<p>This socialisation of losses allows the exchange to offer ridiculous levels of margin at little risk to themselves \u2014 which attracts more traders and trades, and thus more trading fees.<\/p>\n<h3>Timeline of events<\/h3>\n<p>Per OKEx&#8217;s <a href=\"https:\/\/support.okex.com\/hc\/en-us\/articles\/360011941512-Regarding-the-Forced-Liquidation-Incident-on-Jul-31-2018\">incident report<\/a> (<a href=\"https:\/\/web.archive.org\/web\/20180803132120\/https:\/\/support.okex.com\/hc\/en-us\/articles\/360011941512-Regarding-the-Forced-Liquidation-Incident-on-Jul-31-2018\">archive<\/a>), an unknown trader placed a <em>huge<\/em> order of USD$416,851,500 \u2014 that&#8217;s nearly <em>half a billion dollars<\/em> \u2014 at 02:00 HKT, 31 July (18:00 UTC, 30 July). This was a &#8220;long&#8221; position, meaning they bet the price would go up.<\/p>\n<p>OKEx&#8217;s risk management alerting system flagged the order, due to its size \u2014 but didn&#8217;t automatically block it. Instead, their risk management team contacted the client, asking them &#8220;several times&#8221; to reduce the size of the position.<\/p>\n<p>The customer refused, so their account was frozen to prevent further increases \u2014 but the position was not removed.<\/p>\n<p>The Bitcoin price went down over the course of the day, from approximately $8020 to $7750. OKEx forced the liquidation of the position at 20:17:14 HKT (12:17:14 UTC) on 31 July.<\/p>\n<h3>Socialising the losses<\/h3>\n<p>The spectacle of the rich guy getting wrecked caused <a href=\"https:\/\/medium.com\/@Austerity_Sucks\/the-415-million-elephant-in-the-room-okex-futures-unfilled-btcusd-liquidation-aa601b188005\">gales of schadenfreude-filled laughter<\/a> from their fellow traders.<\/p>\n<p>Unfortunately, the trade had gone badly enough that the trader&#8217;s losses were greater than their collateral. The unfilled long liquidation resulted in an open <a href=\"https:\/\/twitter.com\/whalepool\/status\/1024366915001769987\">loss of about 950 BTC.<\/a><\/p>\n<p>The &#8220;societal loss&#8221; clawback mechanism has been <a href=\"https:\/\/support.okex.com\/hc\/en-us\/articles\/115002670151-Investigation-Report-of-Market-Manipulation-of-ETC-futures\">triggered previously<\/a>\u00a0\u2014 but this seems to be OKEx&#8217;s biggest clawback yet.<\/p>\n<p>&nbsp;<\/p>\n<blockquote class=\"twitter-tweet\" data-width=\"550\" data-dnt=\"true\">\n<p lang=\"en\" dir=\"ltr\">The massive unfilled Long liquidation of $415 Million has an open loss of -950 BTC that will hurt profitable BTCUSD contract traders of all maturities on @OKEx_ Futures<\/p>\n<p>Social loss clawback may end up being biggest in the history of <a href=\"https:\/\/twitter.com\/OKCoin?ref_src=twsrc%5Etfw\">@OKCoin<\/a> , will <a href=\"https:\/\/twitter.com\/starokcoin?ref_src=twsrc%5Etfw\">@starokcoin<\/a> intervene? <a href=\"https:\/\/t.co\/6tnmmSA0vB\">pic.twitter.com\/6tnmmSA0vB<\/a><\/p>\n<p>&mdash; Whalepool (@whalepool) <a href=\"https:\/\/twitter.com\/whalepool\/status\/1024366915001769987?ref_src=twsrc%5Etfw\">July 31, 2018<\/a><\/p><\/blockquote>\n<p><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/p>\n<p>&nbsp;<\/p>\n<p>The insurance fund had only 10 BTC\u00a0\u2014 about $80,000\u00a0\u2014 in it at the time. OKEx quickly put in another 2500 BTC \u2014 about $18 million\u00a0\u2014 themselves. This still led to a haircut of $9 million, taking 18% of the profits of the\u00a0<em>successful<\/em> traders in that week&#8217;s futures contracts.<\/p>\n<p>The traders are, understandably, screaming. Here&#8217;s a <a href=\"https:\/\/twitter.com\/ibankbitcoins\/status\/1025320735223427072\">tweet<\/a> (<a href=\"https:\/\/web.archive.org\/save\/https:\/twitter.com\/ibankbitcoins\/status\/1025320735223427072\">archive<\/a>) (warning: contains salty language) from &#8220;ibankbitcoins,&#8221; with a screen shot, and here&#8217;s their <a href=\"https:\/\/www.reddit.com\/r\/BitcoinMarkets\/comments\/946e9w\/daily_discussion_friday_august_03_2018\/e3j0nwn\/\">Reddit comment thread.<\/a><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/davidgerard.co.uk\/blockchain\/2018\/08\/09\/the-okex-margin-trading-disaster-doing-what-crypto-margin-trading-usually-does\/ibankbitcoins-okex-clawback\/\" rel=\"attachment wp-att-9113\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-9113\" src=\"https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/2018\/08\/ibankbitcoins-okex-clawback.jpeg\" alt=\"\" width=\"600\" height=\"160\" srcset=\"https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/2018\/08\/ibankbitcoins-okex-clawback.jpeg 1948w, https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/2018\/08\/ibankbitcoins-okex-clawback-300x80.jpeg 300w, https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/2018\/08\/ibankbitcoins-okex-clawback-768x205.jpeg 768w, https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/2018\/08\/ibankbitcoins-okex-clawback-1024x273.jpeg 1024w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<h3>Obvious questions and comparisons<\/h3>\n<p>There are a number of obvious questions:<\/p>\n<ul>\n<li>How did an order this size go through?<\/li>\n<li>OKEx&#8217;s <a href=\"https:\/\/support.okex.com\/hc\/en-us\/articles\/360000611372-OKEx-Futures-Trading-User-Agreement\">terms of service for futures trading<\/a> note that they can freeze accounts and liquidate positions as needed. Why didn&#8217;t they?<\/li>\n<li>What customer is so important to OKEx that they&#8217;ll risk them breaking the system before they act?<\/li>\n<\/ul>\n<p>It&#8217;s worth noting that we don&#8217;t know anything about this customer.\u00a0 We don&#8217;t have evidence they &#8230; exist. I mean, they probably do! I don&#8217;t really think OKEx is defrauding people in this manner. We just have no <em>evidence<\/em> that this isn&#8217;t OKEx applying a haircut to their customers. That&#8217;s what <a href=\"https:\/\/davidgerard.co.uk\/blockchain\/2017\/12\/17\/why-you-cant-cash-out-pt-1-why-bitcoins-price-is-largely-fictional\/\">&#8220;unregulated&#8221;<\/a> means.<\/p>\n<p>More than a few have been struck by the similarity to what Bitfinex did after they were hacked in August 2016, as I detail in <a href=\"https:\/\/davidgerard.co.uk\/blockchain\/table-of-contents\/\">chapter 8<\/a> of <a href=\"https:\/\/davidgerard.co.uk\/blockchain\/book\/\">the book:<\/a><\/p>\n<blockquote><p>Usually a theft of this magnitude heralds an exchange disappearing or shutting up shop with apologies, or local regulators noticing its existence and swooping in. Bitfinex considered going into bankruptcy, which might leave customers waiting years for a payout. But as the supplier of <s>gambling<\/s> trading facilities not available elsewhere, Bitfinex felt there was sufficient demand for their services that a drastic action would be considered acceptable to their users: rather than have some customers take a 100% loss, they assessed a 36% \u201chaircut\u201d on all customer deposits\u00a0\u2014 including non-Bitcoin deposits. Depositors whose coins had been hacked would be compensated with money from <a href=\"https:\/\/www.bloomberg.com\/news\/articles\/2016-08-05\/hacked-bitcoin-exchange-says-it-will-spread-losses-among-users\">depositors who hadn\u2019t:<\/a> \u201cwe are leaning towards a socialized loss scenario among bitcoin balances and active loans to BTCUSD positions.\u201d The company would then try to trade its way out.<\/p>\n<p>You might think that compensating your customers using money from other customers, while the owners don\u2019t take a hit, would be against the rules in any reasonable financial system. Particularly as bankruptcies usually pay depositors and creditors first and equity holders last. But welcome to Bitcoin.<\/p><\/blockquote>\n<h3>The consequences for the future: nothing<\/h3>\n<p>There won&#8217;t be significant consequences going forward.<\/p>\n<p>OKEx say they&#8217;ve learnt valuable lessons from this, and are working to make the clawback mechanism kick in less often \u2014 they&#8217;d prefer their customers to be happy with them.<\/p>\n<p>But the <a href=\"https:\/\/cointelegraph.com\/news\/okexs-future-trading-shortfall-a-valuable-lesson-for-cryptocurrency-exchanges\">bottom line,<\/a> from OKEx Head of Operations Andy Cheung, is:<\/p>\n<blockquote><p>Cheung also admits that there has not been too much fallout from their clawback mechanism, nor damage to the futures trading sentiment.<\/p><\/blockquote>\n<p>Nothing will stop a trader \u2014 or *<em>psst*<\/em> gambling addict \u2014 in search of volatility. And nothing will stop their suppliers.<\/p>\n<p>&nbsp;<\/p>\n<blockquote class=\"twitter-tweet\" data-width=\"550\" data-dnt=\"true\">\n<p lang=\"en\" dir=\"ltr\">OKEx type occurrences set the entire industry back\/make us look like amateurs. Quite frankly the vast majority are. Creating margin out of thin air\/operating like a CRB only facilitates market manipulation and gives regulators a stronghold to be overly cautious\/restrictive. Sad!<\/p>\n<p>&mdash; Pull the Wire (@WashedUpTrader) <a href=\"https:\/\/twitter.com\/WashedUpTrader\/status\/1025394957169975297?ref_src=twsrc%5Etfw\">August 3, 2018<\/a><\/p><\/blockquote>\n<p><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/p>\n<p>&nbsp;<\/p>\n<blockquote class=\"twitter-tweet\" data-width=\"550\" data-dnt=\"true\">\n<p lang=\"en\" dir=\"ltr\">cry is short for crypto<\/p>\n<p>&mdash; Buttcoin (@ButtCoin) <a href=\"https:\/\/twitter.com\/ButtCoin\/status\/1027622420033810437?ref_src=twsrc%5Etfw\">August 9, 2018<\/a><\/p><\/blockquote>\n<p><script async src=\"https:\/\/platform.twitter.com\/widgets.js\" charset=\"utf-8\"><\/script><\/p>\n<p>&nbsp;<\/p>\n<p><em>Thanks to <a href=\"https:\/\/amycastor.com\/\">Amy Castor<\/a> for prodding me to finish this one, and top-quality editing suggestions.<\/em><\/p>\n<br><br><div align=\"center\"><p><a href=\"https:\/\/www.patreon.com\/bePatron?u=8420236\"><img src=\"https:\/\/davidgerard.co.uk\/blockchain\/wp-content\/uploads\/2021\/10\/become_a_patron_button.svg\" alt=\"Become a Patron!\" title=\"Become a Patron!\" width=217 height=51><\/a><br><p style=\"align:center;\" class=\"patreon-badge\"><i>Your subscriptions keep this site going. <a href=\"https:\/\/www.patreon.com\/bePatron?u=8420236\">Sign up today!<\/a><\/i><\/p><\/div>","protected":false},"excerpt":{"rendered":"<p>How the eye-watering margin leverage on crypto exchanges works in practice, and what happens when things go wrong.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[653,1080],"class_list":["post-8985","post","type-post","status-publish","format-standard","hentry","category-uncategorised","tag-okex","tag-trading"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/posts\/8985","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/comments?post=8985"}],"version-history":[{"count":58,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/posts\/8985\/revisions"}],"predecessor-version":[{"id":12872,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/posts\/8985\/revisions\/12872"}],"wp:attachment":[{"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/media?parent=8985"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/categories?post=8985"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/davidgerard.co.uk\/blockchain\/wp-json\/wp\/v2\/tags?post=8985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}