What if You Had to Learn to Code in 48 Hours, or Else?
The phone rang. It was my friend, Mark Sebastian. Mark is a former floor trader, a frequent guest on financial news networks like Fox Business and CNBC, and the co-author of The Option Trader's Hedge Fund. It was a Saturday morning in late 2012 and I was sitting on my sofa, reading articles and drinking coffee.
"We're putting together a new hedge fund, and we need someone to run a backtest on the last 7 years of data. Do you know how to code in R?"
The answer was no, but the question cut deep into my soul. Let me explain why.
Humble Beginnings
I grew up in the "back woods" of rural South Carolina. My home town had one red light. To this day when I visit my parents, I have to stay in a hotel 30 miles away because there are none closer. What most people from the cities don't understand is that living in a place like that, before the internet, was not just living in another place, it was like living in another dimension. I had no idea Wall Street existed. I had no idea Silicon Valley existed. All I knew was I was a smart kid and that was a problem. I didn't fit in. I didn't belong. When I was 12 years old, I took the high school exit exam and got a perfect score. I wanted to skip middle school and high school and go straight to college, but the Principal said, "That's not natural. You need to learn your place." My parents told me I had to respect her authority and follow the rules.
My Way Out
Although I didn't know about startups or hedge funds, I did know about astronauts, and I figured they had to be smart. More astronauts are Naval Academy graduates than any other school, so I went to Boys State, met Senator Strom Thurmond and got an appointment to Annapolis.
Every student at the Naval Academy has to take two classes in Electrical Engineering junior year—even political science majors. As you can imagine, this makes the EE majors very valuable tutors during that year. I like math, and I like to help people, so I majored in EE.
However, once I got out to see the real Navy, I realized very quickly there is a big difference between operations and engineering. Being a Naval Officer is mostly about operations, while the Air Force has careers in engineering. So, I switched to the Air Force.
At my first job, I did a lot of data science and machine learning. We were the oddballs of the Air Force, for sure. Pilots called us the "pocket protector brigade" or "20-lb brains" (which was not a compliment). One of my colleagues left to be a Quant at a Hedge Fund—three words I had never even heard spoken before. He gave me the book that had inspired him, Fooled by Randomness. It was my first window into a world that sounded like a perfect fit!
When I told my Colonel I wanted to be a Quant on Wall St he said, "You'll never get in. You don't have an Ivy League education."
Challenge accepted.
I applied to Columbia University and got my Master's degree in Operations Research with a concentration in Financial Engineering. Most people have never heard of Financial Engineering. It's like most forms of Engineering: take raw materials and package them up into something more valuable than the sum of its parts. Yes, that means mortgage-backed securities, which have since been blamed for the 2008 financial meltdown. But let me take a moment to convince you that Financial Engineering is a real value to society.
Imagine you are Ford. Your job in life is to make cars: a good old, American, hard-working manufacturing business making real things for real people. Well, it takes 5 years to design a car and that car has to then be sold for 8 years in 200 countries. Your profits are razor thin. So, you have a 13-year exposure to steel prices. You have a 13-year exposure to interest rates and currency exchange rates. If any of these numbers move against you at any time, you're toast. So, you call Goldman Sachs and you offload all that risk with some sort of swap. It then becomes their job to wake up every day for the next 13 years to monitor interest rates, commodity prices, and currency exchange rates and hedge away the risk in that position. They aren't "just moving money around" as so many people like to criticize. They are adding real value.
The Big Problem
I left the Air Force in 2008. It was not exactly the best time to start looking for a job on Wall St. Nonetheless, I got interviews at all the big banks and several boutique firms in New York. But those interviews lasted about 3 minutes. There was no "tell me about yourself" question. It started and ended like this:
"Ok, write on that piece of paper, in your coding language of choice, an application that values a call option."
I knew Black-Scholes cold. I could do the proofs. I had spent years at Columbia learning the mathematical formulas that underpinned financial instruments. But they hadn't taught me to code. They hadn't even mentioned that coding was important for getting a job. It was heart-breaking. My "dream job" appeared to be a mirage, just out of reach, because I didn't know how to code.
A Different Path
At this same time, a defense technology startup in DC started recruiting me heavily. They offered better base pay, equity in the company, and treated me with respect. I took the job.
I would sometimes accompany the founder, Jay Harrison, to meet potential clients. He would try to sell them on X (what we could do), but they would say they didn't care about X. Instead, they were looking for Y. Did we know anyone who could do Y? He would say yes, actually, we do that too! When I walked out of the meeting I would ask,
"What do you mean we can do Y? We don't know how to do Y!"
His response was mind-boggling to me at the time, "Yes, but they just told us exactly what they need. Do you have any idea how hard it is to figure out what your customers actually need? All we have to do now is go find people who know how to do Y and hire them. That's a much easier problem to solve."
We grew that company to $120 million per year of revenue in just 4.5 years. Along the way, I started the software consulting line of business for the company and managed several teams of software developers. I tried to take online classes in PHP and HTML a couple times. But the enormity of the whole subject matter, the way it is taught, and its confusing jargon prevented me from connecting the dots to practical application. I regretted not studying Computer Science in college when I would have had the time to take all those classes more seriously. I felt like my career was now on a business-only track, and I could not go back and start over.
My Chicago Business Partners
I met Mark Sebastian in an options-trading club. He was invited as a guest speaker. He had several clever, novel, and useful ideas, so I reached out and we became remote friends. I could see the war in Iraq was winding down, and Ted Cruz's debt ceiling debacle was threatening to gut the defense budget. The writing was on the wall, and I needed to find my next gig soon.
Mark had a friend in Private Equity, Adam Paris, who had a tutoring company in a box. There was a window of opportunity in 2012 to take the company out of the box and run it for 2 years. But we had to act fast. We would have to hire 2,000 employees and launch the program in 1,000 classrooms across 250 schools in just three months! Because I had helped Mav6 through rapid growth, I accepted the challenge and moved to Chicago that week.
Adam was a former investment banker and an absolute Excel wizard. He knew every keyboard shortcut in muscle memory and could do in about 3 seconds what would take a normal person an hour. I'm not exaggerating. He is so fast the screen can't render all the changes he's making so he does it in his head. I was his apprentice.
We had spreadsheets that could log into websites, download attendance records, reshape them into an invoice, and upload it to the district's billing website, all on their own! We would often encounter websites that refused to work with this system. Adam didn't know how to code, but he would rip open the website's HTML and poke at it from ten different directions until he knew just enough to be dangerous, and then he would build another spreadsheet, "write" a little VBA code by recording all those keyboard shortcuts and move on to the next challenge. Adam didn't know how to code, but he didn't let his lack of knowledge intimidate him. He just got it done.
At this point, I was Adam's Vice President. I was second in command of a 2,000-employee company. It seemed like I had it all. And yet, there was this deep fear inside. I knew Orion's Mind would only be around for 2 years and then I was going to have to go back out into the cold harsh world and find a job. Despite all I had achieved, I was afraid that I had this massive gap in my skill set:
I was an engineer that didn't know how to code.
The Question
"Well, do you?"
"I'm sorry, what did you say?"
I was trying to bring myself back from this moment in which my whole life flashed before my eyes. Trying to dig out of this deep unsettling disappointment of feeling forever inadequate because I didn't know how to code. Trying to shake off the painful memory of all those interviews on Wall St I had bombed because I didn't know how to code.
"Sam! Do you know how to code in R?"
"Yes."
Lying does not come easily to me. I grew up in the south, where lying is a sin. I was an officer in the military, where duty, honor, loyalty, and integrity are considered more important than life itself. But I refused to miss another opportunity. This time was different. Mark was my friend, and he would have patience with me. Jay had taught me to just say yes. Adam had taught me to just get it done. I knew the math behind options trading. I even knew what R was. I could figure this out. It was Saturday morning after all. That gave me two whole days to learn R.
"Awesome! There's someone I need you to meet. Come to Wrigleyville. I'll see you in half an hour."
Oh shit. The blood rushed out of my face. Half an hour? This was before the internet worked on the Red Line, so I was going to have to walk into this meeting without even ten minutes of preparation. Shit, shit, shit.
Fork Me on GitHub
I walked into the restaurant and Mark is with this guy who used to be a Software Architect at Microsoft but is now a real estate developer. He is busy building a 1000-unit project in Wisconsin and doesn't have time to work on this hedge fund side-project anymore. Mark is flying to New York on Thursday to pitch some investors. The developer has already backtested 48 months of data, but the investors want 84 months to see how the strategy would have performed leading up to the crash. He asks me, "Can you do that?"
Thursday? I have to be done by Thursday? Oh crap. Well—but—he's already done most of the work. He's left a trail in the code for me to follow. All I have to do is reverse engineer what he's already done and then copy it? Ok, sure, yes, I guess I can do that.
"Yes."
He pulls out an iPad and starts walking me through the code. It looked like total Greek. I tried not to go cross-eyed. I smiled and nodded. I even pointed at things and said, "Ok, and what does this line do?" inquisitively.
After two minutes of this, he says, "Awesome. Fork me on GitHub. Good luck!"
"Fork me on get hub. Fork me on get hub." I repeated the words in my head. They made absolutely no sense, but they sounded really important so I didn't want to forget them. As soon as it was socially appropriate, I pulled out my phone and wrote it down: "Fork me on get hub."
One-Dimensional Problem Solving
I didn't sleep more than four hours in the next two days. It took me almost an entire day to figure out how to even get access to the code. The entire Git version control system is daunting even to seasoned developers the first time they learn it. But I pushed through. It took me many many hours to learn what an IDE was and how to set a breakpoint and step through code one line at a time. But once I figured that out I was golden. It was just solving a bunch of math problems one after another in sequence. In many ways, it was easier than Excel because Excel is a three-dimensional problem space. Data and formulas are arranged in two dimensions on multiple sheets. This application had a single starting point and ran from the top of the page to the bottom in one dimension.
Making it Better
On the second day, I realized the way the application was written had many structural flaws. At first, all values were hard-coded. Blocks of code were copied and pasted and the hard-coded values were changed. This was done once for every month of data. As a result, there was often an inconsistent methodology from month-to-month as the author's formulas evolved. I thought to myself, "Why isn't all this written one time and then run again and again in a loop?" So, I deleted (!!!) the whole application and started over from scratch. What's more, there were some esoteric financial math mistakes that the average developer wouldn't have realized that caused serious flaws in the output. I only knew this because of my Financial Engineering degree. By the time I was done re-writing this application from scratch, it showed that the trading strategy actually didn't work when they had thought it did.
So here I am, having been a developer now for two days, and I have to go back to these guys and tell them to cancel the trip because the strategy doesn't make money. The developer was obviously very insulted. He immediately cracked open my code to look at what I had built. But as he looked through the application, his mouth dropped.
"Wow, you're a really good developer. This is really clever. And this here? Wow, that's so efficient. Damn, how did you come up with this part here?"
I was beaming. It was one of the most terrifying and most exhilarating few days of my life, but I had turned a corner.
Bringing it Home
The next week, I was sitting next to Adam late one evening, plowing through attendance and invoice records when it dawned on me. We could do this with software. I told him, "I'll bet I can download and install R and write an application and run it faster than you can do it in Excel."
"You're on!"
Twenty-seven minutes later he was done. Meanwhile, I had run into a directory permissioning issue on the operating system that had cost me a ton of time. This was completely unrelated to my bet, but Adam wasn't cutting any slack.
"Where ya' at, smalls? What's taking so long, loser?"
Five more minutes passed. The taunting did not stop.
"Ok here. I'm done."
"Oh look and you didn't even do it right! You forgot that you have to create a new column and store the date from the filename in that column. Otherwise, the attendance records look like they're all for the same day. Nice try. You lose." By the way, Adam really is a very nice guy. He says these kinds of things in jest.
"Oh yeah, you're right. Here, let me fix it. Ok, now look."
"Wait, did you just fix that and run it again in one second?"
"Actually... no... that was... let me check... 17 milliseconds."
There was a long awkward silence. He eventually gulped.
Over the next few months, I learned SQL and C# and ASP.NET and rebuilt every single Excel spreadsheet into a full-blown thousand-page custom ERP application that reduced many of our business processes from 40 hours to 40 milliseconds.
Karman Line Capital
A few months after that fateful Saturday morning, I built an application that could back test the original hedge fund strategy using multiple different trading rules. That way, I could run hundreds of combinations of rules back-to-back and monitor their performance to isolate which rules made a difference and which didn't. I eventually discovered a way for the strategy to perform even better than they had originally thought possible.
Mark made me a partner in the fund. Four years later, we have consistently generated better-than-market returns with lower-than-market volatility for our investors. A family office is in the final stages of buying us out, and they plan on investing tens of millions of dollars into the strategy.
I have since helped seven different hedge funds and asset managers back-test and refine their option trading strategies through Speedbridge, my one-man consulting shop. One time, at a networking event, I met the founder of Live Vol, Stefen Choy, who later sold his company to CBOE. When I described to him what I did and how my software worked, he responded,
"Wait, so you can back-test any options trading strategy with any number of legs and any number of entry or exit rules based on any economic indicator? I don't think I've ever seen that done before. Wow!"
You Can Do It Too
I write this not to brag about myself but to encourage you. We all have problem-solving skills. If you have ever asked someone else to do something for you, you had to break larger tasks down into instructions. Coding is just that. You solve a problem by breaking it down into tiny little parts and telling the computer to do things for you. One of my employees at Orion's Mind was formerly a salesman at an auto repair shop. I taught him to code and he is now as Senior SQL Developer.
I'll bet that 20 years ago it was very hard to learn how to code. But the languages are getting easier to learn with every generation, and now that you can ask Google and get answers on Stack Overflow you can find the answer to your questions in minutes. There are so many tutorial videos and bootcamps out there. There is no longer any reason why you can't do it too.
Find a Problem to Solve
My one piece of advice is to try to solve a specific problem. If you just try to "learn how to code" it's overwhelming and you'll get lost in the enormity of it all. But if there is something you need to exist in the world, and you need it so badly you can feel it in every fiber of your body, you can channel that desire and learn just enough code to make it to the finish line. A hedge-fund back test was my thing, but yours will be something different.
Finishing that one project will not make you a good software developer. If you want to be a good developer, you will eventually need to learn object-oriented programming models, design patterns, time- and space-efficient algorithms, and data structures. Just don't let your lack of knowledge on day one intimidate you into not taking that first step. I guarantee the best developers in the world did not know these things when they wrote their first program. They all had to learn at one point in their lives.
Stop making excuses. Just say yes and get it done.
Director of Software Development @Sombra
10 个月Sam, thanks for sharing!
Senior Director of Technology | Insurance & Fintech Expert
11 个月Sam, thanks for sharing!
TECHNICAL WRITER. Policy, Content, & Communications Professional. LI, NY.
5 年Thanks for sharing your inspiring story.
Senior Data Engineer at Liberty Mutual
7 年Great article Sam. You've illustrated that applying the right philosophy is the most important tool for boosting your knowledge in any code. And I remember that R program that was running through SSIS with the click of a button! Keep up the great work.
Trading systems developer and a proud quant
7 年Great story, very inspiring, coding is a delicate combination of art and science, that's what makes it so interesting, best of luck moving forward