High Frequency Trading on the Coinbase Exchange
medium.com
medium.com
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.
But there was a whole cottage industry built up of consultants which promised to tell you which specific room or cabinet in a room had shorter cable runs to the exchange. There were companies that would idle those cabinets/rooms just so no one else could use them.
AWS hosting is more opaque and thus more likely to be gamed in this way. I wouldn't expect anyone to pay for physical presence information (the latency requirements aren't there yet). But I can totally see large players buying massive amounts of nodes in order to monitor/cycle through the best performing ones or in an attempt to impact the exchange operations. You would also expect to see the pay for Amazon employees with non-public details about node creation/communications to all of a sudden become much more valuable to large banks/trading firms.
Is this something that Coinbase needs to deal with right now? No, it isn't big enough or valuable enough for it. But long term the idea of "open" access falls apart under these conditions, and the more fair approach is actually the paid fee one. As counter-intuitive as that seems.
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
➜ curl -i https://api.exchange.coinbase.com
HTTP/1.1 404 Not Found
Server: cloudflare-nginx
Set-Cookie: AWSELB=7541......;PATH=/
It looks like they are hosted on AWS and only provide access via cloudflare.Given that, I don't think offering paid access to be closer is really relevant.
The closest you can get physically would be to find the availability zone - however your traffic is still going to be routed through cloudflare, so you might be better being closer to the cloudflare servers handling your requests.
I'm fairly confident it's in us-east-1 based on a quick glance.
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
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.
It's not so easy though. What if you have a bug in your pnl calculator? Also, do you just block all new orders when you hit the max loss or do you liquidate your positions when you hit the max loss - because that's more code you could have bugs in. Maybe you cancel initiating orders and go to market on liquidating orders? Maybe you have code to limit the number of orders/size you can be working simultaneously - might have a bug in there too!
What if someone clears out the book i.e. a huge sell orders clears out all the buy limit orders and your pnl prints down massively for a millisecond? Should you also sell when this happens - probably getting a terrible exit price or do you wait and see if the book repopulates?
http://www.investopedia.com/university/definitive-bitcoin-ta...
2) How much % do you make a month from it?
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.
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.
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.
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").
In the example I gave, the spoofer's intent is to encourage people to cross the spread into their resting order to avoid paying the spread themselves.
On the other hand, say someone has been resting an order for a long time, for example to buy at 9 because they think that's a good price. Until the bid is at that price, they are unlikely to get executed so they'll keep the order regardless of their position. But maybe they have a large long position on when the bid reaches 9, so they decide to cancel their order to prudently manage their risk by not buying more. This is obviously important in a healthy market -- firms that fail to manage their risk run the risk of cascading failures (if their clearing firm can't cover their losses.
It's pretty easy to tell one from the other most of the time, especially for regulators with access to account tagged data.
Consider what would happen if orders had to stay fixed for a while: Any new information would cause the price to change beyond the fixed orders. People with the information would trade the orders, and the MM would lose. So what would the MM do? Naturally, they will keep things wider to minimise the loss. Which is bad for everyone when there's no new information.
Also, consider what you're saying about large orders. The MMs have said "well, given what the market looks like now, we're willing to offer 100 at this price". Anything up to 100 is fine; you will get filled on all of it so long if you send in a buy of 100. If you want more, they have to be able to reassess. If you're just dipping your toes with 10 at a time, they are entitled to guess that you're willing to pay more. If there's 100 shares offered, and someone wants to buy 1000, they are eating all the liquidity and more. This is information, and needs to be reacted to.
It's no different from any other market. If you're at the supermarket and you buy all the milk, the supermarket is more than entitled to say "hey, I think people are willing to pay more for milk" and restock milk at whatever price they think is sensible.
This implies to the market that there is a ton of demand not far from the price. It shows support for the price level, it shows demand, confidence in the product for sale, and it shows that the price is not going to drop anytime soon even if many people sell, as there's a big-shot with $50m ready to soak up any sell orders for weeks (as normally, daily volume is only a few million).
That's a signal to the market: there is demand, there is confidence, and there is very little downside risk. If I buy, it's likely the price goes up. If many people sell, a large buyer will soak up the price drop and so my risk is small.
When in fact, the guy who put a $50m buy order at $98 will cancel it as soon as the price drops from $100 to $99. He never intends to let that order execute. It's 'fake demand'. He's got some of the product and he's hoping that his $50m buy order is the gesture that fuels more demand, raising the price to say $105, at which point he sells his product, cancels his order, watches the price drop and buys some more product at cheaper rates.
This doesn't have much to do with algorithmic trading, mostly it's a manual set up and the only thing you program is for a bot to cancel an order you set up once it's close to being executed.
His solution is to say you can't just cancel an order right after you created it over and over again. In other words, he's suggesting that instead of an order book, trades ought to only be allowed to buy or sell options. e.g. if you want to buy $50m at $95, you can sell the option for traders to sell you coins at $95 for some timeframe. As any contract, it can't simply be cancelled, and remains valid for some limited time, which means you can't fake demand as once you express demand, you can contractually be locked in to exercising demand. It's not a great solution, don't get me wrong, but I can see where he's coming from.
>When in fact, the guy who put a $50m buy order at $98 will cancel it as soon as the price drops from $100 to $99. He never intends to let that order execute. It's 'fake demand'.
This is precisely spoofing and is illegal in the United States on regulated exchanges (not a lawyer...).
See:
https://news.ycombinator.com/item?id=9427639
https://news.ycombinator.com/item?id=9425164
https://news.ycombinator.com/item?id=9421119
For recent discussions.
There are lots of reasons why regular exchanges don't use the the order standing times, but the simplest one is that spoofers can easily game that. Lots and lots of spoofers put orders in over the course of long periods of time. The issue is that they pull them all at once. Of course pulling all your orders at once can happen for any number of legitimate reasons so it isn't as simple as just banning that behavior.
You can't reliably do that without a crystal ball.
Let's say there is a total of $1m of buy at $99. Then Alice sends a $50m buy order at $98.
Bob sends a $51m sell market order. It will immediately match $1m at $99 and $50m at $98. Alice cannot cancel her order. (if the market in question doesn't support market order, the example still works for a limit order at x<=98).
If you change the example so that there's more depth above Alice's order, e.g. there's $500m at $99 and $500m is relatively large for the average daily volume, then maybe we can assume Alice will have time to cancel her order before it's executed. However, in that case you cannot claim that Alice's order will significantly affect the price.
You can't have it both ways: if Alice's order affects the price then Alice faces the risk of having her order executed; if Alice has very high probability of being to cancel her order, then it means it's far from the best bid/ask, and it won't affect the market much.
Anyway, you can argue the exact numbers, I just mentioned some hypothetical ones. Fact is that big whales and spoofing does exist, it's a well known phenomenon on bitcoin exchanges, and of course is not unique to bitcoin. It's been part of any market place for a long time, it's called spoofing and it's usually illegal because it's manipulative and effective.
As for whether there is risk, yes of course there is risk. People still do it and it appears people have been successful. Especially in immature markets.
I have nothing to say about HFT, but this is terrible. For meny reasons. Thia is requesting every buyer/seller to be in effect be on a laggy connection. It would not be possible to look at the market and 'decide' as every buyer/seller is on the same lag.
People make mistakes and you need to let people get out of the market quickly if they do. (People mistakenly transpose the price and quantity more often than you'd expect, etc.) Having a forced cool down period after placing a short-lived order reduces the impact of these sorts of orders without increasing the risk of mistaken price/quantity/side.
I'm not sure if coinbase allows amendments of quantity and price on existing orders, but they should have similar time restrictions on amending up the quantity or amending the price to be more aggressive following a quantity amend down or price amend more passive.
See http://kc.my-junk.info/hft-books/ for what I do recommend.
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.
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.
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.
People who place stop-loss orders would not do so if they were faced with an order book with no bids. However this is effectively what happens when the market starts to drop and the bids are all pulled.
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.