Hacker News new | past | comments | ask | show | jobs | submit login

Go is great for network heavy apps like algo trading!

I used Go to write trading algos that would find small windows of triangle arbitrages in crypto exchanges. Made me some money but the risk of a big loss made me stop pursing crypto trade and it required too much time and attention. It's a full time job from my experience. Reasons I could lose big at any given time if I scaled up the stakes:

- Exchanges temporarily pausing some specific crypto trading for N reasons (happened very often) while I'm in the middle of the arbitrage.

- Getting caught in the middle of a pump and dump event (also frequent)

- Any algo mistake that would perform excessives trades in succession would incur huge losses because crypto exchanges charge %.

Also, most cryptos have too low volatility. Every time I tried to scale my bot would start interferring oo much with the market. And it wasn't even much money.




It was my (admittedly ignorant) impression that C++ was preferred over garbage-collected languages because you'd be more likely to avoid GC pauses. Yes, of course I know that Go's is super efficient, but if you're doing a million trades a day even a tiny percentage of slowdowns that would be otherwise preventable could be a career-limiting move. Am I just behind the times?


I think you're right! Go will never beat C++ in this aspect.

I used Go because that's what I knew and for the non-professional trading I was aiming, C++ wouldn't have made much difference. My bottlenecks were network (1s+ per trade roundtrip) and chaotic unreliable crypto markets.

Just note that Java is used in HTF, but it's a different beast than our average CRUD Java. For example this article states:

"Essentially, we use a contrived form of Java that avoids all the Java constructs that make things go slow. We only use the constructs that are fast and efficient, and we avoid all the garbage."

https://www.efinancialcareers.co.uk/news/2020/11/low-latency...


Ah, relief. Thanks for answering. At your volume Go makes perfect sense. Love your project!


I think there’s a way to disable GC in Go too, no?


Yep, you can with GOGC=off but then I would have to learn about how to generate less garbage in Go for long running processes. Which is good knowledge even for non-trading applications. I just didn't have the energy and time to try it.


Maybe? Every language one would have to work at to make performant, and generally pre allocation is what often happens to do so. allocation is probably more expensive with a gc’d language like go than C++, but both would want to avoid it.


It's a full time job bc your competitors are full time quant traders :)


Have you tried non crypto markets


Yes but not with Go.

I read like 5 or so books about trading, mostly the classic ones, and tried to toy around with backtracking some self-made strategies using MetaTrader: https://www.metatrader4.com/en/trading-platform

First week was funny. I kept thinking I found goldmines with fine-tunned stochastic lagging indicators, only to realize that I overfitted and an algo that made me rich when tested against a certain period of time would make me go broke when applied to another period.

I tried applying some defense against local maximum, but to no avail.

Best I could do is tie after paying exchange fees. And that took me endless weekends toying around with code, reading books and articles.

My hunch is that algos that don't rely on external signals (i.e. news) need extreme technical edge like High Frequency Trading have with their ultra low latency and premium exchange data feeds.

And I wasn't ready to dive into news sentiment analysis and other external indicators.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: