Episode 009: Opening The Black Box: Algo Trading 101 for Crypto Investors

Updated 2 years ago by CoinFi

Algorithmic trading, or algo trading for short, is a term commonly thrown around in traditional finance and usually brought up when talking about institutional money or market makers. In this episode of the CoinFi Podcast, you’ll learn how algo trading applies to today’s crypto markets, how high-frequency traders profit from algos, and why algo trading may actually benefit the average, everyday traders in the long run.

Show Notes


Tim Tam – CoinFi CEOJonney Liu – Head of Crypto ResearchEugene Khaimson – Head of Quantitative Analytics

  • [1:17] Topic Introduction – Nate
  • [2:25] What Exactly Is Algorithmic Trading? – Eugene
  • [3:19] Historical Equity References and Predictions for the Future of Crypto Markets – Tim
  • [6:00] Is Algorithmic Trading Necessarily Better Than Human Trading? – Jonney
  • [8:15] Best Price Execution: Why Is It Relevant to Crypto Traders Today? – Eugene
  • [11:22] Effects of Algorithmic Bot Trading in Today’s Crypto Markets – Eugene
  • [15:37] Benefits of Market Maker Influence and Strategies for Traders – Eugene
  • [16:45] Decimalization and the Tightening of Spreads – Jonney
  • [18:13] What Is A “Spread” and How Does It Affect the Average Investor? – Jonney
  • [19:12] Issues with Liquidity Segmentation – Eugene
  • [21:22] How Algorithms Can Assist with Order Execution – Tim

Tim Tam: You need to sign up to 30 exchanges, slice out thirty orders at the same time. If you even want to do one exchange, like Eugene said, and it's only trading 30,000, and you're buying $10,000, that's effectively going to take you 24 hours. You want to sit in front of a computer screen and click, click, 24 hours? I guess it's like playing space invaders or something, but yeah, you've got to be very patient, and I think that's why people are impatient, and they just lift the whole market and overpay 5 to 10 percent, and then effectively these trading algorithms/market-making high-frequency funds take advantage of that impatience.


Nate Tsang: What's up CoinFi fans? Welcome back to another episode of the CoinFi podcast. Thanks so much for joining us. Today we're talking about algo trading. You'll learn about how algo trading evolved, and how it applies to the crypto markets today, how high frequency traders extract money from the system, but why in the long-term this may actually be a good thing for the average crypto investor, and you'll also learn how the average crypto investor, surprisingly, ends up with the same problem executing trades as large institutional traders in the equity markets.

With us today are three CoinFi team members who spent their careers in institutional trading. First up, we have Tim, CoinFi co-founder and CEO, as well as a former hedge fund trader. We also have with us Jonney, our head of crypto research and formerly a senior portfolio manager at an arbitrage volatility hedge fund. And finally, we have Eugene, and experienced algo developer and our head of quantitative analytics, and of course as always I'm your host Nate Tsang.

Now a lot of our listeners have probably heard of algo trading, but to a lot of people it's also a very black-box concept, no pun intended of course. Eugene, you've built your career developing trading algos for institutions, can you explain to our listeners, what is algorithmic trading?

Eugene Khaimson: Yeah I think we can basically break it into two big parts, right? One is the algos that actually decide when to buy and when to sell, and those algos need to make money, and make profits, and the other type of algos would be the efficient execution, what they call algos, which basically give an instruction "I want to buy" or "I want to sell", usually a large quantity, and do it efficiently and then those algos will execute efficiently those instructions, but they don't decide themselves if to buy or to sell, and I think we're more interested now in the first type, the ones that are actually buying and selling and trying to make money.

Nate Tsang: So, let’s take a step back. We've always had a thesis here at CoinFi that the history of the equities markets can tell us a lot about the future of the crypto markets. This first type of algo trading, which involves using high-frequency algos to trade and generate profit, how did it evolve and how does it apply to the crypto markets today?

