
High Frequency Trading on the Coinbase Exchange - modeless
https://medium.com/@abarisser/high-frequency-trading-on-the-coinbase-exchange-f804c80f507b
======
kasey_junk
> There’s no premium access, no expensive trading floor credentials. It’s
> totally open. I love that.

I completely understand this sentiment and agree for the most part. That said,
for the specific case of co-location it would be better for the exchange to
offer paid access.

The reason is that if the exchange doesn't offer it as a standardized option
(and the exchange gets successful enough) being close to the exchange will
become it's own pet industry. Only those "in the know" or with the ability to
pay them will know the right places to host their bots and in the extreme
cases only very rich players will have access as they buy up all the premium
real estate.

This happened with the other exchanges, so we can only assume at some level of
success it will happen with bitcoin exchanges.

~~~
hexedpackets
Coinbase is hosted on AWS in the us-east-1 region; this makes co-location
incredibly cheap and accessible. The specific availability zone isn't
publicized, but it would be trivial to do latency comparisons between the
zones and figure it out - since Coinbase is a fairly new company, there are
only 3 zones they could be in.

~~~
DrStalker
Availability zones are randomized per accounts; my us-east-1a might be the
same as your us-east-1b.

This is presumably done to stop everyone putting things into the same AZ by
just choosing the first one in the list.

There is some more detail here: [http://alestic.com/2009/07/ec2-availability-
zones](http://alestic.com/2009/07/ec2-availability-zones)

~~~
vosper
That's true, but a latency based test should still let you figure out which
zone you need to run in. But everyone would need to do the test for
themselves.

------
tptacek
So, what parts of coding a simple conservative MM were tricky for you? What
surprised you? How math-y did the code get?

------
pontifier
I built a bot to trade on MtGox just as it was going down. It was
exhilarating. I have it trading on BTC-e right now and it's open source. I
don't make much from it, but I don't have much invested. It's more of a test.

Unlike the original poster, I'm not afraid of anyone gaming my bot. So far,
the bot hasn't made ANY bad trades. It's also not a High frequency trader.
Basically it decides what trades would be good for it, and makes a buy and
sell limit order, then waits. If one happens, then it cancels the other, and
recalculates what to do. If both happen, all the better.

It's based on rebalancing a portfolio. And just the idea that it actually
works might be more valuable than anything the bot has made so far.

If people are interested it's at Github.com/pontifier/rebalancer.git

~~~
alexchamberlain
How does your bot determine the ratio, or more precisely the price it uses to
determine the ratio?

~~~
pontifier
It looks at what your holdings are, and calculates what the asset price would
be if you were at the ratio you set. It then makes trades on either side of
this value. It doesn't even look at a ticker. The only input is whether a
trade is made or not, and the balances you have of each currency.

------
greenleafjacob
> Setting it loose for the first time, knowing that any bug could literally
> throw away cash, was terrifying.

I am interested in projects that deal with real cash values as well and the
unique concerns that come in. One design pattern I've read of is circuit
breakers, like those used on the official exchanges [1] are typically
implemented in HFT's; just stop trading if your total net loss that day is
some order of magnitude higher than your typical expected losses.

I expected the market for bitcoins was saturated with market makers.
Interesting that author was able to set up shop and make money.

[1]: [https://www.nyse.com/markets/nyse/market-
model](https://www.nyse.com/markets/nyse/market-model)

~~~
lucaspiller
OP didn't say how much he was making though, I expect it's more a free trip to
Starbucks every week rather than sipping mai tais on a beach.

~~~
Rainymood
And it's also how much risk he's taking. Which is unkown to him I figure? If
you risk 10k for a chance at free starbucks every week ... not sure if I am
willing to take that risk.

------
imaginenore
1) How do you deal with wash sales tax rules?

[http://www.investopedia.com/university/definitive-bitcoin-
ta...](http://www.investopedia.com/university/definitive-bitcoin-tax-guide-
dont-let-irs-snow-you/definitive-bitcoin-tax-guide-chapter-1-trading-gains-
and-losses-d-wash-sales-impossible-track.asp)

2) How much % do you make a month from it?

~~~
toast0
Not the OP, but the best way to deal with wash sale rules is to never sell at
a loss. :) Other options would be

1) close out all positions around december and wait 31 days (and until the
next year) to open positions again.

2) There's a mark-to-market election you could use to be not subject to wash
sale rules, this seems like a complicated topic, but is probably worth
investigating.

3) In line with always sell for a gain, you may be able to structure bitcoin
lots like you would stock lots, and sell specific lots to avoid many wash
sales.

------
sputknick
I love this story and I love the idea of it. This sounds like a fun way to
feel like a big baller. But I'm dying to know how much he's making. How could
you write an article about how to make money doing something, then not at
least give us an idea of how much money you made!?

------
Animats
This "high frequency trading" isn't making liquidity. It's faking liquidity.
Buy and sell orders with specific price triggers can be put up and taken down
rapidly without ever being executed. Most of this type of trading does just
that. The Bitcoin world calls this "fake walls".

