jeff.hl Profile picture
@hyperliquidx building a pretty good L1
4 subscribers
Jun 30, 2023 8 tweets 2 min read
1/ Cool to see people trying market making and documenting the progress in public!

Usually it's an opaque space and hard to learn from others. Most professionals want to protect their alpha at all costs.

Here's my advice on dealing with these practical issues 🧵 2/ First of all in HFT there are "strict" problems that you must get right and "loose" problems that you just want to 80/20 at the beginning.

More problems than you think will fall into the second bucket.

Problems will migrate to the first bucket, but slower than you think.
Jun 24, 2023 26 tweets 5 min read
1/ Order book perp DEXs are a hot "narrative" these days.

Most protocols run order books offchain. What does this mean for MEV?

Answer: it's far worse than sandwiching and frontrunning on AMMs.

A thread on why onchain order books are the only viable protection for end users 🧵 2/ I'm going to focus on problems, ideas, and approaches in this thread.

I'm not going to call out any specific projects.

But hopefully after reading this thread you more objectively assess what each project is building.
May 15, 2023 15 tweets 3 min read
1/ Many in crypto HFT rely heavily on historical simulation, while A/B testing is an afterthought.

In my experience there is real alpha in live testing well.

With proper experimental setup and sufficient market share, you can glean causal insights not available in tick data 🧵 Image 2/ First some background:

A/B testing is a useful tool in consumer tech.

Classic example: Google optimized their shade of blue for an additional $200M in yearly ad revenue.

When controlled experiments are cheap, A/B testing is a great way to juice marginal gains.
Apr 30, 2023 12 tweets 3 min read
1/ There's a lot of edge in building a production crypto HFT system the right way.

The abstractions should be rich enough to prevent careless mistakes but not too rigid to work with.

I converged on these after countless hours of building, debugging, and rewriting code 🧵 2/ Let's focus on a concrete example: How do you deal with continuous quantities?

Doing math in code with raw numeric types is error prone. Multiplying the price of one symbol by the size of another is sure way to blow up your strategy.

Just be careful? Nah, we can do better.
Apr 25, 2023 16 tweets 5 min read
1/ Building a crypto HFT system is a challenging and rewarding journey.

A mega-thread covering:
Trading strategies ("what")
The infrastructure and latency optimization ("how")
Exchange selection ("where")
Market dynamics ("who")

What I wish I knew when getting started 🧵 2/ Starting out with the core of the trading system: the strategy itself.

First some general HFT strategy selection advice before specific alpha:
Apr 22, 2023 9 tweets 3 min read
1/ We've talked before about how latency is an important component of every crypto HFT strategy.

The optimization process is fun detective work because the exchange's tech is often a black box.

A thread on what to measure, graph, and analyze for your production HFT system 🧵 Image 2/ The first important number to look at is the "exchange timestamp" field of websocket messages and REST responses.

If multiple time fields exist, use the one corresponding to matching engine time. The other fields are edge server times, which add more noise to your analysis
Apr 9, 2023 13 tweets 4 min read
1/ Been getting good questions as people try the hyperliquid API/SDK.

A few wondered if it's really possible to do crypto HFT in python. The answer is undoubtedly yes!

A thread on how to build a fully automated HFT system, and why python is the ideal language to get started 🧵 2/ A bit of background: our strategy began as a single file python script.

We now use an optimized rust system in production, but the journey to get there was crucial.

If I had started with rust or C++ from day 1, there would've been no trading. Start where you're comfortable.
Apr 5, 2023 7 tweets 2 min read
1/ Huge respect for Dragonfly continuing to invest in the bear market.

But I'm morally obliged to call out sketchy projects gaining momentum.

As a community we must preempt large scale implosions like #FTX or #LUNA that set the industry back years

Bitget may be the next FTX 🧵 2/ About half a year ago we tried HFT on Bitget and quickly noticed their matching engine is dishonest. I'll give specific examples later in the thread.

I later learned from an ex-Bitget team member that they handled retail taker flow by just B-Booking through an internal desk.
Apr 5, 2023 7 tweets 2 min read
1/ Many of you caught on to the April fools trolling here. But the real prank is that I was 80% serious.

In fact, both of these "jokes" are based on real effects.

A thread on real alpha: How to circumvent margin checks on Binance futures and see counterparties on trades 🧵 2/ Let's start with Binance. The coveted "nl" flag is, alas, a joke.

However, the portfolio margin program has the same effect!

Instead of doing margin checks on every trade, Binance will trust you and do the risk checks client side. It's effectively how tradfi futures work.
Apr 3, 2023 10 tweets 3 min read
1/ Agreed. There is some value to guaranteeing quotes in case MMs are slow to turn on trading for a new listing. But figures I’ve seen for payment are orders of magnitude too high for the MM's risk

Projects are getting scammed by trading firms

A thread on MM for new listings🧵 Image 2/ Disclaimer: we have never accepted tokens or call options to "be the MM." We just run our usual strategies.

A big part of the problem is MMs inflating the difficulty of their job. It’s a lucrative business to rip off new token projects. Some firms have killed it in this niche
Apr 1, 2023 7 tweets 2 min read
1/ Many of you have asked for specific latency tricks on different exchanges, since infrastructure optimization is the foundation of a profitable crypto HFT strategy.