Tim Tam: So, I think a good example of the history on evolution of algorithmic trading in the equities and futures space really is, I mean, people are probably very familiar with the Nick Leeson story. So, Nick Leeson is a famous trader that eventually blew up, but his primary trade, he was an Englishman trading in Singapore, and what he was doing was a futures arbitrage trade on the Nikkei futures. Nikkei futures is basically the most liquid future on the Japanese exchange, and what he was doing is he was buying, calling his trader in Osaka, in Japan, getting the price of the future there when it was cheaper, he was buying it Osaka and then simultaneously selling the same future on the Singapore futures exchange. So, selling the Nikkei future on the Singapore futures exchange, and pocketing that difference as an arbitrage trade.

Now, with the evolution of technology in algorithmic trading, I mean, no one does that anymore, no one can make any money, because the computers are way faster, you can plug directly into the Singapore Simex Exchange, and plug into the Osaka exchange to check both prices, and whenever there's an abnormality there are algorithms which go out and do exactly the same thing, buy on the Osaka exchange, and sell on the Simex and make money.

Jonney Liu: Yeah. The funny thing is that that was what he was supposed to be doing, but we actually all know that he end up selling a lot of puts, and when the earthquake in Kobe happened he lost pretty much the shirt, right?

Tim Tam: Yeah, yeah. So, I mean, that's interesting you mention that, what happened in the end he was supposed to be doing pure arbitrage, so it was supposed to buying and selling, but in the end he ended up buying a little bit more, and having a long position, and then he was also hedging selling puts and effectively-

Jonney Liu: He's taking direction right?

Tim Tam: He was taking a directional risk on a very, very large notional size.

Jonney Liu: Wait, that's actually an interesting thing about algorithmic trading in a sense that if you have a pure system where it's well defined, then you actually take away all the human emotion. What he did is he eventually went beyond the rules, right? And decided to go, "hey, hey I want to go long on the Nikkei future" or "I want to do puts", and he put the losses into a separate account, right? So, actually the algorithmic part, had he done it correctly, should have been profitable.

Tim Tam: Correct, but I think this is an interesting philosophical debate as well, is algorithmic trading, you're very logical-driven Jonney, and the point, if I read into it there, is you're saying that algorithmic trading in that case is better, because it would have performed as expected, but the danger I always felt is, and we have all these things in the equities markets, and it's happening already in the crypto markets, you have these flash crashes. So, you have a coin trading, and the suddenly for no apparent reason it's down like 30% and bounces back just because effectively there are algorithms in the market that are auto-trading and not doing it correctly. So, is algorithmic trading better than human traders?

Jonney Liu: So, the term "it's supposed to be doing what it's supposed to be doing" is not completely correct. It does what you program it to do, right? It removes your emotion, but if you program it wrong, then it'll do wrong things.

Nate Tsang: You hear about a lot of funds and people getting rich using algorithmic trading, how does this affect the average retail investor, who's actually trading against these algos?

Tim Tam: And that's a good question, and I think the first question is, I mean, who are all these people making a lot of money doing algorithmic trading? I think the people who made a lot of money doing algorithmic trading, especially last year, are ex-finance people who got into crypto early, and the reason they make a lot of money is, when there are inefficiencies in the market you can look, as a human, manually, to take advantage of it, something like an arbitrage trade, but if you have effectively a computer, an algorithm that goes in and trades automatically, and you do it at scale, you can make a lot of money doing that, and I think last year, especially when there were a lot more arbitrage opportunities and the market was very volatile, anyone who had an automated system set up to spot this and trade at scale definitely made a lot of money.

Jonney Liu: I think the key term that you put out there is "at scale", right? Because you can technically, last year you could technically click and you could probably make a couple percents, but the idea of making a systemized trading strategy is where algorithmic trading really comes in to play, right? I mean, you can still make it systemized, but you're doing everything manually, you're just not fast enough to be able to take advantage of this. And that goes the same for the equities world like, before there used to be all the opportunities in the 70s and 80s, because people just didn't know, right? But over time as venues got faster and as exchanges became electronic you needed to be incrementally faster, and therefore algorithmic trading was born.

Nate Tsang: Let's talk about the second, less well known type of algo trading. This form of algo trading isn't about using bots to go into the markets and scale up profitable trading opportunities, it's about using algos to slice orders, and get best price execution. Outside of institutional trading and equities, the second type of algo trading is not as well known, and that's because if you're a typical retail investor in equities you generally aren't trading enough volume to really need the best price execution algorithm.

