jeff.hl Profile picture
Mar 5 13 tweets 3 min read
1/ Agreed. Papers guide you the wrong way. Academics do not know how to make money quant trading (or why would they be writing?)

How do you get started with real data though? Here's an example: Let's reverse engineer the networking stack at #OKX to minimize order latencies. 🧵
2/ Personally I love studying latency: it's concrete, less noisy than pnl, and forces you to look at the data. The seeds for full-blown strategies often come from tinkering with latency measurements.

Ok let's jump into #OKX. Same process here applies to all exchanges.
3/ First look at the docs and see what stands out. Each OKX API has two endpoints: AWS and AliCloud. This is weird. Do some googling: They launched AWS to make it easier for HFT firms to migrate their tech stack. Makes sense: we were tempted to just use AWS for simplicity.
4/ Read the docs, but also talk to the exchange. Real people will tell you things not written down. OKX is quite accessible, and management is comparatively pro-decentralization. They don't like that a few teams comprise more than half the volume, and want to help new small teams
5/ They'll tell you about "colocation" which is a misnomer since it's still cloud-based, just talk straight to their server and skip the public internet. They'll ask you if you want AWS or AliCloud. If you ask which is faster, the party line is "very similar, both are in HK"
6/ If you only remember one piece of alpha: do your own measurements! We asked them for both setups to measure ourselves

Round trip order time is almost 1ms faster from AliCloud. This is WS order entry, which you can independently confirm is much faster than REST in either case.
7/ This matches our priors: The matching engine is in AliCloud, so unless they do some IEX-style speed bumps it should be faster to trade from there. But again, you don't know until you measure.
8/ There's a subtlety here though. Your strategy needs to process data from other exchanges as an input. Let's say an important tick comes from Binance in AWS Tokyo. What latency does your strategy care about? It's not as simple as server -> OKX round trip.
9/ Rather, you care about AWS Tokyo -> Your machine -> OKX matching engine. Natural places to put your machine are AWS Tokyo, AWS HK, and AliCloud HK. There are more measurements to make here, and I won't bore you with all the details.
10/ The TLDR though (again, you should verify this if you're trading!) is usually just optimize for the obvious thing: order entry latency. This depends on your strategy, and I might do another thread on the details here if people are interested.
11/ The final measurement is always pnl. This is why it's crucial to get a high sharpe strategy with high market share running live ASAP. We ran against our live market making strategy on OKX, and the AB test showed around +20% pnl on AliCloud with high significance.
12/ As important as measuring is, you can slice along so many axes at a time, so choose wisely. Especially in pnl space, statistical significance can take > 1 week for weaker effects. I'll talk about streamlining this process in a future thread. It's an interesting math problem.
13/ But hope this was useful for someone starting out, or gives someone trading on OKX some ideas for ways to optimize their tech stack. Let me know in the comments if there are other exchanges or topics you want to learn about. Happy trading, and happy measuring.

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with jeff.hl

jeff.hl Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @chameleon_jeff

Mar 4
1/ Controversial take: hard work is more important than smart work.

It's a myth that we only have a few hours of good creative work per day. Train yourself to grind long hours first. You will surprise yourself. The work naturally become higher quality, less distracted.
2/ Train yourself to go from 10 to 40 to 100 hours of focused work a week. I did this for months building an automated trading system from scratch. 5am-10pm 7days/week

99% of people need #WorkLifeBalance or whatever, and that's great. But I'm talking to the people on a mission.
3/ Do you really want something? Then really work. Half-assing doesn't get you anywhere. Don't look for "system hacks," or whatever, just do it. You first need the baseline mentality of going all in, or nothing else matters
Read 6 tweets
Feb 28
1/ A picture is worth a thousand...ideas for a new HFT strategy in crypto?

Ever wonder how to go from raw market data to an automated strategy in crypto HFT? Here's an actual case study our team did. Image
2/ This graph is the BBO (i.e. price of highest bid and lowest offer) of BTCUSDT on #Binance, zoomed in. The y-axis is in USDT, with an arbitrary offset. The x-axis is time, around a 20ms range.

Standard stuff. But HFT is all about thinking deeply about simple things.
3/ Mysteries:

y-axis: that spread is tiny. One cent on BTCUSDT is... less than 0.01bps? What is this liquidity??

x-axis: When the offer ticks up the bid follows in... 3ms? If you've ever measured the round-trip order latency on AWS, you'll know it's never this fast.
Read 11 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(