Thursday, June 01, 2017

Gaming is about to get a lot more expensive. So is AMD.

So, it occurs to me that while public perception is just starting to develop about cryptocurrencies, the press covering the recent stories is absolutely clueless. Given the quality of reporting on virtually every other topic in recent months, I guess I shouldn't be surprised.

Most folks' introduction to cryptocurrency focuses on Bitcoin (BTC). It was arguably the first. It has the greatest adoption and the largest capitalization. Finally, it has been dead center or on the edges of a number of major news stories that have occured in a steady stream for the past several years.  Here are just a few:


  • The price. It has been mentioned every time it spikes for several years and again each time it retreats ("Bitcoin is Dead"). But so far it's never retreated that far. The price captures people's attention. It's easy to see why:



Bitcoin vs. Equities by discerniblyturgid on TradingView.com
Those flat yellow, orange and blue lines at the bottom of the chart? That's the DOW and 2 of the well known stocks everyone was kicking themselves for not buying in 2009 when bitcoin started.


  • Donald Trump. Sure, why not. Bitcoin is recognized by its community as a store of value. If an election or other events make people skittish about the market, it seems some of that money flows into bitcoin. This is an indicator that bitcoin has gained credibility.
  • Criminals. From low level potheads buying anonymously on the dark web to organized criminals, corrupt governments and terrorist organizations, cryptocurrency is recognized for its relative anonymity and portability. Speaking of portability...
  • Donald Trump. Again. On the campaign trail the president repeatedly stated that one of the ways he would get Mexico to "pay for the wall" was to halt outbound remittances by undocumented immigrants. This flow of cash is quite substantial today. Bitcoin and other cryptocurrencies provide an unregulated and largely untracked, secure means of sending money anywhere in the world at much lower transaction cost than Western Union in minutes (well, in 30 minutes).
  • Criminals. Again. Although it was largely viewed as a failure (and possibly a boon for MicroSoft as it targeted mostly pirated instances of Windows XP) when it failed to collect much of the potential haul, Wannacry virus forced many people and businesses to figure out how to purchase and use bitcoin in order to recover their data.
  • Japan. China. Russia. All have announced plans to allow bitcoin exchanges to continue operation. Japan has, in the past month, officially recognized bitcoin as a method of payment. Liquidity in Chinese exchanges, which was hampered by Taiwanese and Chinese banks in April and May, is reportedly returning as the ChiComs have begun to embrace crypto (at least inasmuch as it may possibly undermine the dollar and provide options for international transactions)
  • Increased adoption by legitimate businesses.  From Donut shops to online electronics powerhouses, more businesses adopt bitcoin as a payment method every day. Recently, Alza, the largest online retailer in the Chech Republic and Slovenia, which also has retail stores throughout Europe, announced it would be accepting bitcoin for payment online and in stores and that it would be installing Bitcoin ATM's in several of it's brick and mortar locations.
Most of these stories, related specifically to bitcoin, occured in the past 3 weeks.

To be sure, bitcoin's value fluctuation is concerning as a store of value, but it is a recognized commodity by CBOT, NYMEX, COMEX and CME. After several high profile failures, remaining bitcoin exchanges have taken steps to become regulated institutions. The network has grown substantially.  While there are challenges, Bitcoin's current market valuation of roughly $40B is nothing to sneeze at.

So what does this have to do with Gaming and AMD? Nothing, and everything.  When BTC first came online, the coins themselves were instantiated by "miners" who ran cryptographic algorithms to discover "blocks" each of which is chained to the collection of preceding blocks in a database called the Blockchain. Part of the cryptographic mining operation facilitates the transaction of whole or fractional bitcoins between users. The cryptographic difficulty of early blocks was low enough that the coins could be found relatively quickly with any spare PC.  As the number of miners grows, the cryptographic difficulty is automatically increased to fix the rate of coins mined. Intrepid miners found that the high processing power of expensive graphics cards intended for gaming PC's was ideal for solving cryptographic hashes and moved the processing onto the GPU's. Once this trend began, all miners switched to GPU mining as CPU mining was so much slower that even expensive CPUs could not compete.  Put simply, as GPU's took over, providing 28X the power of a typical CPU for half the cost, the difficulty rose rapidly and CPU mining became completely untenable.  This resulted in the first cryptomining rush on the video card market as miners competed (and in many cases combined forces) for "hashrates" that would increase the odds that they would be able to find the next coin. This began in earnest in 2014 and the price of current video cards at the time spiked as demand outpaced GPU suppliers' capacity.