Interestingly in the crypto market where you have a lot of small-cap coins with low liquidity the average crypto investor actually finds themselves in the same position as large institutional traders. Eugene, maybe you can tell us more about the history of using algos to execute orders, and more importantly, why is it so relevant to crypto traders today?

Eugene Khaimson: Basically, people start using computers to calculate positions in the 1970s, right? And then, as the markets became more technological and electronic, the computers started connecting directly to the markets to execute the trades, and by the end of 1990s basically, there were several pretty big funds, and investors, banks that were basically electronically trading across the futures and equities markets, right? It came to that basically 60%-70% of the equity and FX markets are fully automated trading in US, and Europe probably 50-60%, right? What drove that is that the same securities started trading on multiple exchanges and venues, right? Which made very- and also the decimalization, the tick size became very small, so made it very difficult for the human traders to manually trade larger stocks, right? So, they had to very quickly split in into very large number of small orders, and continuously send them to various exchanges. So, that basically made it impossible for traders to trade.

So, people invented computers and algo trading to efficiently execute, and to trade, and make markets, and buy and sell, and make money, and then this whole 30 years evolution basically happened over the last two, three years in the cryptocurrency markets, right? So, where we find ourselves now is that totally automated markets, everybody can connect to them, right? Flat, very flat playing field, right? Like, any student can connect from his dorm room basically, and start trading. What else? Very big segmentation, right? So, you have like tens or hundreds of markets where you can trade, and a lot of different currencies. So, that actually makes it very challenging to trade manually, efficiently right?

Tim Tam: So you said, does that mean, Eugene, when I'm buying a coin in the market, who am I buying that coin from? Who's selling to me? Is that an algorithm? Is it a human? Like, in the crypto market, most of the time, who is on the other side of the trade? Who am I actually buying the coin off?

Eugene Khaimson: I would say, when I started first thinking about it, I thought it's like retail dominated, because there's no institutions there, right? So, it must be all retail people who bought Bitcoins and Ethereums, and they're basically investing their own money, but looking at the- especially on the more liquid exchanges, looking at how the order book moves, and the frequency of trading, and the speed of moving the prices, it looks like it is actually much more, at least the liquid exchanges, are much more dominated by algorithmic trading companies, right? Basically, the same companies that make market and move the equity and FX markets at the speed of light, right? The same currencies are moving into the cryptocurrency space, and start basically dominating the providing of liquidity and trading on cryptocurrency exchanges.

Tim Tam: So, you're saying that in the crypto space you're having all these high-frequency hedge funds and market makers moving in on Bitcoin and Ethereum on the liquid exchanges, similar to how they're effectively doing the same on the equities markets making money. I mean what does that mean for me, as an individual crypto investor, is that a good thing or a bad thing if I'm buying Bitcoin versus three years ago when they weren't there?

Eugene Khaimson: Yeah, so, well, we got back in 2014 when the Flash Boys came out, right? There was a heated debate about- mostly in US, about what is the effect of the high-frequency trading companies on the efficiency and the cost-

Tim Tam: On the markets right?

Eugene Khaimson: On the efficiency of the markets and the cost of executing, basically the question was: are they bad or good? And the Flash Boys, the book, Michael Lewis-

Tim Tam: It was quite negative right?

Eugene Khaimson: Yeah Michael Lewis was very negative, right? Of course.

Tim Tam: What is the true story.

Nate Tsang: Well, why was he negative, for people who have not read the book?

Eugene Khaimson: Yeah. So, basically... Okay, so, the argument against high-frequency guys was, that they basically make money preventing the large institutional investors from executing at the best price. So, they detect that the institution investor wants to buy or sell, or that his order hit one of the venues of changes, and then they start buying in front of that institutional investor on other exchanges driving the price up, and forcing the large institutional investor to buy at higher prices, right?

Tim Tam: Does that happen in crypto, do you think? Because I think we've done a few videos on this, and people are clearly noticing this. On all exchanges, if you are trying to buy, and you put your bid in at the best bid, you'll notice even today that people will jump ahead of you and bid ahead of you, does that mean that people, there are bots trading ahead of you, and doing the exact same thing, and trying to know that you're buying, and trying to force you to buy at a high price?