Here are some lesser known insights: filtering retail flow on Upbit and bypassing the risk engine on Binance 🧵 2/ First up is the counterparty feed trick on Upbit. It's my favorite way to understand autocorrelated retail flow.

Though this trick is not technically related to decreasing latency, it comes from a similar source of deeply understanding the exchange technology stack.
Mar 30, 2023 17 tweets 4 min read
1/ A question I've been getting a lot: which exchange should I trade on when starting crypto HFT?

Here's a thread of some famous exchanges and our findings running quant strategies there.

The good, the bad, the ugly, and the rigged 🧵 2/ Disclaimer: This is just our experience and not an endorsement of any of these exchanges. I'm an investor in some of these exchanges, but was not paid to write any of this.
Mar 29, 2023 11 tweets 3 min read
1/ Since Binance got hit by the CFTC suit a day after this thread, figured I'd do a timely spicy take here.

Crypto, especially dexes, are an opportunity to rethink markets from first principles.

Let's play devil's advocate here: what are the actual negative effects of spoofing? 2/ Again, I'm not a lawyer, just an opinionated HFT trader and builder. I do not endorse or encourage market manipulation, especially when it is illegal!

Also a note: we'll focus on spoofing but there is a whole class of similar "strategies."
Mar 26, 2023 12 tweets 3 min read
1/ One critical aspect of crypto HFT is protecting your strategy from "market manipulation." These people make a living tricking automated strategies to extract profits

For example here's an algo getting wrecked by a spoofer on a large exchange. A thread on what's going on🧵 2/ Disclaimer: I'm not passing judgment on these actions. I'm not a securities lawyer.

This is just a fact of life that we had to protect ourselves against with when scaling up our strategies.

It's the wild west out there and this is a part of the PvP game
Mar 24, 2023 12 tweets 3 min read
1/ Crypto HFT is our bread and butter in trading. We primarily look at tick data for short term alpha and strategy tuning.

One day we had a crazy idea: What if our own HFT pnl predicted mid frequency price movements?

A thread on one of my favorite medium frequency strategies 🧵 2/ One of our most important principles is "understand your edge." Your hypotheses should be based on simple priors, or you will just overfit to noise.

This is a creative part of quant trading. Building strong intuition about markets can filter out many ideas upfront.
Mar 22, 2023 10 tweets 3 min read
Twitter decided to randomly delete tweets 1, 6, 8, and 9 of my last tweet thread. Posting again here since it was a popular one.

Good thing Elon is not writing our trading systems. 1/ For quants just starting out, what specific strategies should you run?

Cast a wide net when exploring, but quickly focus in when you have a lead. The zero to one moment of live pnl should be your first goal.

A thread on some general directions to get you there 🧵
Mar 21, 2023 9 tweets 3 min read
1/ For quants just starting out, what specific strategies should you run?

Cast a wide net when exploring, but quickly focus in when you have a lead. The zero to one moment of live pnl should be your first goal.

A thread on some general directions to get you there 🧵 2/ First up, making vs taking.

If you're looking into HFT, this is the first fork in the road. This big question boils down to what you want to work on.

Making: Infra quirks, live experimentation, game theory

Taking: More statistical study and modeling of market data
Mar 16, 2023 9 tweets 3 min read
1/ Liquidity is definitely a factor but the fundamental reason for volatility autocorrelation is information propagation.

One mental model for markets is a viscous fluid. Shocks to the system play out as damped oscillations in the price discovery process. 2/ In this analogy, the autocorrelation of volatility is the amplitude decaying over time at rate proportional to viscosity. It's intuitive if you think about dropping heavy objects into liquid.

The viscosity parameter is the efficiency of the market. What are its components?
Mar 12, 2023 10 tweets 3 min read
1/ There could be interesting dislocations on Monday depending how #Coinbase reenables #USDC conversions.

The stuff of quant dreams.

Let's analyze Coinbase's tech stack: order and feed latencies and what makes HFT on Coinbase unique 🧵 2/ We've done this for OKX before, so you know the drill. Run experiments and look at data.

When we first onboard to an exchange, we port over our vanilla MM strategy first. Isolate the infra setup with minimal strategy configuration. Scaling up is easier with positive live pnl.
Mar 10, 2023 11 tweets 3 min read
1/ This is a common fallacy! Just because you cross a wide spread when using a market order, doesn't mean you should place resting limit orders.

If you do this, good chance you are burning money.

Let's use some HFT thinking to help all types of traders 🧵 Image 2/ A simple example: token X is trading with best bid $99 and best offer $100. Let's assume fees are much less than 1%.

You think the fair price of X is $101. If you buy now at $100, you make $1 on average. Simple enough.
Mar 8, 2023 7 tweets 2 min read
1/ One of our favorite discontinued "on-chain" strategies was trading on RFQs. We were literally taking candy from babies, but the babies were other market makers.

We only discontinued because we have high ethical standards. More on that later. 2/ For context: back when we were doing this, the swapper got a last look on the quote on most RFQ protocols. User requests quote -> MM responds with a signed quote -> user broadcasts the quote in a tx. The quote has a timeout, usually ~1 min since blocks are slow.