by atemerev · 9y ago · 0 comments
(Before you ask -- no, there are no any good books and tutorials on HFT trading. You need to grokk it on your own, or receive the knowledge by direct transmission if you are an employee of HFT firm. However, there is "The Problem of HFT" by Haim Bodek, which contains some nice essays from the insider perspective and even some basic examples, though too specific within US equity markets).
1) Bitcoin exchanges are the perfect playground to learn the basics of HFT. All trading data is free and public, most traders are not sophisticated enough, you can start as small as you like (being small is an advantage in HFT), lots of low-hanging fruit are to be picked. HFT proliferation and arms race is barely started on most exchanges.
2) The algorithms themselves are simpler than most people think. HFT trading is mostly unrelated to arbitrage (inter-exchange arbitrage is much slower, and it is a different discipline).
3) The engineering issues are _harder_ than most people think. Even more so with inter-exchange arbitrage.
4) Bitcoin markets are small, and HFT potential capacity is quite limited. Most algorithms I came up with work perfectly well on small scale (and running successfully in production), but I am not making any riches out of it yet.
There are a ton of arbitrage opportunities between exchanges, but the long transaction times are the equivalent of IEX's "speedbump." How do you deal with this?
*Note: IEX is the exchange started by Brad Katsuyama, one of the main figures in Michael Lewis' outstanding "Flash Boys."
I.e. blockchain operates analogously to bank transfers. They are even slower, but they are not used for trading, only for funding and settlement.
The funnest part of writing a bot is using all the historical data to observe how the bot would have done during that period. I ended up checking thousands of permutations of parameters by brute force to determine the best ones, but in the end transaction fees killed me. I didn't have the confidence to do it at a large enough scale to make money I guess.
Making profits with fees is possible, but harder.
Also do you trade on multiple exchanges to perform inter-exchange arbitrage or for some other reason ?
Market makers take a spread. They provide liquidity at a cost.
That's a sure way to find a bad strategy. You end up doing the equivalent of overfitting. If you look at enough variables, the chance of there not being spurious correlations is basically zero, so you're guaranteed to land on sets of parameters that look good with historical data but fail going forward.
1. Private Wallets: Most your coin should be in wallets you control. Your profit margin should be transferred immediately to a cold wallet that your bot doesn't have keys too.
2. Only move coin to an exchange when you for a transaction, and immediately extract it once the exchange is complete. Yes this forces your swaps to have a fairly non-trivial margin.
3. My API tool scrapes several exchanges. But every 24 hours I have to manually input which exchanges to actively consider swaps between. The goal of this is to avoid exchange bad news.
Even with all these safeguards I managed to lose ~$400 when Mt Gox shutdown.
Now that I'm employed I mostly do day/casual trading on NASDAQ tech stocks based on personal tech news/market timing [1]. I went from ~110% yearly gain to ~380% yearly gain. It requires 1/100th the effort and leaves me time for FOSS projects.
[1] Yes I'm aware this is generally considered the worst strategy ever.
I make maybe 1 market movement per quarter (divest/invest). Most my trading is re-enforcing the positions I already have monthly (to avoid per trade costs).
Most my investments boil down to
1. Mid-quarter purchasing if a silicon good ran into shortage issues (not triggered by supply chain but demand). Not dased on official outlets but on local stores/discussion boards.
2. Post announcement hype deflation bidding on products I feel will succeed, or will succeed for technical reasons.
3. Very high risk long duration options on things I dislike or companies losing a sense of direction/product.
4. Connecting the dots on inter-coprate deals. X company buys fab plant from Y company.. 2 years later X company announces data center with Z feature.. 1 year later Y company announces Z feature, no other company does.
5. Watch OSS commits, know the products/markets/technical details to the degree of people working on the products.
6. If its in a magazine/blog you already missed the market.
7. The only internet companies worth investing in are monopolies.
However, counterparty risk is real, and if you can't afford it, it's better to not engage.
On OKCoin, my flagship algo generates more than 4000 trades per day (and many more order placements). However, OKCoin is glitchy.
Nothing too fancy, I rent usual EC2 (or analogous on other cloud) "medium"-sized instances, with 4-8G RAM. All my code is written with Scala/Akka, so it is packed into a single JAR file.
2/ What tools/APIs/etc do you think are interesting to build? Since I am a cofounder of a softwae development company in the cryptocurrency space, I am looking for new insights but not have experience in the HFT space.
Re: 4) what is the performance of your strategy?
The average performance is currently +0.3%/day. Losing days are rare (about 1 in 2 weeks, with about the same average loss). I have survived multiple crashes and liquidity flight events, including the Bitfinex mishap.
I don't do arbitrage (there are easier ways that I hadn't fully exhausted yet), but between e.g. OKCoin and GDAX 30-second delays are common every day.
The best way of dealing with the fees is not paying the fees. ;)
(If requested, it can be arranged, though).