The competition was so fierce that, by the end of 2014, a number of specialist equipment vendors had set up shop to create devices (known as ASICS) specifically to process bitcoin hashes. ASICs again increased the hashrate. Where 2014 GPUs were approximately 25-30 times faster than CPU miners, now the first generation of ASIC miners were up to 30X faster than GPUs. This is Moore's Law in rapid action. ASIC equipment has a limited lifespan as each successive generation of ASIC is often an order of magnitude faster than the last. The bitcoin mining network today is almost entirely composed of ASIC hardware. The hashrate has risen from 186 TeraHashes per second (TH/s) (that's a lot of hashes) in July 2013 to a staggering to a staggering 4.86 MILLION TH/s today. With all that power, the built-in difficulty increase has kept the rate of coins being found by all miners relatively constant; about 1 coin is born into the blockchain every 8 to 10 minutes, the same as 2013.


So, GPU mining for BTC died in early 2015 and will likely never return. Companies like ATI (a subsidiary of Advanced Micro Devices NASDAQ:AMD) and nVidia (NASDAQ:NVDA) who make the bulk of the most powerful GPUs experienced a massive spike in demand for about 14 months that disappeared as quickly as it had come. AMD was so unprepared for both the boom and the bust that they missed earnings and, arguably, have never fully recovered.

So, this was a one-time event, right?

The answer is a bit complicated and "probably not". Moreover, there's very good reason to think that this event is repeating itself today and that the demand for GPU's for nongaming applications related to cryptocurrency will not falter this time and, for architectural reasons, AMD has a distinct advantage in this market over nVidia and all major GPU producers.

Enter Ethereum.  Ethereum is a relatively new entrant in cryptocurrency. It was created after bitcoin and designed to avoid some of the shortcomings of the world's best known digital currency.  

There are many, many alternative cryptocurrencies vying for marketshare with Bitcoin (at last count, at least 1400 separate active alternatives, collectively known as "altcoins"). At the beginning of March, BTC market cap exceeded the total of all other altcoins combined. The five next largest accounted for over 40%. Today, although BTC remains the largest, it has dipped below 50% of total crypto market value. This is remarkable for 2 reasons. In the same period that BTC declined in market share, it's price per coin more than doubled and, amazingly, total market capitalization increased 300%.  Is it a bubble or a fundamental disruption? Two things are clear: real money is accelerating into the cryptocurrency markets at exponential rates, as is adoption--the transaction rates for bitcoin are at an all time high.

Bitcoin was designed and has come to be regarded primarily as a store of value and medium of exchange. It is purely a commodity supported by a network that rewards "miners" for finding new coins and processing transactions.  The primary unit of the blockchain, a block, requires relatively little memory to process.  The blockchain itself is a ledger of very simple transactions. You can verify any transaction that has taken place. You can find out how many bitcoins are at any address. You can send bitcoins. You can verify hashes. That's all the network really does.

Ethereum was created as a distributed computing network or "DCN". It's built upon the same cryptographic underpinnings as the bitcoin network, but it has been extended (some would say "hyperextended") to support applications running on top of the network.  Ethereum supports a range of decentralized applications "DAPPS" which range in purpose from entertainment and social media to complex legal transactions, all of which have a weight on the network that can be expressed in transactions which are ultimately "paid" in tokens (analagous to bitcoins) called "Ether". So Ethereum's blockchain persists not only transfers of value, but a structure called "smart contracts" which can be executed automatically as events register with the network. These contracts are encoded into the network on every node of the blockchain and cannot be destroyed. (They are encrypted, so they are free from prying eyes).