If an order couldn't be taken down until N minutes had elapsed, orders would
represent real liquidity. You could look at the market and know you really
could buy or sell a large volume at some amount. What actually happens is that
there are orders that run away if they're close to being executed. That's fake
liquidity.

~~~
functional_test
This is blatant misinformation. Please stop spreading it.

Canceling orders is something _all_ participants do. It's a vital part of risk
management and a healthy market. Some markets do have minimum quote lives, but
they typically fail as market makers cannot manage risk there, so trading
moves elsewhere. The only time I've seen a market place survive adding MQL's
is when they were on the order of milliseconds, not minutes.

There are certainly strategies that are manipulative. For example, having a
hidden order on the ask and posting an inflated bid then pulling it once your
ask gets filled. Since you posted it with no intention to get filled and with
the intention of manipulating the price, that's spoofing, and illegal.

But the fact that someone placed an order and then canceled it when the price
got close means exactly nothing -- everyone does it as a part of normal
business.

~~~
JoeAltmaier
Confused: you describe the practice as both 'spoofing, and illegal" and "means
exactly nothing". Which is it? How do you tell the difference from innocent
cancellation and malfeasance? Maybe that's what the Op was getting at.

~~~
kasey_junk
Spoofing laws hinge on "intent". Like literally the exact same behaviors have
a different legal status based on "why" you did it.

The way spoofing rules are usually proven is via examinations of patterns
(like do you only do the cancel trick when it directly moves markets into your
real position) or via old fashioned examination of documents (did you send an
email that said "Let's spoof this market like crazy").

------
uknj
I highly recommend the book the author mentioned: Flash Boys, I found it a
really interesting read.

~~~
kasey_junk
I conversely drastically don't. Further, I've yet to meet anyone who is
technically knowledgable of HFT systems who does.

See [http://kc.my-junk.info/hft-books/](http://kc.my-junk.info/hft-books/) for
what I do recommend.

------
SniperOwl
I'm curious to know what the AUM of the account is, is this a one man shop
trading over regular internet lines and how much is paid in commissions a day
on average?

------
jklein11
Just curious... would your market making strategy be susceptible to the
spoofing strategy that allegedly caused the 2010 flash crash.

~~~
kasey_junk
> My bot even has additional logic to prevent it from being tricked by fake
> volume walls from other bots.

Not the author, but this sentence I believe speaks to counter measures he is
using to prevent spoofing.

But like any counter measures it is an arms race. As the spoofers get more
sophisticated he has to be as well.

------
j_lev
> Market-making also delivers real social utility. The deeper the liquidity
> provided by market makers, the more difficult it is to cause erratic spikes
> in price. Market makers also reduce the bid-ask spread, a concept most
> people aren’t even aware of: a testament to successful practitioners on Wall
> Street.

Until they don't. The moment people need liquidity the most is the moment the
market makers have pulled all their orders and the market is in free-fall.

~~~
tptacek
This statement doesn't make sense. People don't need liquidity at a moment.
Liquidity isn't binary. Less liquidity, higher spreads, higher cost of trades.
Those costs are a tax paid by long-term investors into the pockets of
middlemen.

~~~
hawkice
I'm not parent, but here's an idea that's floating around, maybe it can be
used as a reasonable guess to as how to make sense of it:

There is a concern that high frequency trading is technology that, while
creating liquidity, increases the tax paid by long term investors. Instead of
having a meaningful spread, long term investors often have trouble filling an
order before the entire market jumps, settling back down less than a tenth of
a second after the investor's trade clears. The tax is paid a different way,
and often at much higher amounts, given the limited data coming from trading
arms of various banks.

So there is more liquidity, which is good (although, as a civilian, I still
need 3 days for _my_ trades to clear on the stock market, so I guess if it was
such a huge public good for trades to clear faster the rules would be
different). But the market is so jumpy, and so few of the orders placed
reflections of actual investor intent, that markets can enter free-fall more
easily (because it's happened for no reason). So there is higher liquidity,
but it doesn't come with two of the upsides of a free-flowing market:
stability and lower transaction costs.

~~~
harryh
It's true that some people have that concern but the concern is not backed up
by evidence. In fact, all relevant data indicates that trading costs have
fallen by an enormous amount due to the automation of trading.

------
sneak
What you are describing is not open; you went through several legal hoops to
be able to participate in these markets. Not just anyone can do what you did.

~~~
Bootvis
Which legal hoops do you mean?

~~~
sneak
These days, participating in most western bitcoin exchanges requires going
through many government requirements such as providing identity documents and
going through various arbitrary screening and watch-list checks.

Of course, if any of these public or private databases matches you, it's not
really in the exchange's interest to go to bat for you. There are other
customers and they do business based on volume.

The basic premise that bitcoin has ushered in this new system of open money is
false. Everything he describes is happening on existing, closed businesses.

The fact that the asset he's trading happens to be bitcoin is somewhat
immaterial.