Jonney Liu: That is one of the strategies that a lot of algos do, is that as soon as you show an intent to buy then they say, "Hey, I know Tim is going to come in and buy, so he might be the person who's just going to pay any price, so maybe I'm going to make him pay more." That's how these guys, in Flash Boys, at least how they are depicted, make money. They try to figure out- they say, "Hey, you have high chance of buying, I'm going to make you pay more, and I'm going to buy ahead of you, because you're going to push up the price, and when you push the price up, I'm going to sell it back to you at a higher price", right? So, they're effectively having this, they say "unfair advantage", of knowing that you're going to put an order in there, and when they see that they immediately adjust the price to reflect that.

Tim Tam: But you can just be patient and buy at your price, right? I mean you don't need to chase it higher. So, why is it a bad thing?

Eugene Khaimson: Yeah. I mean it depends, right? Of course, if you're urgent on the execution side, right? or if you're just willing to buy, but then what happens is if they move price away from you, and you are not willing to move to the price, you are not executing it, right?

Jonney Liu: Yeah. You gotta think about it like, when not even you're a retail trader, but just imagine you send an order to a broker, and you say, "Hey, I want to buy Apple stock at the close" or something, right? Then they're going to try and get the best price, because according to what they should do, they should always try to provide you best price execution, right? But in the end they have to get you billed. It means they are paying extra two, three, four cents above the price, right? Just to get you billed, they'll do that, right? but for these market makers, or these guys who are running a lot of orders, doing high-frequency trading, and algorithmic trading, if they add up a few cents across many, many, many trades that's suddenly becomes a very popular position.

Tim Tam: Yeah, and I see the point, but the difference is that the broker knows that you're buying, so if they screw you it's bad, because they have info that you're actually buying, they know your full size. I personally don't have a problem with all these high frequency market makers, because they're putting in a capital risk, and they don't know for sure what I'm buying, right? I mean the reality is I could just be buying a small size, and not wait, and be patient waiting, right? So, personally I have no issue with it.

Jonney Liu: There's actually one example I remember reading about someone who used to work at one of the quant algorithmic trading houses. They moved to another place knowing the algorithms of the previous firm that he worked at, and they knew that it was similar sort of algorithm where you put a bid there, then they'll come in and start buying the price up. So, what he did was that, knowing that, he started putting in a lot of fake bids to drive the price up, and then knowing that this previous firm would have an algorithm that would instantly buy the prices higher, and he'd actually turn around and sell-

Tim Tam: That's smart. Is that good or bad?

Jonney Liu: Like you said their capital is at risk it's not a guaranteed-

Tim Tam: So, my conclusion is, effectively, the Binance market maker should call a recruiter, and go work at OKEx.

Jonney Liu: Yeah, maybe. I don't know if the Binance guys are using the high-frequency trading, we don't know who the participants are

Eugene Khaimson: Yeah, okay. So, I mean the bad thing is, basically, it's more difficult to trade for large institutional investors on equities, but the argument for the market makers was, that there's a healthy competition between them which drove down the Binance spreads and improved liquidity on the markets. So, if you're a small retail investor, and you want to buy like, one lot of Microsoft or Google, you go and exchange the price of crossing the spread become actually much smaller, because they all compete to collapse the spread more, right?

Tim Tam: So, let me translate that.

Eugene Khaimson: So, you get a very competitive price.

Tim Tam: Let me translate that to the crypto world and prove if I'm right or wrong, So, if you are looking to buy Bitcoin you should effectively go on a very liquid exchange, something like Bitfinex, because, like you said, there's a lot of market makers in there, the spread is very tight, but if you go to an exchange for example like Coinsuper, which is less trading on average, because there's less market makers, you're going to be paying a more expensive price. That's what you're talking about.

Jonney Liu: Yeah. The thing is you might get gamed, but as Eugene said, the spread is much tighter that you end up paying less if there's enough competition between all of them.

Eugene Khaimson: You cannot get gamed if you only buy one lot, because once you bought it you're done, right?

Tim Tam: So, I guess the conclusion is, if you're buying a small size in crypto, you should just effectively go to the most liquid exchange and just buy it, and you're not going to get screwed, because no matter how many high-frequency market makers there are, you can get your order filled immediately.