Consider the story I heard from an gentleman I met a few weeks ago who works with the US Treasury Department's Office of Foreign Asset Control in Guatemala.  These folks are now responsible, in part, for tracking payments from and to drug cartels and terrorist networks and have had to become blockchain experts. Yet he was mostly positive about blockchain's potential. He said in Guatemala, if you were to buy a piece of real estate that a government official wished to own, you would pay for it and register the deed, which would be kept in a single facility which might soon burn down, eliminating the official record of your ownership.  The documents could be digitized, but if a registrars are corrupt, they can be destroyed.

If this same contract were implemented in Ethereum, there would be millions of copies distributed throughout the world on a network that cannot be "possessed", in a format that cannot be hacked. The smart contract can be updated with details of payments, with multiple originations and endpoints, each of which is validated hundreds of times to ensure the record is constantly and persistently up to date.  It is this capacity of Ethereum that has, in the past month, driven it's market capitalization in "real" dollars upward faster than Bitcoin. Ethereum market cap is now 60% of Bitcoins.

So the market perceives BTC as a medium of payment (currency) and store of value (commodity). Ethereum provides both of these and an application framework that compensates "miners" for providing processing power for these applications. It comprises, by far, the largest, most capable and most redundant distributed programmable machine in existence.

Ether's rapid rise to second place and extended potential have captured the attention of the mining crowd for over a year and the network has experienced exponential growth for several months and Ethereum is passing through much of the same technological path as it's older brother, bitcoin, which is to say, the mining applications have been ported to GPUs to increase the hashrates and the supply of cards with the best mining GPUs is, well, 



a little thin to say the least.  Those that are available are commanding a significant premium.

Note, while these cards all come from different manufacturers, they are all based off AMD's Radeon RX 480 GPU which is architecturally better for cryptomining than nVidia's (very good) graphics cards. It uses less power and is the current go-to card for Ethereum miners.  newegg.com is probably the best known vendor of OEM components for performance PC's. (As an aside, they accept bitcoin as a form of payment).  This is not a mom & pop shop. They ship more high-end graphics cards than any vendor in North America.

"But this is just another singular event for GPUs, like the one that occured with bitcoin, right?" 

No. 

One of the key differences with Ethereum is that they witnessed the ASIC transition. ASICs are expensive gear. A new generation of ASIC mining hardware emerges every 18 months making the last generation obsolete overnight. ASICs do one job and do it well. Once they're obsolete, they go to the landfill and must be replaced. Units range from $1000s to $100Ks. This has consolidated much of the bitcoin mining into corporate miners and cartels and many view this as a threat to decentralization.

So Ethereum was architected to do more than bitcoin and require a much larger memory footprint.  While ASICs brute-force approach works on the smaller bitcoin data structures, it is prohibitively expensive to create one with the memory required to process Ethereum blocks efficiently.  GPUs, on the other hand, are made to break down large memory structures and provide fast memory access to a large number of parallel processors build into the GPU.  These cards and processors are optimized for 8GB of RAM.  They're designed, tested and made by large manufacturers for a much larger market and a variety of uses.  ASIC manufacturers are much smaller. They do not have the market weight to purchase high speed memory at price an ASUS or nVidia can. Even if they could, they do not possess the fabrication technology to build a board that can support the much larger storage requirements to make ASICs feasible.

So, for the forseeable future, Ethereum mining is stuck with GPUs and lots of 'em. They will, no doubt, adopt successive generations of 12 and 16 GB cards and Moore's Law will continue to drive a geometric rise in network capacity.  For now, AMD has the best architecture for miners and they will continue to favor the latest versions of AMD GPUs over nVidia.  They are doing so at a rate that is stressing supply of Radeon RXxxx cards and there is no disruptive technology on the horizon.  The price of all cards is rising as a result.

This is bad news for high end gamers, who often use multiples of these cards in their PC's, but it's very good news for AMD, assuming they can meet the new demand and continue to scale their platform.

Cheers,

DT









Monday, May 22, 2017

Cryptocurrency Arbitrage

