In this episode, we chat with Li Ouyang, who made the transition from derivatives trader on Wall Street to programmer at a crypto startup. She talks about her education at The Flatiron School, her favorite programming languages, and the advice she gives family members who want to put their savings entirely into Bitcoin.
There is a lot to think about when designing trading algorithms, especially in the world of cryptocurrency, where prices can be extremely volatile and limited liquidity means a single trader moving big volume can have a hefty influence on price.
Bitcoin is at a record breaking price these days, but investing in it is not for the faint of heart. To learn more, we chat with Li, who is a software engineer at Coinbase. You can find her on Twitter here.
If you're interested in learning more about Bitcoin, we would have to recommend Bitcoin Developer. After all, they were kind enough to recommend our Bitcoin Stack Exchange as a key resource.
Li Ouyang My dad holding me as a baby and you can see he's sitting in front of a computer. And there's a whiteboard next to him with a system design like I don't know drawing right next to him and I'm like, that is hilarious. That's my life now.
Ben Popper Couchbase is a modern multi-cloud to edge, SQL friendly, JSON document database for building applications with agility, performance and scale. If you're new to couchbase and would like to learn more, the couchbase developer portal is the best place to start. It's loaded with tutorials, videos and documentation, as well as best practice tips, quickstart guides and community resources, including the couchbase developer community forum, ready to get started developing on couchbase? Visit couchbase.com/newtocouchbase.
BP Good morning, everybody. Welcome to the Stack Overflow podcast. It is a very snowy day. I was just transporting some chickens out of their tiny houses into a nice warm barn. Sara! Paul!
SC Good morning!
PF Hey! Good morning!
SC I have zero chickens.
PF Paul, you're in a cardboard city of your own design. Did you build a new lair for yourself?
PF For those who are experiencing this through audio? I have a lot of boxes behind me because I recently moved just like so many people have in the pandemic. And I did that yesterday and I am frickin tired. So you know, get ready for a low energy podcast from old Paul Ford! [Sara laughs]
BP I'm glad that the mic stand was the first thing you unpacked, that makes me feel really special.
PF You know, you can't live unless your home pandemic office is set up. Like that's the first thing. I don't know where the eggs are. But everything else.
PF It's weird that we don't have a substack, guys, it is weird. Sara, we have a great guest today. Would you like to introduce?
SC Yes! Really excited to introduce Leo young today, who's a software engineer at Coinbase, who's going to talk to us about bitcoins and crypto in general.
LO Hey, everybody, how's it going? I actually just moved as well, Paul, on Monday.
PF Oh, it's horrible.
LO And I thought I had everything, I have my and then we unpacked everything but I couldn't find the utensils. And so we couldn't eat for like three days. I don't have my monitor cable. So I'm like hunched over my computer. I have everything else set up. It's just that one little piece that I need. So I feel you.
PF You'll, you'll find it three to six months from now in like a cat's mouth. [Sara laughs] That's how it works. So did you tip the movers in Ethereum? How did that work?
LO No, no, I hadn't. But I am thinking about giving my family some Bitcoin for Christmas because--
LO Yeah, so because my parents, this is scary, a little bit but my dad's been like really talking to me about Bitcoin. I'll just share a little quote that he gave me the other day, he was like, "Well, I had this cash that I was going to buy rental property with but I think it's a better investment to put it all into bitcoin instead. And because very soon, yes, dollar will be the reserve currency of the world anymore." And I was like, "What the heck are you reading Dad? Stop!" [Sara laughs]
PF Mmmm... I know what he's reading. Wow.
BP That's amazing.
PF And then instead of that heart replacement? Bitcoin.
BP Maybe he read that piece from the New York Times, which is quite good. It was about going out for a sushi dinner, back when Bitcoin was $100 a pop, spending $1,000 and feeling really special and the sushi restaurant owner held on to it and now can retire on that $1,000 dinner. Yeah.
LO Did this article just come out two days ago?
BP Yeah, it just came out. And it was at that point in time, there was only like two eateries in San Francisco that would accept Bitcoin and one of them was the sushi place.
SC So it's a it's a relevant time to talk about this because Bitcoin hit 21k yesterday, which is record high. But Li, I'd love to hear from you. What got you into crypto? Have you always been interested in crypto? Did you happen at a company that was in crypto, what how did that happen?
LO So my story is a little bit funny, because in a way, I got onto the crypto train pretty late. I mean, the Bitcoin white paper came out in 2008. So before I was an engineer, I used to work on Wall Street in finance as a derivatives trader at JP Morgan. And I remember like Bitcoin coming out in 2008. And already there was a Bloomberg article about it, there was already like a Bloomberg chart on it, maybe like, not more than a year later. And I remember I remember dismissing it. I was like this is for anarchists, because at the time, it was in the middle of the financial crisis. And people were like, there was a subset of people that were like, "You need to load up on guns and water, bottled water" and that's the type of world that's that that is in our near future. And so I was very dismissive of that. So I was like, oh, whatever. So didn't even like pay attention to it, and then worked through the financial crisis. And then didn't even didn't even think about Bitcoin again, unfortunately, stupid me. But then in 201, 2012, I transitioned to become an engineer. So I was now like thinking much more about technology and software. And I was sort of hesitant to become a software engineer, but I had a great mentor at that time, Avi Flombaum, who's the founder of Flatiron School and he convinced me he's like, "Whatever career or whatever field you want to go into technology is going to play a role, Li, so this is really important." So I sort of like alright, you've convinced me, that's a little foreshadowing to what's to come later in my in my life. I move over to San Francisco into Silicon Valley and in 2012, 2013, I'm on the yacht, which is this especially like a Silicon Valley story, but I feel like everybody on the yacht was like, had some like, get rich scheme. Like one person is talking about man made diamonds, someone else is talking about something else. Everyone has some like little side hustle they're working on that's going to become the next big thing. And there's one woman goes to me, and she's like, "You should really look into bitcoin." And I'm like, Okay, sure. But at that time, it was like, I don't know, like silk road esque type of thing, right?
BP I have so many similar memories. Like when I read that article about the sushi dinner. I also did the same thing at the Verge, being a colleague took a bunch of friends out to a bar. It was this guy, Charlie.
LO You met up with him?
BP Yeah, he was the only person at that time is running a bar that accepted Bitcoin in New York. And it was like $125 a coin. We were like, this is it. This is the tap, we're all going out for drinks and spent what would now be I don't know, a couple million dolalrs worth of Bitcoin? [Sara & Paul chuckle]
LO Wait, so did you hold on to any Bitcoin?
BP I did not, no. I mean, well, I mean, a tiny, like, a nominal amount, not enough to make a difference in my life, unfortunately. And I feel very silly about it, because I started writing about it in, yeah, 2011 or something when I was at the New York Observer, and it was a big deal. Yeah, more in the financial New York circles as much I think isn't Silicon Valley.
PF Look, man, I had a minor turned on, like, early days. And I was like, yeah, this is making my Mac run too hot, to hell of it. That's where I was at. Like, I mean, this has been, you know--
LO You probably have Bitcoin on a hardware somewhere. You don't realize it or the private key.
PF No, I didn't. It was like after two days, I was like, forget this. The other thing was no, I had a friend who wrote an article back then, like 2009, 2010 early days, and there's this part where he goes, I had to buy some of this ridiculous currency in order to to understand it. So I bought $75 worth at a quarter of Bitcoin. And I later went back I was like, what happened, man? Because this is someone who is immune to money. And he was like, actually, I have a lot of it. I just I bought a couple mattresses. That was maybe a mistake, early days, because they're like, yeah, i was, like the world's worst mall for a while. So you can go to this one bar.
BP Overstock.com was one of the first to accept it online. Got a couple overstock mattresses. Li, what about software? You said you're a software engineer now. When did you sort of learn that stuff? Was it from Avi and Flatiron School? Or how did you?
LO You know, I let me just paint the picture for you. I was like, graduated in 2005. And worked in finance till 2011. Sorry, 2012. So I worked like 12 hours a day, right? So like, I was not, I didn't know anything about meme culture. I didn't really know about YouTube videos, I didn't know how people made money off of the internet. I didn't know anything about the internet. So when I was like, I had gotten laid off, my whole group got laid off, because we were doing prop trading, essentially. And I was like, you know what I want to learn about the internet. Because if you look at the rest of the economy, everybody has very high unemployment rates, except for technology. And I'm like, there's something there. And I want to look into it. So I'm like, stupidly, there was like this thing going around, maybe it still is now that that people would tell other people that everyone should learn how to code at least a little bit. So I'm like, alright, well, I have a lot of time on my hand, let me get into this. And so that's what I did. And Avi was teaching at that time. And it was basically doing like two classes a week for like, in each class was like two hours. I can't think of it right now. And so I like signed up. It was like how to build a website in two months or something like that, using Ruby on Rails. And that's how I, I basically like monopolized office hours, and was he was like "Wow, this girl is really into coding." And I was but and also reality, I had a lot of time on my hands, too. So I was like, constantly peppering him with questions. And then he was really supportive. And he was mentoring me, he helped me get like an internship. And then when he started Flatiron School, he's like, Li, I really think you should do this, you know, you're not doing anything anyways. And at that time, he had helped me so much. I was like, I'm gonna sign up for the school just to support him as a friend. And my mom was like, you're not doing anything anyways, it's better than you sitting at home all day. So you should go do this. Yeah, and my dad laughed at me. My dad who was a software engineer laughed at me.
SC Because he was like used to the traditional system, if you don't go to school for four years.
LO Yeah. But also I think both of my parents are like, "This is silly. You used to make a lot more money i finance. Why would you become a software engineer?" I think that was really the thing.
PF So take it back a second because this is always I think, kind of a foundational question. So I think we know as an audience, right, like, what is Bitcoin? Sure. Let's not do that again. But programming Bitcoin programming, blockchain apps programming daps. You know, like, what do you do when you're engineering in this world?
LO Okay, let me be clear that I don't specifically write anything any like daps or smart contract related. What I do at Coinbase is I work on, Coinbase is building a prime brokerage right now, so I'm working on building the trading algos to it, which is super exciting and super fun to me. But--
SC That sounds very hard.
PF What is a trading algo
LO So like, let's say you like sign up on like Charles Schwab or ETrade. And you want to buy something, you say like, "Hey, I'll put in a limit order to buy like 100 shares of Microsoft at XYZ price, and I'll pay XYZ price." But let's say you're like, someone with a lot of money, you're a whale. And you don't want to just like spray the market and make the market move with your huge ass buy order, right?
SC So like, instead of buying like a billion dollars of something or like 500 million, yeah.
LO Yeah. So let's say you want to buy it, but spread out either over time. So this is called a smart order router. So it'll go out to multiple different exchanges, and do small orders. So it was almost like hidden in the market. So nobody's, nobody will realize it's a big whale. So you could either use like something called a what they called an iceberg algorithm. And this is not specific to create a crypto, yhis is like this exists already. Or you could do something called a TWAP trade, which is time weighted average price. So like over a course of a week, there's continuous by little buys across different exchanges. And then you don't hold market.
SC Explain this to people that that might not know, sometimes in a currency, if someone buys, makes a really big order, it affects other it affects the price of the currency and how and other people buying in if they see a big purchase, they might buy more, or they might take it as a time to sell.
PF Alright, so I would imagine I would imagine programming this first of all, what language do you use to write a trading algo?
LO Right now we're using GO.
PF I have to imagine that you have to be extra special paranoid about doing things that involve hundreds of millions of dollars. [Ben laughs]
LO Oh yeah, for sure.
PF So you know, compared to like, you know, I'm gonna I'm gonna open my index dot HTML and say hello world, to I'm going to launch the the space shuttle, you're probably more on the Space Shuttle side, like, what do you do to code defensively and make it so that you don't accidentally crash the entire blockchain economy?
BP But you worked on Wall Street, losing 100 million, you know, that happens. [Li & Sara laugh] We'll make it up somehow.
LO I have lost like, over a million dollars in a very short amount of time, which felt freakin terrible. So that, like, I'm very, very, cognizant, maybe more so than other people have, like, I think a lot of people in the crypto space are like, I don't even know the term but they're like, "Oh, my God, we're moving. We're gonna make so much money." But I'm very cognizant of losing money and things blowing up because of my experience working on finance. But I would say that, okay, how do I code defensively? I mean, oh, there's so many things, but--
PF Tell a baby programmer, right. Like, I've come to you. And I'm like, okay, I just learned. I did I have a little understanding of finance. I just did Code Camp. What are the things that you wish you'd known as you became an engineer about programming defensively?
LO Okay, I think any FinTech firm, or anybody that's worked with money knows about this. Do not use decimals, use big int, you know, and multiply and divide by 100. You know what I mean?
PF This is the Stack Exchange podcast. I mean, you know--
LO Yeah, so like, you should usually be using ints for sure. I mean, technically, there's still places that use decimals, but like, it's always some frickin rounding error I was just talking about this, is like, because like this, like a TWAP order, for example, you're splitting the trade up into multiple tiny, tiny orders.
PF Wait what kind of order? What kind of order?
TO Oh, TWAP, time weighted average price. So if you take one big order, and then split it all up, they only add up to what the original order was. There's always some frickin rounding error that like it doesn't add up. So that's like number one. That's like something that seems so tiny, you got to think about it. The other thing is any like FinTech engineer is like some time aspect of it, there's always some freakin time aspect to something and it never works out because like for, not crypto, but maybe some fixed income instrument, like we don't count days in finance the same way that like using the regular calendar, the 365, it might be at 3360 day calendar might be a whatever, you know, calendar actual or 360 day calendar. So there's all this like, way time is counted is very specific. And that's something that's kind of confusing.
PF Okay, so you say you like Go right? And then but what we've been told us as baby engineers, our whole lives is like, you should use a strongly typed language for anything like this. Like, why would--it feels like you're--
LO Oh god, it's so necessary. It's so necessary. Because I used to write when I was working at Coinbase. On the exchange side of things, we were writing things in Node. And that was a that was a nightmare.
SC That's so interesting. Yeah. Was it like more security? Was it more like the financial aspect of it was tough? Yeah.
LO No, it was the type checking stuff. Like I don't even know how I wrote code and node for like, over a year. And so basically, what would happen well, so number one, Go compiles, right? So like, you know, something's wrong right away and is strongly typed, so in node, let's say like, the object that's being thrown around all the time is like the order, but maybe this order is like a JSON type object that has slightly different fields because you know, someone is going to name something slightly different, you know, and then maybe it's the database object, or maybe it's the I don't know, whatever object and it's something not all the fields map to each other, and you're just looking at is like, Oh, it's called order. So I assume it has this field and it doesn't. There's some sort of mismatch. So that that definitely happens a lot. I just feel like even though I was writing node for over a year, I still don't even feel that confident in it versus Go lang. I've been writing it, I don't know, I guess, less than a year. And I feel so much more comfortable and confident in it.
SC Some people might see that as a positive. [Ben laughs]
PF No, you know, some people might, but like, when I look at Go, Python, I had this moment with Python years ago, where I realized I had sat down, I wrote a function, I wrote a class, I got done, and I didn't look at any documentation. And I kind of knew what was happening the whole time. And I was like, I've never had this experience in programming before, where myself--
SC Where you're like "I'm a real boy, now!"
BP Alright everybody, thanks so much for listening. Please tune in again soon. I'm Ben Popper, Director of Content here at Stack Overflow. If you want to find me on the internet, I'm @BenPopper on Twitter. And you can always email us firstname.lastname@example.org.
SC And I'm Sara Chipps, Director of Community here at Stack Overflow. And you can find me at @SaraJo on GitHub.
PF I'm Paul Ford, friend of Stack Overflow, check out my company Postlight!
SC And Li, where can we find you online?
LO I'm Li Ouyang. You guys can find me on Twitter as well. I'm at @styliii
BP Awesome. Thanks so much for coming on. And as always, hold on, hold us to the end.
LO Yeah! [Li laughs]