Nate Tsang: I want to talk about the decimalization, which is the tightening of spreads. I think people don't know this, I mean, I wasn't trading then, but people I've worked with who were, you gotta realize, as early as like 2005, 2006, before the big decimalization happened, buying Microsoft stock was not one cent wide, right? You want to buy some Microsoft stock, it was like ten cents, twenty cents, and the tick size was also a lot wider as well. So, even though a lot people say that these market makers have a really unfair advantage, or these high-frequency traders, and you're trading against algorithms, they're bad, they have extra advantage, you gotta realize that the average retail trader, as Eugene said, their spreads have never been this tight, you could never get this volume that you want.

Eugene Khaimson: Yes .I would say that, basically, for the cryptocurrencies that means, well, if you're not an institutional investor then algorithmic trading is good for you.

Jonney Liu: Yeah. I would agree like, for the average retail investor, I don't think that they, in actual fact, by having market makers in very liquid coins, unless you're buying millions of dollars of Bitcoin, on average you're going to be doing better, because the price you pay today is going to be much better than the price you pay three years ago, predominantly because the spread is tighter.

I mean, do you want to explain, why a tighter spread means it's better for the average retail investor? Look, the way I look at spread in general like, the spread is usually referred to as the bid-ask spread, the difference between ask price, the best ask price, and the best bid price, so a tighter spread means it's just less cost, because if you had to pay significantly above the bid price, that is essentially like a transaction cost that you have to take into account, right? And if it's very, very wide your transaction cost, in theory, is a lot more, right? And that adds up incrementally, imagine having to pay an extra 1% just to buy your Bitcoin, and then turn around and sell at 1%. In order to make money you have to have made 2% in order for that transaction to be worth it.

Eugene Khaimson: Yeah, what I notice though, in cryptocurrency markets as very different from FX or let's say equity markets in US, Europe is that the moment that the personal investor moves beyond top twenty cryptocurrencies. he might find himself in the position of the big institutional investors in equity markets. because cryptocurrencies, because of the liquidity segmentation between different exchanges, and different payers, actually might become very liquid. So even like, I checked for example, today, even if I'm a normal retail client, and want to buy, let's say, $10,000 of Bitcoin Diamond, because I believe the Diamonds will go up, the best friend right?

Tim Tam: Bitcoin Diamond is even better.

Eugene Khaimson: Yeah, Bitcoin Diamond, yeah.

Tim Tam: It's a guy's best friend, not a female's.

Eugene Khaimson: Guys best friend. So, it's ranked number 45 cryptocurrency right now on CoinMarketCap. Top position more than 160 million dollars, and it trades more than 1 million dollars in 24 hours. So, that sounds like a very liquid currency, you should be able to buy $10,000 of that very easily. Now, not really, even if I have an account on Binance which is one of the most liquid exchanges, and I hold Ethereum, and I want to go and buy $10,000 worth of Bitcoin Diamond for my Ethereum, I would run into big problem, because if I want to buy $10,000 immediately I would move price by something between 5-10%.

Tim Tam: That's a lot.

Eugene Khaimson: Yeah, yeah. So, I actually find myself in the position of institutional investor with very large order trying to trade in the market which is very liquid, because even though the currency, the coin itself, Bitcoin Diamond seems to be very good and liquid, but my specific pair, in my specific exchange, even though it's on Binance, which is very liquid, it's still very liquid, it trades 30,000 US dollars in 24 hours, so it means $10,000 each 8 hours, so if I have 8 hours, and I have $10,000 to trade, I basically will be the whole market.

Tim Tam: So, what is the take away for the average user who wants to buy Bitcoin Diamond? Is there a more liquid exchange, and should they be looking at, for example, the Binance, I don't have the screen in front of me, but I imagine Bitcoin Diamond and Bitcoins are more liquid payer trades more than 30,000. So, the two takeaways I have from you, from what you said there.=, as a trader I would look for the most liquid exchange, you should generally trade on the most liquid exchange, and even though CoinMarketCap says it's 1 million trading volume across multiple exchanges, you need to be cognizant of the exchange pair that you're trading, that you're not a large percentage of the volume, otherwise you can move the market, and these market making algorithms can effectively take advantage of that.

