Conversation

3) There are two mistakes everyone makes when they write their first trading bot. The first is not the subject here, but I'll mention it in passing because it's everywhere and wild and hugely impactful: The Golden Ratio.
1
53
4) When you adjust your models too quickly based on your trades, you end up setting a parameter above The Golden Ratio. E.g. if you show $1,000 of bids within 1% of the market, and you decrease your model by 1% for every $100 you buy, then you'll... do some crazy shit.
2
37
5) Anyway... So what about the other mistake? Well, let's say you want to provide liquidity. A common strategy is: Send a bid 0.20% below the best bid, and an offer 0.20% above the best offer.
1
26
6) Who knows if that makes money or not; that's not the point here. The point is that this will do something silly. a) Let's say the market is 100.45 @ 100.48. It'll send a 100.25 bid. b) Now say someone bids 100.46. It'll cancel its 100.25 bid and send a 100.26 bid.
1
19
7) In fact, every time the best bid changes, the bot cancels its bid and places a new one. What's wrong with that? Well: if the best bid is 100.46..... ...who cares if you bid 100.25 vs 100.26?
1
21
Replying to
9) 0.20% was, probably, just an approximation anyway, meant to say "idk, more than 0.05%, and way less than 1%". So, sure, you could cancel your 100.25 and place a 100.26. Or, you know, you could not. You could just keep your 100.25 bid out there.
1
25
10) But if it's all the same, why am I bothering to write about it? Because placing orders uses a scarce resource: matching engine capacity.
2
28
11) If an exchange can handle 5k orders/second, and it's already processed 4,999, then there's only one slot left. Alice wants to buy 1 BTC. Bob wants to update his 100.25 bid to 100.26. But there's only room for one. I sure hope Alice gets her trade!
1
36
12) _This_ is why ratelimits exist. Because no matter how many orders your exchange can handle, if 100 traders are updating 10 orders each on 50 markets on each side every 0.01% market move, that's 100,000 orders sent when BTC goes up 0.01%. 100,000 orders, and no actual trades
3
40
13) Bots can easily expand to fill whatever limits they're given. In doing so, they sometimes cannibalize all important orders, replacing them with unimportant jiggling of irrelevant orders.
3
29
14) Market makers often reach out to us, asking for higher ratelimits. I used to just grant them! Then I took a look at what was actually going on. And 90% of the time, they were flickering some orders once per second 25bps away from the market.
3
48
15) That's where the ratelimits were going. We might build a tool to let users see what their orders are doing. I think a lot would be pretty surprised: many FTX traders send 50x as many orders per trade as others, even if both are only providing and not taking!
2
49
16) And it's a shame, because in the end it's a public resource. FTX's ratelimits set a fairly constant orders/$ traded, and many of the top firms aren't close to hitting theirs. If you're blowing through yours, ask yourself: what are most of your orders actually doing?
19
116