Monday, January 06, 2020

James T. Kirk is Officially a Badass and Could Totally Crush the GenX Version's Bald British Guy, Whatshisname...

So, William Shatner has announced that, at 88 years of age, he intends to go to space.

I mean, think about how cool this is...
The Russians put a guy in outer space in April of 1961 and inspire all their kids to be scientists and engineers and pilots.
A month and a half later, Kennedy says "Err uh, OK, you wicked smaht sonsabitches. We're gonna plant our flag on the moon." and everybody goes, "Oh... shit. That's a pretty tall order, Jack."
And so they pay these guys to do a live-air TV space show that has the simple basic assumption that we actually did it. And it airs in September of 1966 and Everybody watches it and people start going, "Yeah. You know what? Maybe we can do this thing!" and kids start watching and thinking about computers and fabricators and ubiquitous wireless handhelds without pullup antennae. And nobody even stops to wonder why, 300 years in the future, anyone would still be wearing thigh-high leather boots in a spaceship which, at one point, gets to the edge of the Milky Way, so, at least 25000 light-years away from Earth and Earth cows. They're all just that freaking excited!
And then on my birthday in 1969 we launch Apollo 11 with three absolute badasses to the moon and five days later (five freaking days!) they land on the moon in a spaceship that looks like it's made out of garbage and they plant that flag and come home and we keep sending badasses up there and 3 years later, Alan Shepherd gets out of the garbage ship and hits some fucking golfballs because that's what Americans do on the moon, by God!
And they might not have gotten there as quickly if not for that show egging people on. And now everybody is watching that show, and I mean everybody everywhere! I'm living in Germany with a black and white sony 10 inch portable TV in 1969 and there are 3 things in English on TV that I'm aware of: Lost in Space, Star Trek, and, for about 2 weeks, continuous (meaning 17 hours a day) coverage of the moon landing.
And the first really massive wave of coders and scientists and engineers grows up watching that show and, really, because of it. And dreamers and artists, too, start mixing art with some of the gear that the tech geeks are churning out and they remember the show so in May of 1975 get those guys and they say, "Hey brothers and sisters, that show was super bad (which at the time meant "really dope") and we see you got these sweet convention gigs and all, but we were wondering if maybe you might want to do, you know, like a movie, you dig?" and so they make a movie that comes out in 1979. And that movie looks beaucoups better than the show ever did because of all the cool stuff the artists and dreamers can do with the stuff the show inspired the nerds to make.
And a whole 'nuther massive wave of nerds is birthed from the movie(s), and those coders and scientists and engineers and dreamers and artists think about what's outside our solar system and they don't even care that Pluto isn't a real planet. They just want to know what it tastes like. And they go back and watch the show and the movies and they make spinoffs and more movies (don't even get me started on the reboot and Star Fleet Academy timeline that reminds me of the Muppet Babies cartoon) that go farther and dream up more cool stuff and the old show stuff doesn't seem so far out any more. And the nerds put their heads together and say, "Of course we should be able to talk to our computers and of course we should be able to talk to anyone, anywhere without wires and of COURSE we should all have flying cars!"
And two out of three ain't bad.
And about that time, two fans of the show drop out of Harvard and make a computer you can carry into your home and use for less than the price of a (terrestrial) car. And a lot of Star Trek fans get them and start sharing ideas. Some of them make insane amounts of money and they start to think "I've got more money than the space program. I bet I could put some dudes on the moon, maybe even Mars!" and so they start building their own spaceships, because that's what tech billionaires do, by God.
And so, of COURSE, this man, this pioneer, this indisputable badass should go up into space when he's almost 90 years old, and it's amazing and cool that he can afford to, because if he didn't make that show, I think I would never have gone to engineering school, and maybe I wouldn't have met my wife or made my amazing kids and turned them all into nerds. I think we might not have a lot of the cool stuff we have now, and we might never have seen a dude hit a 6 iron over 200 yards on the moon.

https://www.dailymail.co.uk/news/article-7853659/Star-Trek-legend-William-Shatner-planning-trip-SPACE-age-88.html?fbclid=IwAR2GcmxyVmnR5gsb97JzQUzsZm32X-EBFI6wQol39XZneGR8kqM8I8zG_FY

Tuesday, January 02, 2018

Cryptocurrency Arbitrage Tool - v 2.0

Happy New Year!

I was discussing crypto (among other things) with my family this past holiday and amongst the "It's a bubble" and "What about IOTA?" chatter, I had some interesting conversations about volatility.

While volatility is, on its surface, a concern for people new to Bitcoin and other digital currencies, it is manageable. Whether you want to manage it is another question entirely since, for anyone looking at volatility of any period over the past year longer than about 6 days, the direction of the volatility is UP.

But let's be honest, the trade between fiat currencies and cryptocurrencies is in its infancy.  5 years ago, there was one coin.  It's managed to stay at the top of a heap of over 1500 coins and tokens today.

BTC's price recently fell about 35% in 2 days.  This was called a "correction", but I tend to disagree.


Perhaps at the velocity of cryptocurrency markets, this is a correction, but to my mind, a correction lasts.  This is normal respiration after the injection of the second wave of investment, which started in Asia and now includes institutional investors.  While bitcoin is the most established cryptocurrency in the world, it's markets are still inefficient and liquidity is affected by everything from zealotry (HODL!) to technical setbacks (2X) and hacks (Mt. Gox) that drive enormous amounts of bitcoin off the market and into cold storage.

It's the inefficiency that we can leverage to mitigate the volatility.

As I write, I note that the price of bitcoin on two commonly used North American exchanges is

13780.40 (at Kraken) and  13571.38 at Gemini.

This is over 1.5% difference in price for the exact same trade.

It so happens that Kraken allows margin trading and Gemini credits cash deposits instantly, so if one had a small amount of BTC at Kraken, a range of options is presented.

Cash neutral trade:

  1. Deposit $500 with Gemini
  2. Place limit BUY order on Gemini for $500 worth of Bitcoin @ 13571.37 and offsetting SELL order on Kraken for $500 worth of Bitcoin @ 13780.41.
  3. These trades should close very quickly resulting in the following changes to accounts:
Gemini USD balance -500, Kraken USD balance +500
Gemini BTC balance +.036842, Kraken BTC balance -.036283

This is a net gain of.000569 BTC

If I'm relying on instant deposits, I must remember to transfer the $500 cash balance out of Kraken to offset what I put in at Gemini.

Likewise, I can make the transaction BTC neutral by setting my quantities at .036283 BTC, which would leave me even in BTC and with a cash profit of roughly $7.50.  It doesn't seem like much, but it's not uncommon to see divergences of 3-5%, especially when tracking multiple exchanges and currencies and these divergences tend to be larger during high volatility periods.

There are important considerations:

TRADING Fees:

Depositing and withdrawing fiat currency (USD) to/from exchanges generally costs money.  Here is how to save:
ACH deposits up to $500 per day at Gemini are free.  Withdrawals are also free.
ACH deposits to GDAX are no instant, but are also free.

Trading incurs a fee.  On Gemini and GDAX, this fee can be avoided buy using LIMIT orders.  Limit orders mean that you are placing an order with your coins or dollars at a set price that is out of the money.  You are, in essence, contributing liquidity by tying up your assets.  When orders close, there is generally a "maker" and a "taker".  The maker is the side of the transaction that set a price out of the money (a sell order above market, for instance). A taker is an order that matches instantly with the market rate (generally a market order or "in the money" limit order). Trading fees are generally assigned to the taker (or are higher for takers than makers on Kraken).

NETWORK Fees:

Network Transaction Fees are incurred when you withdraw cryptocurrency from an exchange (or, more generally, whenever you send cryptocurrency). For most cryptocurrencies, these fees are quite low--on the order of pennies per transaction regardless of size, but in the case of BTC, they have become so high due to network congestion that it really makes no sense to withdraw $500 worth of bitcoin. The fee may be as high as $40.  Bitcoin transactions are also quite slow relative to other currencies.

Note that transactions within an exchange do not incur a network fee.

Avoiding Network (also known as "Miner") fees is a separate topic, but note that you can trade BTC for any currency supported on the exchange (e.g., buy ETH/BTC) and incur only a trading fee (again, try to use limit orders). This currency can then be transferred and converted back or held in cold storage.

So, I generally don't look at any arbitrage transactions that do not have a margin of at least 1.5%. The idea is to make money, not spend it all on fees.  

When I'm actively trading, I try to make 5-10 arbitrage trades in a session. Ideally, arbitrage transactions are always profitable as they capitalize on instant differences between exchanges and/or currencies.  So, when things were going crazy last week, I executed 23 trades that averaged $1433 in dollar size and averaged 3.623% in returns. 16 were "cash neutral", 7 were "coin neutral". I rebalanced accounts several times, including 2 BTC transfers which resulted in $76 in mining fees (crazy).  I managed also to pay approximately $230.72 in trading fees, some of which was due to my own poor execution. So I netted over $887 in less than a holiday week while the market was generally headed down. I increased both my cash accounts and my crypto holdings during that period, all without risking a penny of additional cash.

BTC took a drubbing last week and eventually came to "rest" around $13400 (but not before sinking to under $11000). The horizontal phase we're in now may be the start of a bull market or it may just be a breather after a month of unsustainable growth. We've seen what amounts to 2 "dead cat bounces".  Usually, we would expect 3, so I expect to trade another week in the 12-14K range before we see what direction we'll be moving in.

If you're interested in Cryptocurrency Arbitrage, I created an excel-based tool last May that helps analyze prices of a handful of currencies across 2 North American exchanges.  Since that time, I've been inundated with requests to expand the tool to cover more exchanges and currencies.  Since Gemini and Coinbase/GDAX are fairly limited in their offerings, real arbitrage opportunities are also limited.  Coinbase has since added Bitcoin Cash (BCH) and it seems to have solid volume.  I've added these assets and the Kraken exchange, which has more than doubled the opportunity landscape.


As always, the tool is provided "as-is" and without support. You are free to modify and reshare as long as you provide a link to this blog and credit me with original development.  I've used the native public APIs for each of the exchanges (Gemini, GDAX/Coinbase, and Kraken).  The color coding takes into account expected fees of 1.5%, so don't trade the reds and yellows.

You'll need to download the spreadsheet and run in Excel. It doesn't work in Google Docs. You don't need accounts on any of the exchanges to use the tool. It uses the public APIs.

You can download the tool here:

Cryptocurrency Arbitrage Tool

Happy Trading!

DT


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.

Tuesday, November 10, 2015

Who's smarter? Red States or Blue States?

I recently observed a twitter slap fight between two partisans over the question of whether red states are smarter than blue states.

This discussion rapidly broke down along the path "look it up yourself", "AHA! so I win!"

 I thought I might take a few minutes and resolve the question, at least for myself. Obviously, the quantification of "smarter" demands that methodology be explained.

The most recent SAT scores breakdown I could easily get my hands on is for 2011 results. I then googled, "Which states are red and which are blue" which led me to a map designating a hard value of each state (plus the District of Columbia) and a binary designation of red or blue based on which way the state voted in the most recent Presidential election.

Combining these two datasets, I got the following table: Mean 2011 SAT Scores by State States are listed by total 2011 SAT Scores

Mean 2011 SAT Scores by State
States are listed by total 2011 SAT Scores
RankStateCritical ReadingMathWritingCombinedParticipation Rate
blue1Illinois59961759118075%
blue2Minnesota59360857717787%
blue3Iowa59660657517773%
blue4Wisconsin59060257517675%
blue6Michigan58360457417615%
blue13Colorado570573556169919%
blue21New Mexico548541529161812%
blue22Ohio539545522160621%
blue25Washington523529508156057%
blue26New Hampshire523525511155977%
blue27Massachusetts513527509154989%
blue28Oregon520521499154056%
blue30Vermont515518505153867%
blue31Connecticut509513513153587%
blue32Virginia512509495151671%
blue33California499515499151353%
blue36New Jersey495516497150878%
blue37Maryland499502491149274%
blue38Rhode Island495493489147768%
blue40Pennsylvania493501479147373%
blue42New York485499476146089%
blue44Delaware489490476145574%
blue45Hawaii479500469144864%
blue46Florida487489471144764%
blue50Maine469469453139193%
blue51District of Columbia469457459138579%
red5Missouri59259357917645%
red7North Dakota58661256117593%
red8Kansas59059556717526%
red9Nebraska58559156917455%
red10South Dakota58459156217374%
red11Kentucky57657256317116%
red12Tennessee575568567171010%
red14Wyoming57256955116925%
red15Arkansas56857055416925%
red16Oklahoma57156554716836%
red17Utah56355954516676%
red18Mississippi56454355316604%
red19Louisiana55555054616518%
red20Alabama54654153616238%
red23Idaho542539517159820%
red24Montana539537516159226%
red29Arizona517523499153928%
red34Alaska515511487151352%
red35West Virginia514501497151217%
red39North Carolina493508474147567%
red41Indiana493501476147068%
red43Nevada494496470146047%
red47Texas479502465144658%
red48Georgia485487473144580%
red49South Carolina482490464143670%


And the winner is....

 

...Red by a significant amount. You may wish to doublecheck my findings as I do live in a Red state (but not one of the ones in the top 25).

 I am, however, a professional data scientist.

 Cheers,

 DT

Wednesday, November 08, 2006

Can You Hear Me Now?

If you're starving and somebody throw you a cracker, you gonna be like this:
"Goddamn, that's the best cracker I ever ate in my life! That ain't no regular cracker, was it? What was that, a Saltine? Goddamn, that was delicious! That wasn't no Saltine. That was...That was a Ritz! That wasn't a Ritz? God, that was the best cracker I ever ate in my life! Can I have another one, please? Please, one more."

Then you get married, because you think you've found the bomb. Have the same crackers every day for a year. And you roll over one day and be like: "Hey, I just got some regular old crackers."

--Eddie Murphy, "Raw"


Eddie Murphy used to do a bit about crackers to illustrate the profound risks of delayed gratification. Anticipation can temporarily cloud one's judgment making even staples seem extravagant. Mundane necessities and simple pleasures--food, say, or intimacy--are rendered exquisite by the simple fact of their temporary absence. With all worldly pleasures this effect is fleeting. Familiarity, as they say, breeds contempt or at least diminishes our sense of awe and wonder. We quickly forget the anguish of denial and become complacent and comfortable with our gains.

So it has been with the Republicans--and with us. In 1994, after being consigned to the minority for 40 years, they figured out the recipe with the Contract with America and the Gingrich Revolution. Accordingly, Americans hungry for a new direction, limited government and a message of personal responsibility and the accompanying prosperity drank it up. It was a marriage made in heaven. These guys were talking about cutting spending, balancing budgets, increasing private productivity. Not since the new deal had we really tasted crackers this fresh. The Republican party reveled in the attention and the opportunity to effect meaningful change. After so many years in the minority, they'd earned the opportunity to prove their ideas. Life was good--no, great!

Fast forward 12 short years. Republicans who campaigned on balanced budgets and term limits are now lying sideways in the public trough. With control of two branches of government and increased leverage in the third, the great life has become too easy. The revolution has stalled.

To be sure, some seismic historical movements have occurred. Recession, an attack in the homeland, the momentary collapse of the stock market provide moments of astonishing leadership and solidarity. Ruthless regimes are toppled. America wounded roars. The world is briefly united behind her.

But an opposition party fresh out of ideas for all of the last 35 years provides little more than comic relief--certainly no competition or incentive to sharpen the saw. The Republican leadership's attitude of entitlement grows daily--the principles which drove them into office have long since been abandoned in favor of profligate spending and government expansion under the guise of "compassionate conservatism". The will of the people, whose support and praise were at once magical and musical a decade before is drowned out by the instinct for political self-preservation. The party of family values becomes more closely associated with graft and sleaze. Familiarity breeds contempt. Contempt for the people. Contempt for the opposition. Contempt for the ideas and promises that delivered them from minority status.

It turns out, contempt is a two-way street. It's not as if you weren't warned. Your base and the crucial moderate swing voters positively shouted for years: Do something to turn it around! Stop the southern invasion! We'll give you whatever you need to win the war, but you must win! We've already disciplined the democrats, the unions, the billionaires, the church. Beware and police yourselves! It's May, Mr. President. We've been at this a while and we're tired of simply staying the course. We want more than commitment at the microphone. Are you listening? Can you hear us? Eighteen months to go, but you're not up for reelection.

It's September and New Orleans is under water. Yes, the governor and the mayor are incompetent. You knew that two weeks ago. But you're the President and Michael Brown has no plan either. 1800 people are dead, rioting resembles the aftermath of victory in Baghdad, but it's here at home. Why aren't you doing anything? Can't you hear us?

Those men at the border... They're not vigilantes, they're Americans and they're doing your job! We want you to protect us, not offer amnesty and encouragement to criminals. It's May and your approval rating is at 38%. The invaders are marching in LA under foreign colors. It's not acceptable! Can you hear us yet?

School's out! It's June. Gas is $3.35 per gallon in California. Do you know how many times we're reminded of this fact as we drive up the PCH? What are you doing about it? Complaining about minority opposition isn't making much difference. Oh yeah... About DeLay and Abramoff and DeWine. We're not stupid. Can't you talk to these guys or at least condemn the actions when they become public? Can you hear us now? 36%

August. Please stop calling me to ask for money. I gave you money. You gave me no Osama, no resolution in Iraq, but you did support the Senate omnibus handout to Vincente Fox. You've done nothing but let me down. Please ask Ken Mehlman and your wife to stop emailing me at work, too. It's creepy. 34%

October. Glad to hear you're heartened by the surge to 39%. 2 years of generals telling us off the record and republicans on the record that we need more resources in Iraq. Osama's still making videos despite assurances this time last year that he was probably dead. Your own party doesn't want to campaign with you. Are you listening?

November 7. Pearl Harbor day 1 month early. Contempt is palpable. The people are tired of your crackers. A lot of crackers are losing really nice day jobs. Tomorrow Don Rumsfeld will resign. If it's ok tomorrow, why not 60 days ago? We're pissed Mr. President! We've had enough, Mr. Speaker! The good news is, it's not 1974. You're only down a dozen and a half seats, instead of 145. You have 2 years. You won't get much done. No more strict constructionist nominations for you. Tax cuts? Gone. Social Security Reform? We never believed you anyway.

You have 23 months and 29 days to do nothing but listen--very carefully.

We were your base, cracker. Can you hear us now?

DT