Cryptocurrencies have caught fire in recent months as several governments including Japan, China and Russia, have recently announced recognition of Bitcoin, the macdaddy of blockchain currencies. Other relevant events driving interest in fiat alternatives include the Trump presidency and uncertainty it has introduced in traditional markets, announcements by more and more businesses such as this one by Alzi that they are accepting the currency as a form of payment.

tl;dr A free tool to help cryptocurrency enthusiasts discover BTC and ETH arbitrage opportunities between 2 popular bitcoin exchanges (Gemini and GDAX). Download

Most recently, the value of Bitcoin and related currencies such as Ethereum has skyrocketed, surging nearly 100% in 60 days.



Clearly past performance is no indication of future gain and interested investors would do well to acquaint themselves thoroughly with the technology.  Bitcoin's recent history notwithstanding, the assets value is subject to extreme volatility.  Entire exchanges have been wiped out in the past few years due to security oversights. Still, money is pouring into the cryptocurrency market at a record pace.  

As with any immature market, the price of a cryptocurrency is somewhat open to interpretation with different exchanges often having significantly different pricepoints. This presents an opportunity to increase profit and to mitigate risk.

Numerous exchanges exist for trading cryptocurrencies and each have very different fee schedules, interfaces and offerings.  Regulation of the exchanges is still evolving, and the projects backing them are hosted on a range of technologies.  It is possible, however, to take advantage of the price differences, essentially creating your own derivative by trading simultaneously on 2 or more exchanges when the prices are significantly different.

Have a look at this chart:


Notice that just before 6 am on May 21, the price for bitcoin (BTC) on several exchanges ranged between 2070.86 and 2422.55.  If one had an account on bitstamp with cash and another on localbtc (not realistic, but for illustration) and purchased 1 bitcoin on bitstamp at 2070.86 and simultaneously sold 1 bitcoin via localbtc at 2422.55, after transaction fees, she would have effectively made an instant profit of about $350.00 or over about 17%. The cash can be redeposited in her bank account from localbtc. The bitcoin can be transferred to her virtual wallet or to a more favorable exchange in about 30 minutes.

In general, the above case is quite rare. localbtc is not an actual exchange but a marketplace connecting local bitcoin traders to people who want to pay cash. bitstamp is located in Slovenia and the cost to transfer funds into the exchange can be significant for those who do not have an account in a European bank.

Still, referring again to the chart above, a number of these exchanges have been established in the United States, Asia, Europe, and Central and South America, so there is usually at least a pair of exchanges that are relatively safe and work efficiently with banks in any region.

For purposes of illustration, let's look at Gemini and Coinbse/GDAX, exchanges that are headquartered in the US and work with North American bank transfers.  Deposits and withdrawals are relatively easy and cheap via ACH from major American banks. At the same time, Coinbase was at 2136.65 while Gemini had BTC at 2049.91. Absent fees, simultaneous sale on Coinbase(GDAX) and buy on Gemini results in, effectively, an instant profit of $84 on a single trade. While BTC appreciated significantly on both exchanges throughout the weekend, the pricing inefficiency provided dozens of opportunities to increase yield with profitable offsetting trades with margins ranging from 1.5% to nearly 6%. 


Now for the bad news. Volatility means that these windows are brief.  There are varying spreads on any exchange that must be taken into account. The trade on either side my not close.  This is not innately harmful, but it takes the system out of balance when the market is moving rapidly in one direction.  

Dealing with the spread means monitoring the order book, not the last sale in real time and basing your trade on the current bid where you place your sell order and the current ask where you buy. If you're quick and if you are willing to shave a few cents against the relevant offers, then it's not difficult to place two trades that will close immediately.  I (and many other folks) have written code to accomplish this in real time, but I've also been successful entering trades manually in several exchanges.