Jonney Liu: So, let's actually look at the flip side of algorithmic trade, were taking about algorithmic trading as market makers who are coming in, and posting a lot of bids and offers, and moving the market or trying to trade ahead of you or providing liquidity on the positive side, but let's talk about how algorithms, which Eugene has a lot of experience in, can help order execution. Like how would this, in this case help?

Tim Tam: I think Eugene can answer, but I imagine, in a most efficient world, we'll build an algorithm that effectively slices orders to all those Bitcoin Diamond exchanges whether it's Binance or probably OKEx and whatnot, all of them, and you'll trade all of them simultaneously, so you take advantage of that 1 million volume. Is that correct Eugene?

Eugene Khaimson: Yeah. I'd say that's probably coming to the exchange more as the service to a bigger clients or institutional, but even as we see that even the retail clients end up basically being like a big whale in the small pool, right? With less liquid currencies we'll see, I think, the beginning on the service that provides like a best execution basically going to the more liquid places and finding the better price for the client, even the client himself or herself still might not have that currency, let's say Bitcoin, right? They have Ethereum, and might not have an account on the exchange, which provides the best price on liquidity, there will be services that will provide this service for them, and give the much better execution.

Jonney Liu: Why can't a retail trader just do it themselves? I mean it sounds easy, you just slice it up, and you send orders, sign up for a few accounts, why don't they just do that instead?

Tim Tam: You need to sign up to 30 exchanges, slice out thirty orders at the same time. If you even want to do one exchange, like Eugene said, and it's only trading 30,000, and you're buying $10,000, that's effectively going to take you 24 hours. You want to sit in front of a computer screen and click, click, 24 hours? I guess it's like playing space invaders or something, but yeah, you've got to be very patient, and I think that's why people are impatient, and they just lift the whole market and overpay 5 to 10 percent, and then effectively these trading algorithms/market-making high-frequency funds take advantage of that impatience.

Jonney Liu: Yeah. So, basically, you can write algorithms, or there's algorithms out there that help you patiently buy orders without you having to physically be behind the screen to slowly buy every single one, so it's actually leveraging your time, right?

Tim Tam: Yeah. Exactly.

Nate Tsang: Sounds like a very useful service, do you guys know a company that might be working on something like this?

Eugene Khaimson: CoinFi.

Tim Tam: Cut that out.

Nate Tsang: Thanks for listening everyone. We hope you got something out of this conversation looking at both the past and future of algo trading. You can find the show notes for this episode at coinfi.com/podcast. Thanks to Tim, Jonney, and Eugene for taking time out of their busy day to share their thoughts. Be sure to hit subscribe, and we'll catch you guys next time on the CoinFi podcast.

Thanks for listening to the CoinFi podcast. If you enjoyed this discussion and want to hear more, we'd really appreciate it if you took a moment to leave us a review on iTunes. That helps others find us and lets us continue to record more episodes for you guys. If you don't think the podcast if worth a five-star review, we'd love to know so we can improve for next time. Please hop on over to coinfi.com and leave us a comment. We'd love to hear how we can do better next time.

If you're still listening at this point you might be wondering what exactly CoinFi is. CoinFi is a market intelligence platform for crypto investors powered by the CoFi token which is available for trading at kucoin.com and gay.io. Find out more about the CoinFi platform and the CoFi token go to coinfi.com/about.

Also, keep and eye out for the launch of CoinFi news. CoinFi news gives crypto investors like you an information advantage. Be the first to know the news that moves the markets, including when a token gets listed on a new exchange. To get early access to CoinFi news, go to coinfi.com/news/beta to sign up as an exclusive beta tester when the product launches later this summer. We are only accepting 500 beta users, so sign up now to reserve your spot.

That's all for this episode, see you next time.

Thank You for Listening!

To share your thoughts:

To help out the show:

If you enjoyed this discussion and want to hear more, we’d really appreciate it if you took a moment to leave us a review on iTunes. That helps others find us, and let’s us continue to record more episodes for you guys.

The CoinFi Podcast Is Also Available on:

Disclaimer: This is not financial advice. CoinFi is not a financial advisor and NEVER provides tips on what to buy, sell or hold EVER. This podcast is to give our views and share a fun environment to have a chat about all things crypto and beyond in the CoinFi office. If you wish to invest in anything make sure you seek advice from your financial advisor first.

Was this helpful?

Powered by HelpDocs (opens in a new tab)