Ask HN: What are the engineering challenges in high frequency trading? - dmos62
======
lucozade
There are 2 broad areas.

On the fast path, you need to make the decision to trade, check compliance,
credit etc and execute the trade. Not just quickly but quicker than everyone
else.

This translates into a low latency problem, as others have said. But unlike
many real time engineering problems, the environment is actively working
against you so it's a perpetual race to the bottom. To the point that the
speed of light is annoyingly sluggish.

The other big area is trading strategy. The majority of the work here is done
offline and is more about analysing a lot of tick data than latency. Big data
tooling is pretty common here and machine learning is getting more prevalent.

------
jason_slack
Latency is the first thing that comes to mind.

This can be dealt with in a few ways:

1\. Co-lo at the same data centers as your broker. exchanges, etc

2\. zero-copy, kernel bypass techniques.

3\. machines are locked down, striped down of services, fast CPU, disk, lots
of RAM.

But there are still lots of other issues like retrieving data, processing it,
working with it, etc.

I'd be happy to elaborate on anything.

~~~
dmos62
Ok, I'll pick your brain a bit more.

I presume when we're talking about such ultra low latency systems the software
stack is uniquely manual memory management languages, or maybe I should say
non-gc, with Rust gaining traction. At the same time the LMAX exchange runs on
JVM, as far as I know. Reading some opinions you feel like for low-latency a
GC language is a no-go. Maybe you care to comment on that.

Generally, I feel like when discussing these systems the wow factor of "speed
of light is a factor" dwarfs the more mundane aspects. Maybe it would be
enlightening to consider slower 1ms max pause systems. With such requirements
you don't care about being within earshot of the exchange anymore, and you'll
probably not use FPGAs, but you still need latency that is deterministic and
low. When a software engineer has to develop such a system, what are the
challenges, considerations, etc?

~~~
phakding
> Reading some opinions you feel like for low-latency a GC language is a no-
> go. Maybe you care to comment on that.

This is false as far as my experience goes. I've personally worked at two
exchanges (big ones) and they do use java. Also have interviewed with many
trading firms that use java for trading platform.

~~~
zygotic12
Source HSBC. They just re-write the GC to perform as required.

~~~
phakding
Rewriting GC seems like a serious overkill. One could achieve serious low
latency with hotspot.

~~~
zygotic12
Nothing is overkill for these guys. Cross-pollination from the whole business
including HFT.

~~~
jason_slack
Well, I think I can feel you here. I examine everything right now trying to
shave anything I can off my implementations. From stripped down OS to code to
NIC brand, etc.

------
dmos62
The aspect I am somewhat aware of is the latency requirements. It not only has
to be low enough on average, but it has to be predictable, which usually
translates to minimizing latency spikes, which, on garbage collected
platforms, translates to tuning your memory usage patterns, as well as the gc
algorithm directly. I was suprised to learn just how prevalent GC languages
are in this industry.

Also, I'd say that this implies that profiling-centric development is
obligatory.

------
cbm-vic-20
The speed of light is too slow.

I read an article a few years back about latency, not just about switching
decisions at the router level, but due to the actual physical distance the
light/electrons in the physical media need to travel; the HFT servers need to
be very close to the exchange.

------
obayesshelton
Something I read or heard on a podcast was that a lot of the trading stratgies
don't last forever so I guess you could say having enough brain power to keep
creating performing strategies. However, I am not in the HFT world and I could
be totally wrong.

------
LiamPa
Old article now (2013) but still reasonably relevant:

[https://queue.acm.org/detail.cfm?id=2536492](https://queue.acm.org/detail.cfm?id=2536492)

------
maltalex
The first thing that comes to mind is extreme latency sensitivity.

