Building a $3,500/mo Neural Net for Trading as a Side Project

Hello! What's your background, and what are you working on?

I'm Sebastian Dobrincu, and I'm a software engineer currently working as a freelancer. I'm also an avid product maker who loves building side businesses and crazy projects. Machine learning 🤖, mobile development 📱 and design 🖌 are some of the keywords related to my professional background.

I initially built Stock Trading Bot as a personal research project. I was testing the waters to see if modern machine learning approaches can be used to predict and automate selling and buying of assets in today's stock market, at a much more efficient rate.

Only 5 months in it makes around $3,500/month in revenue, with a maintenance cost just shy of $90/month. Currently I am the sole user. I'm planning to continue working on it with the goal of scaling the bot as much as possible.

How'd you come up with the idea to build your stock trading bot?

The idea popped up pretty randomly. I was getting ready to board a flight to SFO and decided to download some podcasts. I felt like trying something new, so I picked a few of the most popular ones from the Finance category. 10,000 feet above the ground, I hit play and made myself comfortable.

The host brought up the topic of liquidity, which boils down to 3 measures: price, size, and time. Essentially when liquidity is high, investors can successfully trade a larger order close to the current price and within a short time span. Once they began debating whether or not high frequency trading was improving the market by providing liquidity, I switched to the Notes app on my phone and started furiously typing some of the main ideas.

Prior to this project, my experience with finance in general was pretty limited. I had a solid understanding of the fundamentals of trading but not much beyond that. I wanted to change that, but I also remembered that 99% of finance books are bullshit.

After extensive research I settled on Trading and Exchanges by Larry Harris and also John Hull's Options, Futures & Other Derivatives. The first one is probably the best piece on finance I've ever read. It literally answers all those questions any curious person who has ever made a trade might ask. On the other hand, John Hull's book gave me a fantastic introduction on mathematical finance from an applied point of view. I highly recommend both if you are just getting started with trading.

I believe we've reached a peak in the field of AI. We now have both powerful machines and enough data to process. With this in mind, my inner engineer got excited at the possibilities of tackling the market with today's advancement in technology. Besides that, I have an addiction for creating fascinating projects and this was no exception.

How long did it take to build your bot, and what kind of tech did you use?

My goal initially was to bootstrap a high frequency trading (HFT) bot focused only on Bitcoin (mainly due to the great available APIs). The huge advantage is that you are not necessarily starting with a handicap against the big trading firms.

That's because when it comes to stock trading, even microseconds could make trades go wrong — such as your bot falling victim of a faster bot's bait offer. (And guess who owns the faster servers and bots?) With cryptocurrencies however, these small time increments are not nearly as important.

Although I believe it's the golden age to be in the Bitcoin market (because it's imperfect), I quickly abandoned the idea (maybe too quickly?) due to not being able to find a stable enough FIX-based API. Without boring you with technical details any longer, the solid trading APIs were mostly based on REST, which is not fast enough for what I was aiming for.

For proprietary reasons I will abstain from publicly discussing a lot of details about the technical implementation. Although I get many requests to open-source the project, I believe that disclosing deep details of the models or prediction approach would hurt the advantages that this solutions has over the other existing bots. However, for anyone willing to learn more about that, I would be more than happy to discuss in private, to some extent.

Long story short, I ultimately ended up going for the stock market, but not into high frequency trading in its real meaning. My bot holds a single position from seconds to minutes (sometimes even hours), which makes it more of an automated trader than a high frequency trader. The reason behind this is that being an individual trader makes it extremely hard to compete with the big guys, as you're lacking perks such as very powerful hardware, advance trained software, and great locations for your servers. The closer to the stock exchange you are, the faster you receive the information. Large investment servers are literally paying millions to get their servers a few miles closer to the exchanges.

For trading I recommend Kite, mainly for their stable Connect APIs and the low bandwidth. Their limitation is 3 requests per second, and this was more than enough for my new strategy. Getting solid historical financial data isn't cheap, and with so many people hitting the providers to scrape and download data, I don't blame them for limiting the offered information. Intrinio is a good provider for real-time stock quotes at very inexpensive prices. However, getting access to more in-depth data would always yield better results.

I built the first prototype in a little under a month. I was working late hours, trying to find time around my daily job as a freelancer. At this point the bot wasn't very smart. It took me about 2 more weeks to feed it with data until my error rate was satisfactory, and another 2 weeks to test it before putting it in production. Summed up, the technical implementation of the current version took about 4 months, with some more improvements along the way.

Interface Demo

What are your goals for the future, and how do you plan to accomplish them?

Since I publicly announced it, I've been receiving dozens of offers from trading companies. At the moment the system gives me an edge over other traders. If I sold it, I'd be giving this advantage to other traders and, subsequently, losing my lead. Although I do not exclude a future buyout, I am presently focusing on improving the product and trying to scale it.

One of the things that I plan on doing soon is increasing the capital and therefore putting the bot through more trading volume. There are tons of improvements I have in mind, especially on adjusting the position-holding time span, as well as solutions to make it more lightweight, facilitating larger volumes.

What are the biggest issues you've faced? What would you do differently if you had to start over?

I wasted way too much time trying to apply high frequency trading in Bitcoin. At first the idea sounded great, but I was soon facing a lot of technical issues trying to scale the amount of requests. However, I am not yet convinced that it's impossible to achieve true HFT with cryptocurrencies, so it might be something I come back to in the future.

After drifting away from the idea of HFT due to the technical limitations, I looked into a more analytical approach in automated trading. Most of those concepts couldn't be applied in the Bitcoin market, as it's highly unpredictable, making it hard to shape the models around it. That's when I decided to stick to the stock market.

Another big mistake in the beginning was relying too heavily on models. Instead of trying different approaches in analyzing the data I had, I relied solely on the models for identifying profitable patterns without investing time into other more direct solutions. Models are only simple real world abstractions, and my common sense has saved me more than once.

So far, my current strategy worked around 95% of the time. Now this is not by any means a reliable metric, and there are many factors that affect it. The bot has not been tested enough to guarantee that this isn't just a fluke (it might as well be). Large investment management companies would do anything to achieve those statistics, and I'm sure I won't keep up that amount of success in upcoming trades. The success so far was also greatly impacted by the favorable market conditions, chosen stocks, and the fact that the bot was running intermittently.

Also, when the 5% case happens, things can go really bad 📉. I learned this the painful way. Not too long ago the market went pretty crazy, and I'd be lying if I said that I wasn't expecting some major crashes of the stocks I was trading. Then it happened.

Although my stop-loss saved me from some brutal losses, had I not stepped in at the right time, the bot would've ruined all the profit from the past months. That event really got me thinking, and I decided to stop it running for a few days until I fixed that loophole.

Revenue Reports

This was also a great learning experience for me, and I believe that without going through those ups and downs, I would've never managed to get the algorithm to where it is today. I have no regrets losing time on Bitcoin, as it gave me a deeper understanding of how cryptocurrency trading works, which might prove useful some day.

What were your biggest advantages? Was anything particularly helpful?

Probably my biggest single advantage is being a starry-eyed young dreamer. To some extent, this allows me to believe enough to put effort into ideas in that others wouldn't. That's what motivated me to persevere in finding those "backdoors" in the market. While many people believe individual traders don't stand much of a chance against the well-equipped companies, I am here to prove that with the right implementation there still is plenty of space in the market.

Another immensely helpful resource were the public research papers available online. In fact, I got tremendous help from papers published back in 2006. I often found that most of them are easily overlooked, although they contain super useful analyses.

Being a workaholic has also contributed a fair amount to this success. I have no issue whatsoever working 10-12 hours per day. With time, I developed a very productive and consistent lifestyle, managing to get rid of most distractions. This allowed me time to invest in polishing and researching the different strategies for this project.

What's your advice for aspiring indie hackers?

Launch things! If you've worked your butt off to build something and give up on launching it, no one will care about it. We live in a very capitalist society where people will judge you based on real results. No one cares about your initiative and the reasons why you didn't launch.

As Sam Altman says, nothing will excuse you for not having a great product. However, not having anything is certainly worse than that. Don't make it perfect from the first version. Test the market first, gather tons of feedback and constantly iterate over your idea.

Although this is not necessarily a customer-focused product (yet?), I can't stress enough the power of side projects. Side projects allow you to experiment on crazy ideas without being labeled as crazy. And even when people do judge you based on this, you can just pull the, "Yeah, it's just a side project" card 😁

And definitely go for the craziest idea you have in mind. That's how most of the successful companies started (talk Facebook, Uber, AirBnb). You probably don't want to spend your most precious resource (⏰), building yet another Snapchat clone. Every problem has a solution. You just have to be creative enough to find it.

Where can readers learn more about you?

You can reach me at any of the following sources and obviously in the comments below. 😄

🔴 Got a cool project? I am currently available for freelance work. 🚀

Sebyddd , Creator of Stock Trading Bot

Want to build your own business like Stock Trading Bot?

You should join the Indie Hackers community! 🤗