Note that this isn't limited to BTC/USD.  Any currency pair that is traded on two or more exchanges is fair game.  Both GDAX and Gemini offer trading in BTCUSD (Bitcoin-Dollar), ETHUSD (Ethereum-Dollar) and ETHBTC (direct exchange of Ethereum for Bitcoin). There is an inherent advantage in ETHBTC arbitrage in that there is no need to deposit cash if you already have cryptocurrency in both exchanges. It's also easier to balance these accounts as crypto can be exchanged directly between the two exchanges and fees are extremely low (.002%).  ETH transfers between exchanges or to an external wallet take a few seconds. BTC generally takes around half an hour. Cash can be used for purchase immediately but cannot be withdrawn (nor can assets purchased with it) for a few days.


With any pair, you choose which currency you want to reflect your profit in.  If you trade BTCUSD and you want to increase dollars, make sure your orders are for the same amount of BTC.  If you want to increase your bitcoin holdings, set your orders for the same dollar amount.

I've built a spreadsheet to help folks who are interested in experimenting with arbitrage opportunity between two exchanges and seeing opportunities develop in real time. You are more than welcome to download it here: 

http://bit.ly/dt_arbtool

This tool is freely offered for your personal use. I don't guarantee support and I accept no responsibility for your results.  The spreadsheet uses public websocket APIs from GDAX and Gemini. You need not have an account on either exchange to receive realtime quotes. Excel is not an appropriate platform for the development of trading bots. This is simply a tool that utilizes realtime orderbook information supplied freely by the exchanges and displays the bid-ask adjusted margins for 3 currency pairs across 2 popular exchanges.

By default, the queries will refresh every minute. In Excel's data tab, you can refresh on demand, up to 6 times per second, by clicking "Refresh All" button in the ribbon menu.


The colored section reflects 6 possible trades, the available gross profit and the sellside ask and buyside bid for each.

Beneath that is a recommendation which is, essentially, the trade with the best current divergence.


All that need be done is to download the spreadsheet and run in excel (the service requests do not work in Google Sheets, unfortunately).  I have tested in Excel 2016.  You will need to enable editing and external connections for the worksheet when it opens.  There are no macros.  The queries can be viewed in the data tab (view all queries) and are URLS that can be cut-pasted into a browser if you'd like to see them that way.  The data returned by each is in the 6 green and white tables on the left-hand side of the sheet.

If you do decide to download the tool, please drop me a comment below and let me know what you think.


Happy trading!

DT











Cryptocoin Arbitrage Excel Tool

Hello, folks. It's been a while since I've written an article, but today I got inspired to dust off my blog.

With the excitement around Bitcoin and related currencies hitting a fever pitch, I thought I'd play around with some investment techniques.  I'll try to get something together that is a bit more detailed, but I wanted to post an excel tool that demonstrates how to detect arbitrage opportunities given the sometimes enormous differences between varias cryptoexchanges.

It can be downloaded here as a .xlsx file: 



This tool is simply an excel spreadsheet that monitors the order books of two popular exchanges (gemini and GDAX).  

From what I can tell, all the exchanges I have looked at have accessible APIs that work in a fairly similar fashion.

This tool does not require an account on the exchanges. It uses only public APIs to analyze the order books and display the instant gain or loss of equal buy/sell orders on different exchanges.


It further selects the "best" or most profitable transaction and highlights this as its recommendation.





Note that it does not take into account fees, which range as high as .3% on each side.

Note also that cryptocurrency exchanges, while inefficient, do move very quickly. Taking action based upon this recommendation may require some quick typing. I have coded this on other platforms to automate and test the orders, but Excel is inappropriate for this (and orders obviously require account information.)

I'm uploading it prior to finishing my article so that friends in the community can evaluate it and make suggestions.  

Obviously, I'm offering this for folks to use as they see fit and I take no responsibility for your trading results.

Quickstart:  The spreadsheet is developed in Excel 2016 and uses automated calls to the web services API's of two exchanges.  The queries are visible in the Excel Query pane. They are simply url datasources that retrieve real-time order book information for BTCUSD, ETHUSD and ETHBTC pairs. The queries should refresh automatically every minute, but you can go to the "Data" tab in excel and click "Refresh All" for faster updates.




Please let me know what you think.

Additional notes:  
  • It doesn't appear to be supported in Google Sheets.  

  • I used excel 2016 to create it and am unsure if web data connections were available without a plugin in previous versions.