We're a few thousand founders helping each other build profitable businesses and side projects. Come share what you're working on and get feedback from your peers.

Not ready to get started on your product yet? No problem. The community is a great place to meet people, learn, and get your feet wet. Feel free to just browse!

Courtland Allen , Indie Hackers founder

  1. 10

    Hey Sebastian, Could you talk a bit more about what you used on the backend? (programming language, deployment infrastructure, etc..)

  2. 6

    Sebastian, have you ever considered using put options instead of stop orders?

    Funny you mention the Trading and Exchanges book, every employee at my day job gets a copy. Larry sits on our board.

    1. 5

      Actually I did recently thought about using options instead. However that would require significant refactoring, and it's not on the roadmap currently.

      Haha, that is great! The book is pure gold and Larry is an amazing instructor! :)

      1. 1

        This comment was deleted 2 years ago.

  3. 5

    As an old hand at bot development, though not for stocks, I find this piece really informative. Thanks for sharing your insights!
    Given my experience in coding bots for crypto trading, the most recent and decent thing that I can recommend is a bot creation platform trality.com
    I anchored there for quite a while, as they have everything you basically need - Python editor, back-testing and live-trading facilities, all in one place.

    1. 5

      Oh, I'm also using it! I'm glad they are still free!

    2. 2

      Victor, thanks for the suggestion. I've tried it. Their integrated Python editor is a godsend!

  4. 5

    Hi Sebastian, which programming language have you used to develop your project?

    1. 5

      Hi Marco. Mostly Python and C++.

  5. 5

    Could you elaborate on your highly productive routine. I have failed so far to set up one. Any advice?

    1. 6

      I think this boils down to finding what works best for you. I suggest you experiment with waking up / going to bed at different hours, getting work done in a certain time frame, exercising more often, eating healthier and getting rid of unnecessary distractions such as TV, social media and randomly browsing the web.

      Once you're in a productive mindset it's so much easier to keep the momentum going. It's of course very important to work on things you enjoy. If you don't enjoy your work, I suggest you start a project that really excites you. That way you can motivate yourself to do the less enjoyable work first and think of the time spent on the other project as a reward of that.

      There are many other things I would suggest you, but it's really up to finding what's best for you. The internet is full of such resources and you should make use of that. Good luck! :)

      1. 2

        I guess my nemesis are FB, HN and twitter. Need to work on that. Thanks for your answer : )

  6. 4

    Cool project. I'm a quantitative researcher working at a hedge fund (not HFT), and I've built a similar bot (profitable, but not as much as yours) after using this book as a guide. I'll do some more reading and try to catch up to you! :)

    http://amzn.to/2lP2kO2

  7. 4

    I really enjoyed this interview. Sebastian, what are your thoughts on value investing?

  8. 4

    It's funny this came up now. I recently got hooked on Robinhood and I'm wanting to build a bot that crawls news articles that refer to a certain company, assesses sentiment, and then makes a trade as a result.
    Based on your experience, do you think trading on such assessments would be worthwhile?

    1. 3

      This comment was deleted 2 years ago.

      1. 2

        Thanks for the insight. So rather than simply using current article sentiments, you're saying it'd be more wise to compare the history of article sentiments and their correlating stock values via machine learning, and comparing that to the current situation, and then making a trade choice?

        1. 5

          My opinion is that combining sentiment analyses with deep learning models to predict the price based on historical data would yield great results. Sentiment analyses alone would probably not be a safe enough source for predictions and therefore automation would be risky.

  9. 3

    Hi Sebastian. Your tech and design capabilities are indeed inspiring. I am interested about your lifestyle. I have 4 questions if you don't mind.

    1. You say that you have "productive and consistent lifestyle". What is your routine?
    2. How do you get rid of distractions?
    3. How long did this project takes you from researching to production?
  10. 3

    what tech stack did you use? i.e. the language/platform/framework
    very nice article, thanks for sharing!

  11. 3

    I'd say that it is certainly worthwhile revisiting Bitcoin and cryptocurrency markets generally. The fact the APIs are tedious and inefficient is a GOOD THING, this leads to a more inefficient market and means that if you can get any stable multi-exchange system running is an advantage in and of itself. Whereas that setup in traditional markets is a necessary starting point.

    If you've been able to find value in stocks then I have no doubt you'll be able to find value in cryptocurrency markets. There is a lot to be gained, trust me.

    Happy to give you some pointers one which exchanges to start (and some historical data).

    My twitter is @js_horne if you'd like to chat more.

    1. 1

      Jacob, I completely agree with you. That's a strong point regarding the advantage of tedious APIs. As I said, I clearly have in mind to revisit cryptocurrencies as I am fully aware of their potential.

      Switching to stocks instead was rather a lazy move to get things moving faster. My initial plan was entirely focused on Bitcoin and I might revisit that idea soon.

      Would love to chat about this! I'll get in touch with you soon! :)

      1. 1

        Hi Sebastian! Have you ever considered cryptocurrency arbitrage? What are your thoughts? Do you think it as a practical possibility?

  12. 3

    This is super interesting Sebastian! I've been toying with the idea myself and this interview helps me a lot.

    So far I'm still having trouble optimizing my prediction layers, but you might've just given me a great idea!

    1. 2

      Glad to hear that Peter! Don't hesitate to message me if you need a second thought. 😊

  13. 2

    HI. Very interesting your article. I have been working on my own on a crypto trading bot writen in PHP. It works fairly good. It is opensource, you can get it at www.trademinator.com.

  14. 2

    hi,nice article.I have been working on my own crypto trading bot written in PHP.It works very well.It is opensource you can get it at www.trademinator.com

  15. 2

    Hey Mate I own a btc mining node with constant supply + my own coin. Can we talk on developing my business a software or profit split etc. Thanks [email protected]

  16. 2

    Do you mind sharing what was the finance podcast you were listening to?

  17. 2

    Have you applied your Stock Trading Bot to the futures market?

  18. 2

    Are you using any machine learning frameworks? What resources did you use to learn about machine learning? I've been interested in this for a while, but haven't taken the plunge yet.

  19. 2

    What's the input and output of your model?

    1. 5

      The input layer consists of statistics of the stock over the last 5 years (maximum I could get from the current provider), while the output is the prediction over the specified time frame.

      Barack Wanjawa has a great paper published on building the model around predicting stock prices. I found it super helpful in my implementation: https://arxiv.org/pdf/1502.06434.pdf

      1. 2

        How do you decide when to place a trade?

        1. 6

          The bot tracks specific patterns, such as what usually happens at X hour and decides to place a trade when the predicted profit rate is greater than a certain threshold.

      2. 1

        Hey Sebastian, thanks for sharing! What are some of the papers that helped you the most in this process? And could you elaborate on when do you follow the models and when to break out of them?

  20. 1

    It is very easy to make big money if you know how to work and you really have a desire to learn how to earn. But there would be nothing to earn if it were not for someone who learns, and who learns from. Of course, you can find friends who know how to make money, but very few people really know how to make good money on trading. People on the site https://forexkings.com/ have been making money trading for many years and they know how to make the right bet and not make mistakes. I also studied on this site and now I can earn up to 70 dollars a day and you can too.

  21. 1

    I heard about different projects, but I still don’t understand if it is realistic to make money through trading.

  22. 1

    Hello! I have a suggestion to you, in my opinion you can have even more revenue by hiring outsource team http://mobilunity.com/blog/benefits-of-staff-augmentation/ the best possible option here is onshoring or nearshoring, outstaffing can lower the retention costs of the app, and if you lower the costs you automatically raise the profit:)

  23. 1

    How many epochs did you train your model for?

  24. 1

    Hi Sebastien, I was wondering if it would be possible to "try" your bot....
    my email is [email protected]

  25. 1

    This post is amazingly inspiring! May I ask you @Sebyddd how much is roughly the model's MAPE%?

  26. 1

    Hi Sebastian! Which broker's API are you using?Do you trade futures?

  27. 1

    Would you like to say how you labelled the data for the training and what the algorithm is trying to trade and in what timeframe ( tick by tick, minutely or daily) ?

  28. 1

    Interesting project! I also used a large number of bots and settled on the bot from trading solution. Using your book as a guide I began to better understand the principles of the bots and it increased the efficiency of my work with them. From a technical point of view , it is a unique set of algorithms.

    P.S. Some time after the launch of your project, can you call it commercially successful?
    Did you make a MVP for investors?

    Source: https://tradingbot-solutions.com/

    1. 1

      Refund policy of trading bot on "tradingbot-solutions.com". No words!

      "To be eligible for a return, your item must be unused and in the same condition that you received it. It must also be in the original packaging.

      Several types of goods are exempt from being returned. Perishable goods such as food, flowers, newspapers or magazines cannot be returned. We also do not accept products that are intimate or sanitary goods, hazardous materials, or flammable liquids or gases.........

  29. 1

    Thanks for such detailed information. You are really a successful man. I hope I can be like you. Now I also do freelance but a nit another kind. This is closely connected with investments. I invest in ICO which I've seen on https://icopulse.com/ and it helps me not to be mistaken

    1. 1

      Don't bother spamming, the links in the comments are nofollow.

  30. 1

    Maybe it makes sense to create own app like Roninhood?
    https://www.cleveroad.com/blog/how-to-build-an-app-like-robinhood-and-make-it-viral

  31. 1

    As a complete novice at trading , I jumped in and purchased stocks before researching other profit strategies using margins and options or researching my picks. With the chance of China manipulating currency values , are there any indications that HMNY, Helios and Mattheson, will make a comeback ?

    1. 1

      This comment was deleted 2 years ago.

  32. 1

    Given the current situation with the markets, it is much more efficient to do intra/day trading and analyze the market sentiment over the social networks. You obviously need to analyze lots of reddits, twitter handles. If you decide to go this way, you can find a nice list of all cryptos with their reddit, twitter, telegram URLs at https://www.cryptowasabi.com . Basic list is for free, I think that's all you need.

    1. 1

      Don't bother spamming, the links in the comments are nofollow.

  33. 1

    I like the way you think. Hope you were able to keep scaling up. What platform did you use to make your automated trading bot?

  34. 1

    I'm also working on a bot from crypto with TensorFlow. If someone wants to join me, please, let me know: [email protected]

  35. 1

    I really enjoyed this interview. Sebastian, what are your thoughts on value investing?
    http://connectfirms.com/

  36. 1

    Hi Sebastian,
    If it's not too intrusive and if you're still monitoring the comment thread, would you mind elaborating on which data you used, why you used it, and what order of precedence you placed on each type? Cheers.

  37. 1

    How simple is it for you to use? For example, do you just say "invest 90$ in whatever you want" and then it does its "magic"?

  38. 1

    Guys, after we make the Bot to appear in the list of trusted Forex brokers http://trade-leader.com/forex/category/trusted-brokers we will not that far off giving him an official status of being with consciousness:D

  39. 1

    Hi Sebastian, I have registered on Kite but it seems a Zerodha account is needed. But Zerodha is asking for PAN number which I tried to apply but I could not input my phone number as it seems like it just accept Indian number. Greatly appreciate if you could help.

  40. 1

    Hey Sebastian, Thanks for sharing your experience. Could you share the research papers you've learned from as well? I'd like to read as much material as I can on this. Also, have you tried other machine learning techniques other than ANN? I've been doing it as well since summer 2016 and I'm currently adjusting my model using convolutional and recurrent neural nets... I'll see where it leads.

  41. 1

    Thanks for writing such an interesting article. how are you testing your algorithsm? i would be interested in finding out more about the infrastructure around how you test and what you use to trade, who hosts your servers etc.

  42. 1

    What is your capital and risk for this return? Without that number, it's impossible to tell how well this algorithm is doing, and whether it is performing worse than doing nothing at all! If you invested a couple million in a bank account at the risk-free rate, you'd be making the same amount per month as you do now with this bot, but with no effort.

    1. 1

      Exactly, 3.5K is relative. I am curious to know about the capital and the risk. BTW great article. TNX

  43. 1

    I'm surprised this article is still up when it seems pretty clear it's a scam and all the comments on Hacker News agree.

  44. 1

    Looks like https://kite.trade is for indian market is there an option to switch to US market?

    1. 2

      Exactly how are you able use Kite.trade which uses Zerodha.com, an Indian brokerage house, and not being a resident of India?

    2. 1

      Testing it in the US market is the #1 priority on my roadmap. While Kite provided great tools for bootstrapping the idea faster, you can only trade Indian exchanges, which in my opinion is a very niche market. Besides that, I still didn't give up on cryptocurrencies and that may also be something I further explore.

      1. 1

        Is there a special requirement for a foreigner to trade in the Indian market using Kite or another service ?

      2. 1

        Did you look at https://www.quantopian.com for the US market? I didnt write my own trading algo with it yet but intent to create one this year. Appearently its an easy to use platform.

        1. 1

          Yes, Quantopian is among my top picks so far, though it has a few downside I am concerned of.

          1. 1

            Could you list some of the downsides? I haven't tried it yet so im just curious.

            One thing I can see is that it's not clear who has access to the algorithm but a solution could be to put it on an external server.

            1. 1

              I wouldn't be very worried about the security of the 'algorithm'. There are some other things like commissions and bandwidth that are keeping me back at the moment.

              1. 1

                Indeed the security threats can be easily mitigated, here is a good guide - https://topdevs.org/blog/web-and-mobile-app-security. In short, it is possible to prevent certain issues over data protection on the app development stage.

  45. 1

    This comment was deleted 4 years ago.